forked from AlterGamingNetwork/mellotrainer
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsv_admin.lua
116 lines (94 loc) · 4.56 KB
/
sv_admin.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
--[[--------------------------------------------------------------------------
*
* Mello Trainer
* (C) Michael Goodwin 2017
* http://github.com/thestonedturtle/mellotrainer/releases
*
* This menu used the Scorpion Trainer as a framework to build off of.
* https://github.com/pongo1231/ScorpionTrainer
* (C) Emre Cürgül 2017
*
* A lot of useful functionality has been converted from the lambda menu.
* https://lambda.menu
* (C) Oui 2017
*
* Additional Contributors:
* WolfKnight (https://forum.fivem.net/u/WolfKnight)
*
---------------------------------------------------------------------------]]
--[[------------------------------------------------------------------------
Kick Player
------------------------------------------------------------------------]]--
RegisterServerEvent( 'mellotrainer:adminKick' )
AddEventHandler( 'mellotrainer:adminKick', function( id, reason )
DropPlayer( id, reason )
end )
--[[------------------------------------------------------------------------
Temp Ban Player
------------------------------------------------------------------------]]--
local tempBannedUsers = {}
RegisterServerEvent( 'mellotrainer:adminTempBan' )
AddEventHandler( 'mellotrainer:adminTempBan', function( id )
local license = DATASAVE:GetIdentifier( id, "license" )
if ( license ~= nil ) then
tempBannedUsers[license] = true
DATASAVE:print( GetPlayerName( id ) .. " has been temporarily banned by " .. GetPlayerName( source ) .. "." )
DropPlayer( id, "Banned: You have been temporarily banned." )
end
end )
AddEventHandler( 'playerConnecting', function( name, setReason )
local license = DATASAVE:GetIdentifier( source, "license" )
if ( license ~= nil ) then
if ( tempBannedUsers[license] ) then
DATASAVE:print( GetPlayerName( source ) .. " is temporarily banned, refusing connection." )
setReason( "Banned: You have been temporarily banned." )
CancelEvent()
end
end
end )
--[[------------------------------------------------------------------------
Kill Player
------------------------------------------------------------------------]]--
RegisterNetEvent( 'mellotrainer:s_adminKill' )
AddEventHandler( 'mellotrainer:s_adminKill', function( id )
TriggerClientEvent( 'mellotrainer:adminKill', id )
end )
--[[------------------------------------------------------------------------
Teleport Plsyer
------------------------------------------------------------------------]]--
RegisterNetEvent( 'mellotrainer:s_adminTp' )
AddEventHandler( 'mellotrainer:s_adminTp', function( id )
TriggerClientEvent( 'mellotrainer:adminTp', id, source )
end )
-- _______ _ ____ _ _
-- |__ __(_) / __ \ | | (_)
-- | | _ _ __ ___ ___ | | | |_ __ | |_ _ ___ _ __ ___
-- | | | | '_ ` _ \ / _ \ | | | | '_ \| __| |/ _ \| '_ \/ __|
-- | | | | | | | | | __/ | |__| | |_) | |_| | (_) | | | \__ \
-- |_| |_|_| |_| |_|\___| \____/| .__/ \__|_|\___/|_| |_|___/
-- | |
-- |_|
RegisterServerEvent('mellotrainer:adminTime')
AddEventHandler('mellotrainer:adminTime', function(from, hour, minutes, seconds)
TriggerClientEvent('mellotrainer:updateTime', -1, hour, minutes, seconds)
end)
-- __ __ _ _ ____ _ _
-- \ \ / / | | | | / __ \ | | (_)
-- \ \ /\ / /__ __ _| |_| |__ ___ _ __ | | | |_ __ | |_ _ ___ _ __ ___
-- \ \/ \/ / _ \/ _` | __| '_ \ / _ \ '__| | | | | '_ \| __| |/ _ \| '_ \/ __|
-- \ /\ / __/ (_| | |_| | | | __/ | | |__| | |_) | |_| | (_) | | | \__ \
-- \/ \/ \___|\__,_|\__|_| |_|\___|_| \____/| .__/ \__|_|\___/|_| |_|___/
-- | |
-- |_|
RegisterServerEvent('mellotrainer:adminWeather')
AddEventHandler('mellotrainer:adminWeather', function(from, weatherState, persistToggle)
TriggerClientEvent('mellotrainer:updateWeather', -1, weatherState, persistToggle)
end)
RegisterServerEvent('mellotrainer:adminBlackout')
AddEventHandler('mellotrainer:adminBlackout', function(from, toggle)
TriggerClientEvent('mellotrainer:updateBlackout', -1, toggle)
end)
RegisterServerEvent('mellotrainer:adminWind')
AddEventHandler('mellotrainer:adminWind', function(from, state, heading)
TriggerClientEvent('mellotrainer:updateWind', -1, state, heading)
end)