-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
352 lines (287 loc) · 11 KB
/
Copy pathclient.lua
File metadata and controls
352 lines (287 loc) · 11 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
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
ESX = nil
disautostart = false
handbrake = false
sel = false
sel2 = false
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(10)
end
while ESX.GetPlayerData().job == nil do
Citizen.Wait(10)
end
if ESX.IsPlayerLoaded() then
ESX.PlayerData = ESX.GetPlayerData()
end
end)
-------- Script --------
function OpenMenu()
local vehmenu = RageUI.CreateMenu("Vehicle Menu", "Vehicle Menu", 0, 0, 'clk', 'interaction_bgd2', 0, 0, 0, 0) ---------
local actionssub = RageUI.CreateSubMenu(vehmenu, "Vehicle Menu", "Vehicle Menu", 0, 0, 'clk', 'interaction_bgd2', 0, 0, 0, 0)
local calculs = RageUI.CreateSubMenu(vehmenu, "Vehicle Menu", "Vehicle Menu", 0, 0, 'clk', 'interaction_bgd2', 0, 0, 0, 0)--------------
local vehinfos = RageUI.CreateSubMenu(vehmenu, "Vehicle Menu", "Vehicle Menu", 0, 0, 'clk', 'interaction_bgd2', 0, 0, 0, 0)--------------
RageUI.Visible(vehmenu, not RageUI.Visible(vehmenu))
while vehmenu do
Citizen.Wait(0)
RageUI.IsVisible(vehmenu, true, true, true, function()
RageUI.Separator("↓ ~o~Actions relatives au véhicule~s~ ↓")
RageUI.ButtonWithStyle("• Informations Véhicule ", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then end
end, vehinfos)
RageUI.ButtonWithStyle("• Actions Véhicule ", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then end
end, actionssub)
RageUI.ButtonWithStyle("• Données du véhicule ", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then end
end, calculs)
end, function()
end)
RageUI.IsVisible(actionssub, true, true, true, function()
Ped = GetPlayerPed(-1)
veh = GetVehiclePedIsUsing(Ped)
engineon = GetIsVehicleEngineRunning(veh)
doorstatus = GetVehicleDoorLockStatus(veh)
alarm = IsVehicleAlarmActivated(veh)
RageUI.Separator("↓ ~o~Effectuer une Action sur le Véhicule~s~ ↓")
RageUI.Checkbox("Éteindre le moteur",nil, moteur,{},function(Hovered,Active,Selected,Checked)
if Selected then
moteur = Checked
if Checked then
print(engineon)
SetVehicleEngineOn(veh, false, true, true)
else
print(engineon)
SetVehicleEngineOn(veh, true, true, true)
end
end
end)
--[[RageUI.ButtonWithStyle("• Allumer / Éteindre le moteur", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then
if engineon then
print(engineon)
SetVehicleEngineOn(veh, false, true, true)
else
print(engineon)
SetVehicleEngineOn(veh, true, true, true)
end
end
end)]]
RageUI.ButtonWithStyle("• Serrer / Déserrer le frein à main ", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then
if handbrake then
handbrake = false
Citizen.Wait(1000)
--FreezeEntityPosition(veh, false)
SetVehicleHandbrake(veh, false) --> To Test
RageUI.Popup({message = "Frein à main : ~g~Déserré"})
else
--FreezeEntityPosition(veh, true)
Citizen.Wait(1000)
handbrake = true
SetVehicleHandbrake(veh, true)
RageUI.Popup({message = "Frein à main : ~r~Serré"})
end
end
end)
RageUI.ButtonWithStyle("• Verrouiller / Déverrouiller les portes ", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then
if doorstatus == 1 then -- unlocked
SetVehicleDoorsLocked(veh, 2)
SetVehicleDoorsLocked(veh, 4)
RageUI.Popup({message = "Véhicule : ~r~Verouillé"})
PlayVehicleDoorCloseSound(veh, 0)
Citizen.Wait(100)
SetVehicleLights(veh, 2)
Citizen.Wait(200)
SetVehicleLights(veh, 1)
Citizen.Wait(200)
SetVehicleLights(veh, 2)
Citizen.Wait(200)
SetVehicleLights(veh, 1)
Citizen.Wait(200)
SetVehicleLights(veh, 2)
Citizen.Wait(200)
SetVehicleLights(veh, 0)
elseif doorstatus == 2 then --- locked
SetVehicleDoorsLocked(veh, 1)
RageUI.Popup({message = "Véhicule : ~g~Déverouillé"})
SetVehicleLights(veh, 2)
Citizen.Wait(100)
SetVehicleLights(veh, 1)
Citizen.Wait(100)
SetVehicleLights(veh, 2)
Citizen.Wait(100)
SetVehicleLights(veh, 0)
else
SetVehicleDoorsLocked(veh, 1)
RageUI.Popup({message = "Véhicule : ~g~Déverouillé"})
SetVehicleLights(veh, 2)
Citizen.Wait(100)
SetVehicleLights(veh, 1)
Citizen.Wait(100)
SetVehicleLights(veh, 2)
Citizen.Wait(100)
SetVehicleLights(veh, 0)
end
end
end)
RageUI.ButtonWithStyle("• Allumer les feux de détresse -- To Redo ", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then
if warnings then
SetVehicleIndicatorLights(veh, 1, false)
SetVehicleIndicatorLights(veh, 2, false)
SetVehicleIndicatorLights(veh, 3, false)
warnings = false
else
warnings = true
SetVehicleIndicatorLights(veh, 1, true)
SetVehicleIndicatorLights(veh, 2, true)
SetVehicleIndicatorLights(veh, 3, true)
end
end
end)
RageUI.ButtonWithStyle("• Allumer / Éteindre l'alarme --- To Do", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then
veh2 = GetVehiclePedIsIn(Ped, false)
StartVehicleAlarm(veh, true)
SetVehicleAlarmTimeLeft(veh, 10000)
SetVehicleAlarm(veh, true)
StartVehicleAlarm(veh2, true)
SetVehicleAlarmTimeLeft(veh2, 10000)
SetVehicleAlarm(veh2, true)
--[[if alarm then
print(alarm)
SetVehicleAlarm(veh, false)
alarm = false
else
SetVehicleAlarm(veh, true)
alarm = true
end ]]
end
end)
end, function()
end)
RageUI.IsVisible(calculs, true, true, true, function()
local Ped = GetPlayerPed(-1)
veh = GetVehiclePedIsUsing(Ped)
local turbop = GetVehicleTurboPressure(veh)
local turbop2 = math.floor(turbop * turbop + 0.5) / turbop
local temp = math.floor(GetVehicleEngineTemperature(veh))
if sel then
--RageUI.ButtonWithStyle(" ↓ ~o~Niveaux~s~ ↓ ", nil, {RightLabel = "→"}, true, function(Hovered, Active, Selected)
RageUI.ButtonWithStyle("~c~Niveaux~s~", nil, {RightLabel = "↓"}, true, function(Hovered, Active, Selected)
if Selected then
if sel then
sel = false
else
sel = true
end
end
end)
else
---RageUI.ButtonWithStyle(" - ~o~Niveaux~s~ - ", nil, {},true, function(Hovered, Active, Selected)
RageUI.ButtonWithStyle("~t~Niveaux~s~ ", nil, {RightLabel = "→"},true, function(Hovered, Active, Selected)
if Selected then
if sel then
sel = false
else
sel = true
end
end
end)
end
--[[RageUI.ButtonWithStyle(" ↓ ~o~Niveaux~s~ ↓ ", nil, {},true, function(Hovered, Active, Selected)
if Selected then
if sel then
sel = false
else
sel = true
end
end
end)]]
if sel then
RageUI.ButtonWithStyle("~b~• Niveau d'Usure Véhicule :~s~ " .. math.floor(GetVehicleBodyHealth(veh, 0)/10) .. "%", nil, {},true, function()
if Selected then end
end)
RageUI.ButtonWithStyle("~d~• Niveau d'Usure Moteur :~s~ " .. math.floor(GetVehicleEngineHealth(veh, 0)/10) .. "%", nil, {},true, function()
if Selected then end
end)
RageUI.ButtonWithStyle("~o~• Niveau d'Usure des Pneus :~s~ " .. math.floor(GetVehicleWheelHealth(veh, 0)/10) .. "%", nil, {},true, function()
if Selected then end
end)
RageUI.ButtonWithStyle("~o~• Niveau d'Essence :~s~ " .. GetVehicleFuelLevel(veh, 0) .. "%", nil, {},true, function()
if Selected then end
end)
RageUI.ButtonWithStyle("~o~• Niveau d'Huile :~s~ " .. GetVehicleOilLevel(veh, 0) .. "L", nil, {},true, function()
if Selected then end
end)
end
RageUI.Separator("↓ ~o~Performances~s~ ↓")
if temp < 80 then
RageUI.ButtonWithStyle("~o~ Température Moteur :~s~~g~ " .. temp .. "°", nil, {},true, function()
if Selected then end
end)
elseif temp < 95 then
RageUI.ButtonWithStyle("~o~ Température Moteur :~s~~o~ " .. temp .. "°", nil, {},true, function()
if Selected then end
end)
else
RageUI.ButtonWithStyle("~o~ Température Moteur :~s~~r~ " .. temp .. "°", nil, {},true, function()
if Selected then end
end)
end
if turbop > 0 then
RageUI.ButtonWithStyle("~o~Pression du Turbo :~s~ " .. turbop2 .. "Bar", nil, {},true, function()
if Selected then end
end)
end
RageUI.Separator("↓ ~o~Compression des suspensions~s~ ↓")
RageUI.ButtonWithStyle("~o~ Avant-Gauche :~s~ " .. (GetVehicleWheelSuspensionCompression(veh, 0))*100, nil, {},true, function()
if Selected then end
end)
RageUI.ButtonWithStyle("~o~ Avant-Droit :~s~ " .. (GetVehicleWheelSuspensionCompression(veh, 1))*100, nil, {},true, function()
if Selected then end
end)
RageUI.ButtonWithStyle("~o~ Arrière-Gauche :~s~ " ..(GetVehicleWheelSuspensionCompression(veh, 2))*100, nil, {},true, function()
if Selected then end
end)
RageUI.ButtonWithStyle("~o~ Arrière-Droit :~s~ " .. (GetVehicleWheelSuspensionCompression(veh, 3))*100, nil, {},true, function()
if Selected then end
end)
end, function()
end)
RageUI.IsVisible(vehinfos, true, true, true, function()
local Ped = GetPlayerPed(-1)
veh = GetVehiclePedIsUsing(Ped)
if GetDisplayNameFromVehicleModel(veh) == "CARNOTFOUND" then
RageUI.Separator("~o~Modèle du Véhicule : Inconnu~s~ " )
else
RageUI.Separator("~o~Modèle du Véhicule :~s~ " .. GetDisplayNameFromVehicleModel(veh))
end
RageUI.Separator("↓ ~o~Informations Constructeur~s~ ↓")
RageUI.Separator("~o~Couleur :~s~ " .. GetVehicleColor(veh))
RageUI.Separator("~o~Immatriculation :~s~ " .. GetVehicleNumberPlateText(veh))
RageUI.Separator("~o~Vitesse maximale d'origine :~s~ " .. (GetVehicleEstimatedMaxSpeed(veh)*3.6) .. " km/h")
RageUI.Separator("~o~Nombre de sièges :~s~ " .. GetVehicleModelNumberOfSeats(veh) .. " sièges")
RageUI.Separator("~o~Nombre de vitesses :~s~ " .. GetVehicleHighGear(veh))
RageUI.Separator("~o~Niveau de teinte des vitres :~s~ " .. (GetVehicleWindowTint(veh)*100) .. "%")
end, function()
end)
if not RageUI.Visible(vehmenu) and not RageUI.Visible(calculs) and not RageUI.Visible(actionssub) and not RageUI.Visible(vehinfos) then
vehmenu = RMenu:DeleteType("vehmenu", true)
end
end
end
RegisterCommand('veh', function(source)
--[[ESX.TriggerServerCallback('KorioZ-GangsBuilder:Admin_getUsergroup', function(plyGroup)
if plyGroup ~= nil and (plyGroup == 'admin' or plyGroup == 'superadmin' or plyGroup == 'owner' or plyGroup == '_dev') then
TriggerEvent('gb:OpenMenu', source)
else
ESX.ShowNotification('Vous devez être ~r~Admin ~w~pour ouvrir le ~g~GangsBuilder.')
end
end)]]
OpenMenu()
end, false)
-------------------------------------------------------------------------------------------------------------------------
--TriggerServerEvent('clk_safezone:addzone', ZoneData)