-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient.lua
144 lines (94 loc) · 5.21 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
framework = nil
Core = nil
ESX = nil
CreateThread(function()
if GetResourceState(Config.ESX) == 'starting' or GetResourceState(Config.ESX) == 'started' then
framework = "ESX"
ESX = exports["es_extended"]:getSharedObject()
end
if GetResourceState(Config.QBCore) == 'starting' or GetResourceState(Config.QBCore) == 'started' then
framework = "QB"
Core = exports["qb-core"]:GetCoreObject()
end
end)
CreateThread(function()
if framework == "QB" then
RegisterNetEvent('redux_repair:client:repair', function()
local plyPed = PlayerPedId()
local plyVeh = GetVehiclePedIsIn(plyPed, false)
local veh = GetVehiclePedIsIn(plyPed, false)
local health = GetVehicleBodyHealth(plyVeh)
if IsPedInAnyVehicle(plyPed, false) and health < 1000.0 and veh ~= 0 then
playSoundEffect("wrench", 0.5)
SetVehicleEngineOn(plyVeh, false, false, true)
if GetPedInVehicleSeat(GetVehiclePedIsIn(PlayerPedId()), -1) == PlayerPedId() then
Core.Functions.Progressbar("open_locker_drill", "Engine Repairing...", math.random(10000, 14000), false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
EngineRepair()
Core.Functions.Progressbar("open_locker_drill", "Body Repairing...", math.random(5000, 7000), false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
Wait(100)
BodyRepair()
end, function() -- Cancel
Notify("Canceled..", "error")
end)
end, function() -- Cancel
Notify("Canceled..", "error")
end, "fa-solid fa-wrench")
end
else
Wait(2000)
end
Wait(1)
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local plyPed = PlayerPedId()
local plyVeh = GetVehiclePedIsIn(plyPed, false)
local veh = GetVehiclePedIsIn(plyPed, false)
local health = GetVehicleBodyHealth(plyVeh)
local dist = #(GetEntityCoords(PlayerPedId()) - Config.Stations[1])
if dist < 20 and health < 1000.0 and veh ~= 0 then
Title(Config.Stations[1].x, Config.Stations[1].y, Config.Stations[1].z, "[E] FIX CAR")
DrawMarker(23, Config.Stations[1].x, Config.Stations[1].y, Config.Stations[1].z - 1.0, 0, 0, 0, 0, 0, 0, 1.001, 1.0001, 1.0001, 0, 230, 239, 230, 0, 0, 0, 0)
if IsControlJustReleased(0,38) then
TriggerEvent('redux_repair:client:repair')
end
end
local dist2 = #(GetEntityCoords(PlayerPedId()) - Config.Stations[2])
if dist2 < 20 and health < 1000.0 and veh ~= 0 then
Title(Config.Stations[2].x, Config.Stations[2].y, Config.Stations[2].z, "[E] FIX CAR")
DrawMarker(23, Config.Stations[2].x, Config.Stations[2].y, Config.Stations[2].z - 1.0, 0, 0, 0, 0, 0, 0, 1.001, 1.0001, 1.0001, 0, 230, 239, 230, 0, 0, 0, 0)
if IsControlJustReleased(0,38) then
TriggerEvent('redux_repair:client:repair')
end
end
local dist3 = #(GetEntityCoords(PlayerPedId()) - Config.Stations[3])
if dist3 < 20 and health < 1000.0 and veh ~= 0 then
Title(Config.Stations[3].x, Config.Stations[3].y, Config.Stations[3].z, "[E] FIX CAR")
DrawMarker(23, Config.Stations[3].x, Config.Stations[3].y, Config.Stations[3].z - 1.0, 0, 0, 0, 0, 0, 0, 1.001, 1.0001, 1.0001, 0, 230, 239, 230, 0, 0, 0, 0)
if IsControlJustReleased(0,38) then
TriggerEvent('redux_repair:client:repair')
end
end
local dist4 = #(GetEntityCoords(PlayerPedId()) - Config.Stations[4])
if dist4 < 20 and health < 1000.0 and veh ~= 0 then
Title(Config.Stations[4].x, Config.Stations[4].y, Config.Stations[4].z, "[E] FIX CAR")
DrawMarker(23, Config.Stations[4].x, Config.Stations[4].y, Config.Stations[4].z - 1.0, 0, 0, 0, 0, 0, 0, 1.001, 1.0001, 1.0001, 0, 230, 239, 230, 0, 0, 0, 0)
if IsControlJustReleased(0,38) then
TriggerEvent('redux_repair:client:repair')
end
end
end
end)
end
end)