-
Notifications
You must be signed in to change notification settings - Fork 4
/
client.lua
204 lines (158 loc) · 4.72 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerLoaded = true
ESX.PlayerData = xPlayer
cash = ESX.PlayerData.money
end)
PlayerData = {}
local boss = false
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerLoaded = true
ESX.PlayerData = xPlayer
cash = ESX.PlayerData.money
PlayerData = xPlayer
if PlayerData.job.grade_name == 'boss' then
boss = true
else
boss = false
end
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
if PlayerData.job.grade_name == 'boss' then
boss = true
else
boss = false
end
end)
function roundxx(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
function drawRct2(x,y,width,height,r,g,b,a)
DrawRect(x + width/4, y + height/1, width, height, r, g, b, a)
end
function drawTxt3(x,y ,width,height,scale, text, r,g,b,a)
SetTextFont(6)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(2, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x - width/5.5, y - height/20000)
end
local ShowHUD = true
local cash = 0
local blackcash = 0
RegisterNetEvent("sendWeight")
AddEventHandler("sendWeight", function(mm)
Weight = mm
end)
RegisterNetEvent("es:removedMoney")
AddEventHandler("es:removedMoney", function(_, _, _)
cash = ESX.GetPlayerData().money
end)
RegisterNetEvent("es:addedMoney")
AddEventHandler("es:addedMoney", function(_, _)
cash = ESX.GetPlayerData().money
end)
RegisterNetEvent("showhud:toggle")
AddEventHandler("showhud:toggle", function(m)
ShowHUD = m
end)
local rdy = true
function ShowHud()
ShowHUD = not ShowHUD
end
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function()
rdy = true
end)
local faimVal = 0
local soifVal = 0
Citizen.CreateThread(function()
while true do
Citizen.Wait(5000)
TriggerEvent('esx_status:getStatus', 'hunger', function(status)
faimVal = status.val/1000000*100
end)
TriggerEvent('esx_status:getStatus', 'thirst', function(status)
soifVal = status.val/1000000*100
end)
end
end)
HUD = {}
local societyMoney = 0
RegisterNetEvent('esx_addonaccount:setMoney')
AddEventHandler('esx_addonaccount:setMoney', function(society, money)
if PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' and 'society_' .. PlayerData.job.name == society then
societyMoney = money
end
end)
Citizen.CreateThread(function()
hea = 200
while true do
Citizen.Wait(0)
if rdy then
if ShowHUD then
local myPed = GetPlayerPed(-1)
local veh = GetVehiclePedIsIn(myPed,true)
local health = GetEntityHealth(myPed) - 100
local armor = GetPedArmour(myPed)
local vitesse = GetEntitySpeed(veh) * 3.6
local plate = GetVehicleNumberPlateText(veh)
if health < 0 then
health = GetEntityHealth(myPed)
end
local armor = GetPedArmour(myPed)
drawTxt3(1.010, 0.963, 1.0,1.0,0.40 , "" .."❤️" ,255, 255, 255, 255)
drawTxt3(1.031, 0.963, 1.0,1.0,0.50 , "" ..math.ceil(health) .. "", 255, 255, 255, 255)
drawTxt3(1.049, 0.963, 1.0,1.0,0.40 , "" .."🛡" ,255, 255, 255, 255)
drawTxt3(1.068, 0.963, 1.0,1.0,0.50 , "" ..math.ceil(armor).."", 255, 255, 255, 255)
drawTxt3(1.087, 0.963, 1.0,1.0,0.40 , "" .."🍔" ,255, 255, 255, 255)
drawTxt3(1.108, 0.963, 1.0,1.0,0.50 , "" ..math.ceil(faimVal) .. "", 255, 255, 255, 255)
drawTxt3(1.125, 0.963, 1.0,1.0,0.40 , "" .."🥤" ,255, 255, 255, 255)
drawTxt3(1.144, 0.963, 1.0,1.0,0.50 , "" ..math.ceil(soifVal) .. "", 255, 255, 255, 255)
end
end
end
end)
local LastPress = 0
Citizen.CreateThread( function()
while true do
Wait( 0 )
if IsControlPressed( 0, 82 ) then
if PlayerData.job~= nil then
drawTxt3(1.249, 1.453, 1.0,1.0,0.40 , PlayerData.job.label .. " - " .. PlayerData.job.grade_label ,255, 255, 255, 255)
end
end
end
end )
function drawTxt(text,font,centre,x,y,scale,r,g,b,a)
SetTextFont(font)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow(0)
SetTextOutline(0)
SetTextCentre(centre)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x , y)
end
SendNUIMessage({hud = ShowHUD})