-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
305 lines (243 loc) · 10.3 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
DGS = exports.dgs
local x,y = guiGetScreenSize()
local NotifeData = {}
ProgressBarShaders = {}
NotifeData.x, NotifeData.y = x,y
NotifeData.resW, NotifeData.resH = guiGetScreenSize()
NotifeData.x2, NotifeData.y2 = guiGetScreenSize()
Font = dxCreateFont("file/Gilroy-Medium.ttf", 25)
Font_fps = dxCreateFont("file/fps.ttf", 15)
intervalWanted = 70
-------------Глушит-Звуки-----------------
setAmbientSoundEnabled( "general", false )
setAmbientSoundEnabled( "gunfire", false )
setPlayerHudComponentVisible("ammo", false)
setPlayerHudComponentVisible("health", false)
setPlayerHudComponentVisible("armour", false)
setPlayerHudComponentVisible("breath", false)
setPlayerHudComponentVisible("clock", false)
setPlayerHudComponentVisible("money", false)
setPlayerHudComponentVisible("weapon", false)
setPlayerHudComponentVisible("vehicle_name", false)
setPlayerHudComponentVisible("area_name", false)
setPlayerHudComponentVisible("radio", false)
setPlayerHudComponentVisible("wanted", false)
setPlayerHudComponentVisible("radar", false)
------------------------------------------
-- function ProgressBar()
-- DGS = exports.dgs
-- pbRound = DGS:dgsCreateProgressBar(x-170,-35,200,200,false)
-- DGS:dgsSetProperty(pbRound,"bgColor",tocolor(255,255,255, 255))
-- DGS:dgsSetProperty(pbRound,"indicatorColor",tocolor(225, 0, 0,255))
-- DGS:dgsProgressBarSetProgress(pbRound, 15)
-- DGS:dgsProgressBarSetStyle(pbRound,"ring-round",{
-- isReverse = false,
-- rotation = 90,
-- antiAliased = 0.005,
-- radius = 0.54,
-- thickness = 5})
-- DGS:dgsProgressBarSetStyleProperty(pbRound,"thickness",50)
-- end
function Progress()
DGS = exports.dgs
local pbRoundOptional = DGS:dgsCreateProgressBar(x-455,-15,200,200,false)
DGS:dgsSetProperty(pbRoundOptional,"bgColor",tocolor(255,255,255, 20))
DGS:dgsSetProperty(pbRoundOptional,"indicatorColor",tocolor(225, 0, 0,215))
DGS:dgsProgressBarSetProgress(pbRoundOptional, 50)
DGS:dgsProgressBarSetStyle(pbRoundOptional,"ring-round",{
isReverse = true,
rotation = 270,
antiAliased = 1.005,
radius = 0.25,
thickness = 0.027})
DGS:dgsProgressBarSetProgress(pbRoundOptional, 55)
end
function convertNumber(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1.%2')
if (k==0) then
break
end
end
return formatted
end
function DxDrawHudConcept()
local time = getRealTime()
local dia = ("%02d"):format(time.monthday)
local mes = ("%02d"):format(time.month+1)
local ano = ("%02d"):format(time.year + 1900)
local hours = time.hour
local minutes = time.minute
local seconds = time.second
if minutes <= 9 then
minutes = "0"..minutes
end
if (seconds < 10) then
seconds = "0"..seconds
end
local x = x
local y = 0
local oxigenio = math.floor (getPedOxygenLevel( getLocalPlayer() ))
local wantedLvl = getPlayerWantedLevel ( )
local health = getElementHealth(localPlayer)
local armor = getPedArmor(localPlayer)
local money = getPlayerMoney()
local level = getElementData(localPlayer,"lvl") or 1
local xp = getElementData(localPlayer,"exp") or 0
dxDrawRectangleCr(x-435,y+10,425,155,5,tocolor(0,0,0,75),false,false,false,true)
dxDrawRectangleCr( x-255,70, 220, 10, 5, tocolor( 25, 25, 25, 154 ),false,false,false,true)
dxDrawRectangleCr( x-255,70, armor*2.2, 10, 5, tocolor(50, 195, 255,154 ),false,false,false,true)
dxDrawRectangleCr( x-255,110, 220, 10, 5, tocolor( 25, 25, 25, 154 ),false,false,false,true)
dxDrawRectangleCr( x-255,110, health*2.2, 10, 6, tocolor( 255, 0, 0, 175 ),false,false,false,true)
dxDrawRectangleCr( x-255,90, 220, 10, 5, tocolor( 25, 25, 25, 154 ),false,false,false,true)
if ( oxigenio < 1000 or isElementInWater( getLocalPlayer() )) then
dxDrawRectangleCr(x-255,90,oxigenio/10*2.2,10,5, tocolor(255, 255, 255,200),false,false,false,true)
end
------------------------------------------------------------------------------------
local timehour, timeminute = getTime()
dxDrawText(timehour..":"..timeminute,x,y,x-150,80,tocolor(255,255,255,200),0.85,Font,"right","center",false,false,false,true)
dxDrawText(""..convertNumber(money).." ₽ |", x-0, 5,x-55.5,280, tocolor(255,255,255,255),0.7,Font, "right", "center",false,false,false,true)
dxDrawImage ( x-415, 175, 26, 24, 'images/wanted_a.png', angle, 0, -120 ,tocolor(25,25,25,154) )
dxDrawImage ( x-415+intervalWanted, 175, 26, 24, 'images/wanted_a.png', angle, 0, -120 ,tocolor(25,25,25,154) )
dxDrawImage ( x-415+intervalWanted*2, 175, 26, 24, 'images/wanted_a.png', angle, 0, -120 ,tocolor(25,25,25,154) )
dxDrawImage ( x-415+intervalWanted*3, 175, 26, 24, 'images/wanted_a.png', angle, 0, -120 ,tocolor(25,25,25,154) )
dxDrawImage ( x-415+intervalWanted*4, 175, 26, 24, 'images/wanted_a.png', angle, 0, -120 ,tocolor(25,25,25,154) )
dxDrawImage ( x-415+intervalWanted*5, 175, 26, 24, 'images/wanted_a.png', angle, 0, -120 ,tocolor(25,25,25,154) )
if wantedLvl < 1 then
local wanted1 = 1
else
dxDrawImage ( x-415, 175, 26, 24, 'images/wanted.png', angle, 0, -120 ,tocolor(255,237,0,255))
end
if wantedLvl < 2 then
local wanted2 = 2
else
dxDrawImage ( x-415+intervalWanted, 175, 26, 24, 'images/wanted.png', angle, 0, -120 ,tocolor(255,237,0,255))
end
if wantedLvl < 3 then
local wanted3 = 3
else
dxDrawImage ( x-415+intervalWanted*2, 175, 26, 24, 'images/wanted.png', angle, 0, -120 ,tocolor(255,237,0,255))
end
if wantedLvl < 4 then
local wanted4 = 4
else
dxDrawImage ( x-415+intervalWanted*3, 175, 26, 24, 'images/wanted.png', angle, 0, -120 ,tocolor(255,237,0,255))
end
if wantedLvl < 5 then
local wanted5 = 5
else
dxDrawImage ( x-415+intervalWanted*4, 175, 26, 24, 'images/wanted.png', angle, 0, -120 ,tocolor(255,237,0,255))
end
if wantedLvl < 6 then
local wanted6 = 6
else
dxDrawImage ( x-415+intervalWanted*5, 175, 26, 24, 'images/wanted.png', angle, 0, -120 ,tocolor(255,237,0,255))
end
end
function round(num)
if ( num >= 0 ) then return math.floor( num + .5 )
else return math.ceil( num - .5 ) end
end
function dxDrawCorner( x, y, r, color, corner, postGUI )
local corner = corner or 1
local start = corner % 2 == 0 and 0 or -r
local stop = corner % 2 == 0 and r or 0
local m = corner > 2 and -1 or 1
local h = ( corner == 1 or corner == 3 ) and -1 or 1
for yoff = start, stop do
local xoff = math.sqrt( r * r - yoff * yoff ) * m
dxDrawRectangle( x - xoff, y + yoff, xoff, h, color, postGUI )
end
end
function dxDrawRectangleCr( posX, posY, width, height, radius, color, postGUI )
local posX, posY, width, height = round( posX ), round( posY ), round( width ), round( height )
local radius = radius and math.min( radius, math.min( width, height ) / 2 ) or 12
dxDrawRectangle( posX, posY + radius, width, height - radius * 2, color, postGUI )
dxDrawRectangle( posX + radius, posY, width - 2 * radius, radius, color, postGUI )
dxDrawRectangle( posX + radius, posY + height - radius, width - 2 * radius, radius, color, postGUI )
dxDrawCorner( posX + radius, posY + radius, radius, color, 1, postGUI )
dxDrawCorner( posX + radius, posY + height - radius, radius, color, 2, postGUI )
dxDrawCorner( posX + width - radius, posY + radius, radius, color, 3, postGUI )
dxDrawCorner( posX + width - radius, posY + height - radius, radius, color, 4, postGUI )
end
---------------------------------------------------------------
---------------------------------------------------------------
addEvent('startEventom',true)
function startEventom()
addEventHandler("onClientPreRender", root, DxDrawHudConcept)
end
addEventHandler('startEventom',root,startEventom)
addEvent('stopEventom',true)
function stopEventom()
if isElement(pbRound) then
destroyElement ( pbRound )
end
removeEventHandler("onClientPreRender", root, DxDrawHudConcept)
end
addEventHandler('stopEventom',root,stopEventom)
---------------------------------------------------------------
---------------------------------------------------------------
addEventHandler("onClientResourceStart",getRootElement(), DxDrawHudConcept)
local root = getRootElement()
local player = getLocalPlayer()
local counter = 0
local starttick
local currenttick
addEventHandler("onClientPreRender",root,
function()
if not starttick then
starttick = getTickCount()
end
counter = counter + 1
currenttick = getTickCount()
if currenttick - starttick >= 1000 then
setElementData(player,"FPS",counter)
counter = 0
starttick = false
end
end
)
function fppss()
local FPS = getElementData(getLocalPlayer(),"FPS") or 0
dxDrawText(FPS-1,0,0,25,25,tocolor(0,0,0,200),1.05,"default","center","center",false,false,false,true)
dxDrawText(FPS-1,0,0,25,25,tocolor(255,255,255,150),1,"default","center","center",false,false,false,true)
end
isVisible = not isVisible
function fpss()
if isVisible then
addEventHandler("onClientPreRender", root, fppss)
else
removeEventHandler("onClientPreRender", root, fppss)
end
isVisible = not isVisible
end
addCommandHandler("showfps", fpss)
------------------------------------------------------------------
function toggleHud()
if isVisible then
addEventHandler("onClientPreRender", root, DxDrawHudConcept)
else
removeEventHandler("onClientPreRender", root, DxDrawHudConcept)
end
isVisible = not isVisible
end
addCommandHandler("showhud", toggleHud)
----Play render----
Progress()
startEventom()
-- ProgressBar()
-------------------
function fromcolor(int,useMath,relative)
local a,r,g,b
if useMath then
b = int[3]%256
g = int[2]%256
r = int[1]%256
a = int[4]%256
end
if relative then
a,r,g,b = a/255,r/255,g/255,b/255
end
return r,g,b,a
end