forked from antonpeetso/Stadus_Scoreboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.lua
81 lines (71 loc) · 1.64 KB
/
client.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
local listOn = false
local Faketimer = 0
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
Citizen.CreateThread(function()
if Faketimer >= 3 then
Faketimer = 0
end
listOn = false
while true do
Citizen.Wait(10)
if IsControlPressed(0, 178)--[[ INPUT_PHONE ]] then
if not listOn then
local players = {}
ptable = GetPlayers()
for _, i in ipairs(ptable) do
table.insert(players,
'<tr style=\"color: rgb(' .. 255 .. ', ' .. 255 .. ', ' .. 255 .. ')\"><td>' .. GetPlayerServerId(i) .. '</td><td>' .. GetPlayerName(i) .. '</td></tr>')
end
if Faketimer >= 2 then
ESX.TriggerServerCallback('scoreboard:getScoreboard', function(ems, police, taxi, mek, bil, maklare, spelare)
SendNUIMessage({ text = table.concat(players),
ems = ems,
police = police,
taxi = taxi,
mek = mek,
bil = bil,
maklare = maklare,
spelare = spelare
})
end)
Faketimer = 0
else
SendNUIMessage({ text = table.concat(players)})
Faketimer = 0
end
listOn = true
while listOn do
Citizen.Wait(10)
if(IsControlPressed(0, 178) == false) then
listOn = false
SendNUIMessage({
meta = 'close'
})
break
end
end
end
end
end
end)
Citizen.CreateThread(function() -- Thread for timer
while true do
Citizen.Wait(1000)
Faketimer = Faketimer + 1
end
end)
function GetPlayers()
local players = {}
for i = 0, 32 do
if NetworkIsPlayerActive(i) then
table.insert(players, i)
end
end
return players
end