-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathclient.lua
More file actions
199 lines (174 loc) · 3.75 KB
/
Copy pathclient.lua
File metadata and controls
199 lines (174 loc) · 3.75 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
---------------------------------------------------------
-------------- RealWorld - VRP UserList -----------------
-------------- https://discord.gg/realw -----------------
---------------------------------------------------------
vrp_rw_userlistC = {}
Tunnel.bindInterface("vrp_rw_userlist", vrp_rw_userlistC)
Proxy.addInterface("vrp_rw_userlist", vrp_rw_userlistC)
vRP = Proxy.getInterface("vRP")
vrp_rw_userlistS = Tunnel.getInterface("vrp_rw_userlist", "vrp_rw_userlist")
function isSearchGroup(groups, value)
if groups == nil then
return false
end
for _, v in pairs(groups) do
if v == value then
return true
end
end
return false
end
function UpdatePlayerTable(playerList, maxClients)
if not playerList or not maxClients then
return
end
local typeCount = {
all = 0,
ems = 0,
cop = 0,
uber = 0,
repair = 0,
shh = 0,
mafia = 0,
gm = 0,
tow = 0,
cbs = 0,
kys = 0,
helper = 0,
inspector = 0,
admin = 0
}
table.sort(
playerList,
function(a, b)
if tonumber(a.id) ~= nil and tonumber(b.id) ~= nil then
return tonumber(a.id) < tonumber(b.id)
else
return false
end
end
)
for k, v in ipairs(playerList) do
if not v.jobType then
v.jobType = ""
end
if isSearchGroup(v.groups, "helper") then
v.jobType2 = "helper"
else
v.jobType2 = ""
end
local icon = Config.jobIcons[v.jobType] or Config.jobIcons["person"]
--v.nickname = removeEmoji(v.nickname)
v.job = icon .. " " .. v.job
if typeCount[v.jobType] then
typeCount[v.jobType] = typeCount[v.jobType] + 1
end
if v.jobType ~= "helper" and v.jobType2 == "helper" then
typeCount.helper = typeCount.helper + 1
end
typeCount.all = typeCount.all + 1
end
SendNUIMessage(
{
action = "updatePlayerList",
players = playerList,
maxClients = maxClients
}
)
SendNUIMessage(
{
action = "updatePlayerJobs",
jobs = typeCount
}
)
end
function ToggleScoreBoard()
SendNUIMessage(
{
action = "toggle"
}
)
end
function vrp_rw_userlistC.updatePlayerList(playerList, maxClients)
UpdatePlayerTable(playerList, maxClients)
end
RegisterNUICallback(
"showList",
function(data, cb)
SetNuiFocus(true, true)
end
)
RegisterNUICallback(
"hideList",
function(data, cb)
SetNuiFocus(false, false)
end
)
Citizen.CreateThread(
function()
Citizen.Wait(500)
SetNuiFocus(false, false)
local categories = {}
for k, v in pairs(Config.categories) do
table.insert(categories, {v[1], k, v[2], v[3]})
end
table.sort(
categories,
function(a, b)
return tonumber(a[1]) < tonumber(b[1])
end
)
SendNUIMessage(
{
action = "init",
categories = categories,
toggleKey = Config.toggleKey[2]
}
)
while true do
Citizen.Wait(0)
if IsControlJustReleased(0, Config.toggleKey[1]) and IsInputDisabled(0) then
SetNuiFocus(true, true)
SetNuiFocus(false, false)
ToggleScoreBoard()
Citizen.Wait(500)
end
end
end
)
Citizen.CreateThread(
function()
while true do
Citizen.Wait(500)
if IsPauseMenuActive() and not IsPaused then
IsPaused = true
SendNUIMessage(
{
action = "close"
}
)
elseif not IsPauseMenuActive() and IsPaused then
IsPaused = false
end
end
end
)
Citizen.CreateThread(
function()
local playMinute, playHour = 0, 0
while true do
Citizen.Wait(1000 * 60)
playMinute = playMinute + 1
if playMinute == 60 then
playMinute = 0
playHour = playHour + 1
end
SendNUIMessage(
{
action = "updateServerInfo",
playTime = string.format("%02d시간 %02d분", playHour, playMinute)
}
)
end
end
)