-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
327 lines (306 loc) · 10.1 KB
/
client.lua
File metadata and controls
327 lines (306 loc) · 10.1 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
ESX = exports["es_extended"]:getSharedObject()
local carspawned = false
local guidstarted = false
Citizen.CreateThread(function()
local waitTime = 1000
while true do
waitTime = 1000
local playerPed = GetEntityCoords(GetPlayerPed(-1))
local coordsb = Config.bliploc
if GetDistanceBetweenCoords(playerPed, coordsb.x, coordsb.y, coordsb.z, true) < 2 then
waitTime = 0
ESX.Game.Utils.DrawText3D(vector3(coordsb.x, coordsb.y, coordsb.z), "Press E", 1.0, 4)
if IsControlJustPressed(0, 38) then
local name = Config.server
local alert = lib.alertDialog({
header = name,
content = Config.ConfirmationLabel,
centered = true,
cancel = true
})
if alert == 'confirm' then
TriggerServerEvent('oprx_guide:claimCar')
end
end
end
Citizen.Wait(waitTime)
end
end)
RegisterNetEvent('oprx_guide:startguide')
AddEventHandler('oprx_guide:startguide', function(src)
-- CreateVehicle(car, coords.x, coords.y, coords.z, true, true)
if not IsPositionOccupied(Config.spawnVehiclecoords.x, Config.spawnVehiclecoords.y, Config.spawnVehiclecoords.z, 1.5, false, true, false, false, false, 0, false) then
showguide()
ESX.ShowNotification(Config.SkipGuideMessage)
blipshow = true
drawmarker()
else
TriggerEvent('esx:showNotification', string.format("Spawn point blocked"))
end
end)
function drawmarker()
local first = true
local second = false
local third = false
local fourth = false
local fifth = false
local final = false
while blipshow do
Wait(0)
if first and guidstarted then
local coord = Config.locations.a
DrawMarker(2, coord.x, coord.y, coord.z + 2, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 2.0, 2.0, 2.0, 255, 255, 255, 50, true, true, 2, false, nil, nil, false)
local playerPed = GetEntityCoords(GetPlayerPed(-1))
if GetDistanceBetweenCoords(playerPed, coord.x, coord.y, coord.z, true) < Config.radius then
TriggerEvent('oprx_guide:showtext', '3')
TriggerEvent('oprx_guide:setwaypoint', Config.locations.b)
Wait(5000)
first = false
second = true
SendNUIMessage({
action = "hideMessage"
})
end
elseif second then
local coord = Config.locations.b
DrawMarker(2, coord.x, coord.y, coord.z + 2, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 2.0, 2.0, 2.0, 255, 255, 255, 50, true, true, 2, false, nil, nil, false)
local playerPed = GetEntityCoords(GetPlayerPed(-1))
if GetDistanceBetweenCoords(playerPed, coord.x, coord.y, coord.z, true) < Config.radius then
TriggerEvent('oprx_guide:showtext', '4')
TriggerEvent('oprx_guide:setwaypoint', Config.locations.c)
Wait(5000)
second = false
third = true
SendNUIMessage({
action = "hideMessage"
})
end
elseif third then
local coord = Config.locations.c
DrawMarker(2, coord.x, coord.y, coord.z + 2, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 2.0, 2.0, 2.0, 255, 255, 255, 50, true, true, 2, false, nil, nil, false)
local playerPed = GetEntityCoords(GetPlayerPed(-1))
if GetDistanceBetweenCoords(playerPed, coord.x, coord.y, coord.z, true) < Config.radius then
TriggerEvent('oprx_guide:showtext', '5')
TriggerEvent('oprx_guide:setwaypoint', Config.locations.d)
Wait(5000)
third = false
fourth = true
SendNUIMessage({
action = "hideMessage"
})
end
elseif fourth then
local coord = Config.locations.d
DrawMarker(2, coord.x, coord.y, coord.z + 2, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 2.0, 2.0, 2.0, 255, 255, 255, 50, true, true, 2, false, nil, nil, false)
local playerPed = GetEntityCoords(GetPlayerPed(-1))
if GetDistanceBetweenCoords(playerPed, coord.x, coord.y, coord.z, true) < Config.radius then
TriggerEvent('oprx_guide:showtext', '6')
TriggerEvent('oprx_guide:setwaypoint', Config.locations.e)
Wait(5000)
fourth = false
fifth = true
SendNUIMessage({
action = "hideMessage"
})
end
elseif fifth then
local coord = Config.locations.e
DrawMarker(2, coord.x, coord.y, coord.z + 2, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 2.0, 2.0, 2.0, 0, 255, 94, 50, true, true, 2, false, nil, nil, false)
local playerPed = GetEntityCoords(GetPlayerPed(-1))
if GetDistanceBetweenCoords(playerPed, coord.x, coord.y, coord.z, true) < Config.radius then
TriggerEvent('oprx_guide:showtext', '7')
--TriggerEvent('oprx_guide:setwaypoint', coord)
Wait(5000)
fifth = false
final = true
SendNUIMessage({
action = "hideMessage"
})
end
elseif final and not fifth then
finalmessage()
blipshow = false
end
end
end
-- RegisterNetEvent('oprx_guide:begin')
-- AddEventHandler('oprx_guide:begin', function(guideno)
-- local guidelevel = guideno
-- if guidelevel == 1 then
-- TriggerEvent('oprx_guide:showtext', '3')
-- TriggerEvent('oprx_guide:setwaypoint', Config.locations.b)
-- Wait(5000)
-- first = false
-- second = true
-- SendNUIMessage({
-- action = "hideMessage"
-- })
-- elseif guidelevel == 2 then
-- TriggerEvent('oprx_guide:showtext', '4')
-- TriggerEvent('oprx_guide:setwaypoint', Config.locations.c)
-- Wait(5000)
-- second = false
-- third = true
-- SendNUIMessage({
-- action = "hideMessage"
-- })
-- elseif guidelevel == 3 then
-- TriggerEvent('oprx_guide:showtext', '5')
-- TriggerEvent('oprx_guide:setwaypoint', Config.locations.d)
-- Wait(5000)
-- third = false
-- fourth = true
-- SendNUIMessage({
-- action = "hideMessage"
-- })
-- elseif guidelevel == 4 then
-- TriggerEvent('oprx_guide:showtext', '6')
-- TriggerEvent('oprx_guide:setwaypoint', Config.locations.e)
-- Wait(5000)
-- fourth = false
-- fifth = true
-- SendNUIMessage({
-- action = "hideMessage"
-- })
-- elseif guidelevel == 5 then
-- TriggerEvent('oprx_guide:showtext', '7')
-- --TriggerEvent('oprx_guide:setwaypoint', coord)
-- Wait(5000)
-- fifth = false
-- final = true
-- SendNUIMessage({
-- action = "hideMessage"
-- })
-- elseif guidelevel == 6 then
-- finalmessage()
-- blipshow = false
-- end
-- end)
-- RegisterCommand('finalw', function()
-- SendNUIMessage({
-- action = "finalMessage"
-- })
-- end)
RegisterCommand('skipguide', function()
SendNUIMessage({
action = "hideMessage"
})
blipshow = false
finalmessage()
end)
AddEventHandler('oprx_guide:setwaypoint', function(position)
local coordsw = position
SetNewWaypoint(coordsw.x, coordsw.y)
Wait(4000)
ESX.ShowNotification('New waypoint marked')
end)
function showguide()
SendNUIMessage({
action = "showMessage"
})
Wait(1000)
TriggerEvent('oprx_guide:showtext', '1')
Wait(4000)
TriggerEvent('oprx_guide:showtext', '2')
Wait(4000)
TriggerEvent('oprx_guide:setwaypoint', Config.locations.a)
SendNUIMessage({
action = "hideMessage"
})
end
function finalmessage()
SendNUIMessage({
action = "finalMessage"
})
Wait(2000)
PlaySoundFrontend(-1, "FLIGHT_SCHOOL_LESSON_PASSED", "HUD_AWARDS", 1)
Wait(3000)
SendNUIMessage({
action = "stopfinalmessage"
})
end
-- RegisterCommand('tests', function()
-- SendNUIMessage({
-- action = "showMessage"
-- })
-- end)
AddEventHandler('oprx_guide:showtext', function(number)
SendNUIMessage({
action = "showMessage"
})
local steps = number
if steps == '1' then
PlaySoundFrontend(-1, "CHECKPOINT_PERFECT", "HUD_MINI_GAME_SOUNDSET", 1)
SendNUIMessage({
hello = Config.text.a,
action = "textsend"
})
elseif steps == '2' then
PlaySoundFrontend(-1, "CHECKPOINT_PERFECT", "HUD_MINI_GAME_SOUNDSET", 1)
SendNUIMessage({
hello = Config.text.b,
action = "textsend"
})
Wait(4000)
guidstarted = true
elseif steps == '3' then
PlaySoundFrontend(-1, "CHECKPOINT_AHEAD", "HUD_MINI_GAME_SOUNDSET", 1)
SendNUIMessage({
hello = Config.text.c,
action = "textsend"
})
elseif steps == '4' then
PlaySoundFrontend(-1, "CHECKPOINT_AHEAD", "HUD_MINI_GAME_SOUNDSET", 1)
SendNUIMessage({
hello = Config.text.d,
action = "textsend"
})
elseif steps == '5' then
PlaySoundFrontend(-1, "CHECKPOINT_AHEAD", "HUD_MINI_GAME_SOUNDSET", 1)
SendNUIMessage({
hello = Config.text.e,
action = "textsend"
})
elseif steps == '6' then
PlaySoundFrontend(-1, "CHECKPOINT_AHEAD", "HUD_MINI_GAME_SOUNDSET", 1)
SendNUIMessage({
hello = Config.text.f,
action = "textsend"
})
elseif steps == '7' then
PlaySoundFrontend(-1, "CHECKPOINT_PERFECT", "HUD_MINI_GAME_SOUNDSET", 1)
SendNUIMessage({
hello = Config.text.g,
action = "textsend"
})
end
end)
RegisterCommand('black', function()
SendNUIMessage({
action = "hideMessage"
})
end)
RegisterNetEvent('oprx_guide:spawncar')
AddEventHandler('oprx_guide:spawncar', function(playerID, model)
local coords = Config.spawnVehiclecoords
local playerPed = GetPlayerPed(-1)
local xplayer = PlayerPedId()
local carExist = false
ESX.Game.SpawnVehicle(model, vector3(coords.x, coords.y, coords.z), coords.h, function(vehicle) --get vehicle info
if DoesEntityExist(vehicle) then
carExist = true
SetPedIntoVehicle(xplayer, vehicle, -1)
--TriggerEvent('esx:showNotification', "Please wait your number plate is generating"
if Config.GeneratePlateExport then
Wait(3000)
local newPlate = Config.GeneratePlateExport -- Config.GeneratePlateExport
SetVehicleNumberPlateText(vehicle, newPlate)
end
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
if Config.SavetoDB then
TriggerServerEvent('oprx_guide:setVehicle', vehicleProps)
end
Notify(Config.ReciveMessage)
end
end)
end)