-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathclient.lua
175 lines (146 loc) · 4.15 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
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
IsPaused = false
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
-- CONFIG --
-- The watermark text --
--servername = "Cops - 0\nTest - 2"
jobs = {}
RegisterNetEvent('esx_jobCounter:set')
AddEventHandler('esx_jobCounter:set', function(jobs_online)
--servername = jobs_online['police'].." - Cops".."\n"..
-- jobs_online['ambulance'].." - Sani".."\n"..
-- jobs_online['mecano'].." - Meca".."\n"..
-- jobs_online['taxi'].." - Taxi"
jobs = jobs_online
if jobs['police'] < 1 then
cops_online = 'red'
elseif jobs['police'] < 5 then
cops_online = 'yellow'
elseif jobs['police'] >= 5 then
cops_online = 'green'
end
if jobs['ambulance'] < 1 then
sani_online = 'red'
elseif jobs['ambulance'] < 5 then
sani_online = 'yellow'
elseif jobs['ambulance'] >= 5 then
sani_online = 'green'
end
if jobs['mecano'] < 1 then
meca_online = 'red'
elseif jobs['mecano'] < 5 then
meca_online = 'yellow'
elseif jobs['mecano'] >= 5 then
meca_online = 'green'
end
if jobs['taxi'] < 1 then
taxi_online = 'red'
elseif jobs['taxi'] < 5 then
taxi_online = 'yellow'
elseif jobs['taxi'] >= 5 then
taxi_online = 'green'
end
ESX.UI.HUD.UpdateElement('jobsCounter', {
cops = cops_online,
sani = sani_online,
meca = meca_online,
taxi = taxi_online
})
end)
Citizen.CreateThread(function()
while true do
TriggerServerEvent('esx_jobCounter:get')
Wait(30000)
end
end)
--[[ The x and y offset (starting at the top left corner) --
-- Default: 0.005, 0.001
offset = {x = 0.005, y = 0.001}
-- Text RGB Color --
-- Default: 64, 64, 64 (gray)
rgb = {r = 164, g = 164, b = 164}
-- Text transparency --
-- Default: 255
alpha = 255
-- Text scale
-- Default: 0.4
-- NOTE: Number needs to be a float (so instead of 1 do 1.0)
scale = 0.4
-- Text Font --
-- 0 - 5 possible
-- Default: 1
font = 4
]]--
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
local jobsOnlineTpl = '<small style="font-size: 20px;">'..
'<div style="border-radius: 100px; text-shadow: 2px 0 0 {{cops}}, 0 -2px 0 {{cops}}, 0 2px 0 {{cops}}, -2px 0 0 {{cops}};">🚓</div>'..
'<div style="border-radius: 100px; text-shadow: 2px 0 0 {{sani}}, 0 -2px 0 {{sani}}, 0 2px 0 {{sani}}, -2px 0 0 {{sani}};">🚑</div>'..
'<div style="border-radius: 100px; text-shadow: 2px 0 0 {{meca}}, 0 -2px 0 {{meca}}, 0 2px 0 {{meca}}, -2px 0 0 {{meca}};">🔧</div>'..
'<div style="border-radius: 100px; text-shadow: 2px 0 0 {{taxi}}, 0 -2px 0 {{taxi}}, 0 2px 0 {{taxi}}, -2px 0 0 {{taxi}};">🚕</div>'..
'</small>'
ESX.UI.HUD.RegisterElement('jobsCounter', 20, 0, jobsOnlineTpl, {
cops = 0,
sani = 0,
meca = 0,
taxi = 0
})
if jobs['police'] < 1 then
cops_online = 'red'
elseif jobs['police'] < 5 then
cops_online = 'yellow'
elseif jobs['police'] >= 5 then
cops_online = 'green'
end
if jobs['ambulance'] < 1 then
sani_online = 'red'
elseif jobs['ambulance'] < 5 then
sani_online = 'yellow'
elseif jobs['ambulance'] >= 5 then
sani_online = 'green'
end
if jobs['mecano'] < 1 then
meca_online = 'red'
elseif jobs['mecano'] < 5 then
meca_online = 'yellow'
elseif jobs['mecano'] >= 5 then
meca_online = 'green'
end
if jobs['taxi'] < 1 then
taxi_online = 'red'
elseif jobs['taxi'] < 5 then
taxi_online = 'yellow'
elseif jobs['taxi'] >= 5 then
taxi_online = 'green'
end
ESX.UI.HUD.UpdateElement('jobsCounter', {
cops = cops_online,
sani = sani_online,
meca = meca_online,
taxi = taxi_online
})
end)
-- CODE --
--[[
Citizen.CreateThread(function()
while true do
Wait(1)
SetTextColour(rgb.r, rgb.g, rgb.b, alpha)
SetTextFont(font)
SetTextScale(scale, scale)
SetTextWrap(0.0, 1.0)
SetTextCentre(false)
SetTextDropshadow(2, 2, 0, 0, 0)
SetTextEdge(1, 0, 0, 0, 205)
SetTextEntry("STRING")
AddTextComponentString(servername)
DrawText(offset.x, offset.y)
end
end)
]]--