-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathserver.lua
More file actions
36 lines (28 loc) · 889 Bytes
/
server.lua
File metadata and controls
36 lines (28 loc) · 889 Bytes
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
ESX.RegisterServerCallback("getScoreboardConfig", function(_, cb)
local Jobs <const> = ESX.GetJobs()
for name, value in pairs(Factions) do
value.label = Jobs[name]?.label or "Ismeretlen"
end
cb(GetConvarInt('sv_maxclients', 32), Factions)
end)
ESX.RegisterServerCallback("getScorePlayers", function(source, cb)
local players = {}
local myData = {}
for _, player in pairs(GetPlayers()) do
local xPlayer = ESX.GetPlayerFromId(player)
if xPlayer then
local job <const> = xPlayer.getJob().name
local playerData <const> = {
serverId = player,
name = xPlayer.getName(),
job = Factions[job] and job or nil,
ping = GetPlayerPing(player)
}
table.insert(players, playerData)
if (tonumber(player) == tonumber(source)) then
myData = playerData
end
end
end
cb(players, myData)
end)