-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.lua
52 lines (44 loc) · 1.12 KB
/
server.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
local function isAdmin(source)
local allowed = false
for i,id in ipairs(Config.EAS.admins) do
for x,pid in ipairs(GetPlayerIdentifiers(source)) do
if string.lower(pid) == string.lower(id) then
allowed = true
end
end
end
if IsPlayerAceAllowed(source, "lance.eas") then
allowed = true
end
return allowed
end
local function stringsplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
RegisterServerEvent("alert:sv")
AddEventHandler("alert:sv", function (msg, msg2)
if (isAdmin(source)) then
TriggerClientEvent("SendAlert", -1, msg, msg2)
end
end)
AddEventHandler('chatMessage', function(source, name, msg)
if (isAdmin(source)) then
local command = stringsplit(msg, " ")[1];
if command == "/noitedocrime" then
CancelEvent()
TriggerClientEvent("alert:Send", source, string.sub(msg, 15), Config.EAS.Departments)
end
if command == "/noitecrimefim" then
CancelEvent()
TriggerClientEvent("alert:fim", source)
end
end
end)