-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
55 lines (45 loc) · 1.61 KB
/
server.lua
File metadata and controls
55 lines (45 loc) · 1.61 KB
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
-- Lista de jugadores con permiso (puedes poner su steam hex o license)
local allowedPlayers = {
--"steam:110000112345678", -- ejemplo
"license:33afe6c01" -- ejemplo
}
RegisterCommand("setped", function(source, args)
if source == 0 then
print("Este comando solo lo pueden usar jugadores en el juego.")
return
end
local playerId = source
local pedModel = args[1]
if not pedModel then
TriggerClientEvent('chat:addMessage', playerId, { args = { '^1ERROR', 'Debes escribir un modelo de ped.' } })
return
end
if not hasPermission(playerId) then
TriggerClientEvent('chat:addMessage', playerId, { args = { '^1ERROR', 'No tienes permisos para usar este comando.' } })
return
end
TriggerClientEvent("setPed:change", playerId, pedModel)
end, false)
RegisterCommand("resetped", function(source)
if source == 0 then
print("Este comando solo lo pueden usar jugadores en el juego.")
return
end
local playerId = source
if not hasPermission(playerId) then
TriggerClientEvent('chat:addMessage', playerId, { args = { '^1ERROR', 'No tienes permisos para usar este comando.' } })
return
end
TriggerClientEvent("setPed:reset", playerId)
end, false)
function hasPermission(playerId)
local identifiers = GetPlayerIdentifiers(playerId)
for _, id in ipairs(identifiers) do
for _, allowedId in ipairs(allowedPlayers) do
if id == allowedId then
return true
end
end
end
return false
end