-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.lua
33 lines (26 loc) · 878 Bytes
/
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
local charset = {}
for i = 48, 57 do table.insert(charset, string.char(i)) end
for i = 65, 90 do table.insert(charset, string.char(i)) end
for i = 97, 122 do table.insert(charset, string.char(i)) end
function string.random(length)
math.randomseed(os.time())
if length > 0 then
return string.random(length - 1) .. charset[math.random(1, #charset)]
else
return ""
end
end
local eventpassword = string.random(12)
print("[gvrp_yannik]: Eventpassword: " .. eventpassword)
RegisterServerEvent('gvrp_getpw')
AddEventHandler('gvrp_getpw', function ()
TriggerClientEvent('gvrp_clientpw', source, eventpassword)
end)
RegisterServerEvent('gvrp_alarm')
AddEventHandler('gvrp_alarm', function(pw)
if pw == eventpassword then
TriggerClientEvent('gvrp_prisonalarm', -1)
else
DropPlayer(source, "No modding allowed.")
end
end)