-
Notifications
You must be signed in to change notification settings - Fork 0
/
forklift_c.lua
532 lines (496 loc) · 23.4 KB
/
forklift_c.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
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
--------------------------------------------------------
local Keys = {
["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
}
function DrawText3D(x, y, z, text)
local onScreen,_x,_y=World3dToScreen2d(x, y, z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
SetTextScale(0.37, 0.37)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
local factor = (string.len(text)) / 370
DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 33, 33, 33, 133)
end
local Anulowano = false
local ZrespTuPojazd = {x = 221.45880126953, y = -2967.1662597656, z = 5.8969}
local rampaCoord = {x = 138.2465057373, y = -3089.1518554688, z = 5.89631}
local wezCar = {x = 145.67060852051, y = -3108.6743164063, z = 5.896}
local zlecenieDist = {x = 152.32009887695, y = -3101.5874023438, z = 5.8963}
local zrespione = false
local silnikOn = false
local rodzajPojazdu = nil
local naklejkaAuto = 0
local kartonKoord1 = {x = 161.97207641602, y = -3142.4104003906, z = 5.959}
local kartonKoord2 = {x = 161.18479919434, y = -3041.7497558594, z = 5.974014}
local kartonKoord3 = {x = 166.7626953125, y = -3258.3393554688, z = 5.86072}
local kartonKoord4 = {x = 116.09323120117, y = -3164.1032714844, z = 6.0136}
local kartonKoord5 = {x = 117.36480712891, y = -2989.3310546875, z = 6.020}
local czasikDostaw = 0
local dostawaTimer = false
local PrzejetyHangar = 0
local premia1 = 50
local premia2 = 35
local premia3 = 25
-----------------------garaz2
local ZrespTuPojazd2 = {x = 275.67260742188, y = -3166.150390625, z = 5.7902}
local rampaCoord2 = {x = 158.15670776367, y = -3196.2829589844, z = 6.021}
local wezCar2 = {x = 146.82814025879, y = -3210.5979003906, z = 5.8575}
local zlecenieDist2 = {x = 152.90745544434, y = -3211.7609863281, z = 5.901}
local pilot
function ZrespPaczuszke(a)
czasikDostaw=0
dostawaTimer=true
if a=='deski'then
paczuszka=CreateObject(GetHashKey('prop_boxpile_06a'),kartonKoord1.x,kartonKoord1.y,kartonKoord1.z-0.95,true,true,true)
SetEntityAsMissionEntity(paczuszka)
SetEntityDynamic(paczuszka,true)
FreezeEntityPosition(paczuszka,false)
SetNewWaypoint(kartonKoord1.x,kartonKoord1.y)
elseif a=='lody'then
paczuszka=CreateObject(GetHashKey('prop_boxpile_02b'),kartonKoord2.x,kartonKoord2.y,kartonKoord2.z-0.95,true,true,true)
SetEntityAsMissionEntity(paczuszka)
SetEntityDynamic(paczuszka,true)
FreezeEntityPosition(paczuszka,false)
SetNewWaypoint(kartonKoord2.x,kartonKoord2.y)
elseif a=='leki'then
paczuszka=CreateObject(GetHashKey('prop_boxpile_06a'),kartonKoord3.x,kartonKoord3.y,kartonKoord3.z-0.95,true,true,true)
SetEntityAsMissionEntity(paczuszka)
SetEntityDynamic(paczuszka,true)
FreezeEntityPosition(paczuszka,false)
SetNewWaypoint(kartonKoord3.x,kartonKoord3.y)
elseif a=='napoje'then
paczuszka=CreateObject(GetHashKey('prop_boxpile_09a'),kartonKoord4.x,kartonKoord4.y,kartonKoord4.z-0.95,true,true,true)
SetEntityAsMissionEntity(paczuszka)
SetEntityDynamic(paczuszka,true)
FreezeEntityPosition(paczuszka,false)
SetNewWaypoint(kartonKoord4.x,kartonKoord4.y)
elseif a=='kawa'then
paczuszka=CreateObject(GetHashKey('prop_boxpile_06a'),kartonKoord5.x,kartonKoord5.y,kartonKoord5.z-0.95,true,true,true)
SetEntityAsMissionEntity(paczuszka)
SetEntityDynamic(paczuszka,true)
FreezeEntityPosition(paczuszka,false)
SetNewWaypoint(kartonKoord5.x,kartonKoord5.y)
end
end
RegisterNetEvent('tostdostawa:rampanpcdawaj')
AddEventHandler('tostdostawa:rampanpcdawaj',function(a)
Anulowano=false
if a=='1'then
if zrespione==true then
TriggerEvent(Notify,'Complete the previous order!')
return
end
local b=math.random(1,5)
if b==1 then
naklejkaAuto=3
TriggerEvent(Notify,'The driver awaits loading the boards.')
ZrespPaczuszke('deski')
elseif b==2 then
naklejkaAuto=4
TriggerEvent(Notify,'The driver is waiting for the fish to be loaded.')
ZrespPaczuszke('lody')
elseif b==3 then
naklejkaAuto=6
TriggerEvent(Notify,'The driver is waiting for the medicine to be loaded.')
ZrespPaczuszke('leki')
elseif b==4 then
naklejkaAuto=2
TriggerEvent(Notify,'The driver awaits loading Logger Light drinks.')
ZrespPaczuszke('napoje')
elseif b==5 then
naklejkaAuto=1
TriggerEvent(Notify,'The driver awaits loading the coffee.')
ZrespPaczuszke('kawa')
end
RequestModel(GetHashKey('benson'))
while not HasModelLoaded(GetHashKey('benson'))do
Citizen.Wait(0)end
ClearAreaOfVehicles(ZrespTuPojazd.x,ZrespTuPojazd.y,ZrespTuPojazd.z,15.0,false,false,false,false,false)
transport=CreateVehicle(GetHashKey('benson'),ZrespTuPojazd.x,ZrespTuPojazd.y,ZrespTuPojazd.z,-2.436,996.786,25.1887,true,true)
SetEntityAsMissionEntity(transport)
SetEntityHeading(transport,52.00)
SetVehicleDoorsLocked(transport,2)
SetVehicleDoorsLockedForAllPlayers(transport,true)
SetVehicleExtra(transport,1,true)
SetVehicleExtra(transport,2,true)
SetVehicleExtra(transport,3,true)
SetVehicleExtra(transport,4,true)
SetVehicleExtra(transport,5,true)
SetVehicleExtra(transport,6,true)
SetVehicleExtra(transport,7,true)
SetVehicleExtra(transport,naklejkaAuto,false)
RequestModel("s_m_m_security_01")
while not HasModelLoaded("s_m_m_security_01")do
Wait(10)end
pilot=CreatePedInsideVehicle(transport,1,"s_m_m_security_01",-1,true,true)
SetBlockingOfNonTemporaryEvents(pilot,true)
SetEntityInvincible(pilot,true)
TaskVehiclePark(pilot,transport,rampaCoord.x,rampaCoord.y,rampaCoord.z,266.0,1,1.0,false)
SetDriveTaskDrivingStyle(pilot,263100)
SetPedKeepTask(pilot,true)
TriggerEvent(Notify,'The driver is on his way.')
zrespione=true
silnikOn=true
Citizen.Wait(900)
while silnikOn do
Citizen.Wait(1000)
local c=GetIsVehicleEngineRunning(transport)
if c==1 then
Citizen.Wait(200)
else
silnikOn=false
end
end
TriggerEvent(Notify,'The driver stopped and opened the trunk')
SetVehicleDoorOpen(transport,5,false,false)
backOpened=true
local d,e,f=table.unpack(GetOffsetFromEntityInWorldCoords(transport,0.0,-6.0,-1.0))
while backOpened do
Citizen.Wait(2)
DrawMarker(1,d,e,f,0,0,0,0,0,0,1.7,1.7,1.7,135,31,35,150,1,0,0,0)
local g=GetEntityCoords(paczuszka)
local h=Vdist(d,e,f,g.x,g.y,g.z)
if h<=2.0 then
SetVehicleDoorShut(transport,5,false)
DeleteEntity(paczuszka)backOpened=false
end
end
if Anulowano==true then
return
end
TriggerEvent(Notify,'Package loaded, driver wraps up.')
TriggerEvent(Notify,'You have loaded the package in '..czasikDostaw..' seconds.')
if czasikDostaw<41 then
TriggerEvent(Notify,'Bonus '..premia1 ..'$ for fast delivery')
TriggerServerEvent("tostdostawa:wykonanieMisji",premia1)
Citizen.Wait(200)
elseif czasikDostaw>=41 and czasikDostaw<=55 then
TriggerEvent(Notify,'Bonus '..premia2 ..'$ for fast delivery')
TriggerServerEvent("tostdostawa:wykonanieMisji",premia2)
Citizen.Wait(200)
elseif czasikDostaw>=56 and czasikDostaw<=65 then
TriggerEvent(Notify,'Bonus '..premia3 ..'$ for fast delivery')
TriggerServerEvent("tostdostawa:wykonanieMisji",premia3)
Citizen.Wait(200)
elseif czasikDostaw>65 then
TriggerEvent(Notify,'No bonus for quick delivery')
end
czasikDostaw=0
dostawaTimer=false
TriggerServerEvent("tostdostawa:wykonanieMisji",'nie')
TaskVehicleDriveWander(pilot,transport,50.0,263100)
Citizen.Wait(15000)
DeleteEntity(transport)
DeleteEntity(pilot)zrespione=0
TriggerEvent(Notify,'You can accept the next order')
elseif a=='2'then
if zrespione==true then
TriggerEvent(Notify,'Complete the previous order!')
return
end
local b=math.random(1,5)
if b==1 then
naklejkaAuto=3
TriggerEvent(Notify,'The driver awaits loading the boards.')
ZrespPaczuszke('deski')
elseif b==2 then
naklejkaAuto=4
TriggerEvent(Notify,'The driver is waiting for the fish to be loaded.')
ZrespPaczuszke('lody')
elseif b==3 then
naklejkaAuto=6
TriggerEvent(Notify,'The driver is awaiting loading of medications.')
ZrespPaczuszke('leki')
elseif b==4 then
naklejkaAuto=2
TriggerEvent(Notify,'The driver awaits loading Logger Light drinks.')
ZrespPaczuszke('napoje')
elseif b==5 then
naklejkaAuto=1
TriggerEvent(Notify,'The driver awaits loading the coffee.')
ZrespPaczuszke('kawa')
end
RequestModel(GetHashKey('benson'))
while not HasModelLoaded(GetHashKey('benson'))do
Citizen.Wait(0)
end
ClearAreaOfVehicles(ZrespTuPojazd.x,ZrespTuPojazd.y,ZrespTuPojazd.z,15.0,false,false,false,false,false)
transport=CreateVehicle(GetHashKey('benson'),ZrespTuPojazd2.x,ZrespTuPojazd2.y,ZrespTuPojazd2.z,-2.436,996.786,25.1887,true,true)
SetEntityAsMissionEntity(transport)
SetEntityHeading(transport,52.00)
SetVehicleDoorsLocked(transport,2)
SetVehicleDoorsLockedForAllPlayers(transport,true)
SetVehicleExtra(transport,1,true)
SetVehicleExtra(transport,2,true)
SetVehicleExtra(transport,3,true)
SetVehicleExtra(transport,4,true)
SetVehicleExtra(transport,5,true)
SetVehicleExtra(transport,6,true)
SetVehicleExtra(transport,7,true)
SetVehicleExtra(transport,naklejkaAuto,false)
RequestModel("s_m_m_security_01")
while not HasModelLoaded("s_m_m_security_01")do
Wait(10)
end
pilot=CreatePedInsideVehicle(transport,1,"s_m_m_security_01",-1,true,true)
SetBlockingOfNonTemporaryEvents(pilot,true)
SetEntityInvincible(pilot,true)
TaskVehiclePark(pilot,transport,rampaCoord2.x,rampaCoord2.y,rampaCoord2.z,266.0,1,1.0,false)
SetDriveTaskDrivingStyle(pilot,263100)
SetPedKeepTask(pilot,true)
TriggerEvent(Notify,'The driver is on his way.')
zrespione=true
silnikOn=true
Citizen.Wait(900)
while silnikOn do
Citizen.Wait(1000)
local c=GetIsVehicleEngineRunning(transport)
if c==1 then
Citizen.Wait(200)
else
silnikOn=false
end
end
TriggerEvent(Notify,'The driver stopped and opened the trunk')
SetVehicleDoorOpen(transport,5,false,false)
backOpened=true
local d,e,f=table.unpack(GetOffsetFromEntityInWorldCoords(transport,0.0,-6.0,-1.0))
while backOpened do
Citizen.Wait(2)
DrawMarker(1,d,e,f,0,0,0,0,0,0,1.7,1.7,1.7,135,31,35,150,1,0,0,0)
local g=GetEntityCoords(paczuszka)
local h=Vdist(d,e,f,g.x,g.y,g.z)
if h<=2.0 then
SetVehicleDoorShut(transport,5,false)
DeleteEntity(paczuszka)backOpened=false
end
end
if Anulowano==true then
return
end
TriggerEvent(Notify,'Package loaded, driver wraps up.')
TriggerEvent(Notify,'You have loaded the package in '..czasikDostaw..' seconds.')
if czasikDostaw<61 then
TriggerEvent(Notify,'Bonus '..premia1 ..'$ for fast delivery')
TriggerServerEvent("tostdostawa:wykonanieMisji",premia1)
Citizen.Wait(200)
elseif czasikDostaw>=61 and czasikDostaw<=75 then
TriggerEvent(Notify,'Bonus '..premia2 ..'$ for fast delivery')
TriggerServerEvent("tostdostawa:wykonanieMisji",premia2)
Citizen.Wait(200)
elseif
czasikDostaw>=76 and czasikDostaw<=85 then
TriggerEvent(Notify,'Bonus '..premia3 ..'$ for fast delivery')
TriggerServerEvent("tostdostawa:wykonanieMisji",premia3)
Citizen.Wait(200)
elseif
czasikDostaw>85
then
TriggerEvent(Notify,'No bonus for quick delivery')
end
czasikDostaw=0
dostawaTimer=false
TriggerServerEvent("tostdostawa:wykonanieMisji",'nie')
TaskVehicleDriveWander(pilot,transport,50.0,263100)
Citizen.Wait(15000)
DeleteEntity(transport)
DeleteEntity(pilot)zrespione=0
TriggerEvent(Notify,'You can accept the next order')
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
if dostawaTimer == true then
czasikDostaw = czasikDostaw +1
if czasikDostaw > 140 then
Anulowano = true
zrespione = 0
czasikDostaw = 0
dostawaTimer = false
backOpened = false
silnikOn = false
DeleteEntity(transport)
DeleteEntity(pilot)
DeleteEntity(paczuszka)
TriggerEvent(Notify,'The order was canceled because you took too long loading')
end
else
Citizen.Wait(2000)
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(4)
if DoesEntityExist(paczuszka) then
local paczkCoord = GetEntityCoords(paczuszka)
DrawMarker(0, paczkCoord.x, paczkCoord.y, paczkCoord.z+2.1, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 135, 31, 35, 150, 1, 0, 0, 0)
else
Citizen.Wait(2500)
end
end
end)
RegisterNetEvent('tostdostawa:maszHangar')
AddEventHandler('tostdostawa:maszHangar', function()
PrzejetyHangar = 1
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(3)
local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
local distCar = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, wezCar.x, wezCar.y, wezCar.z)
local zlecDist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, zlecenieDist.x, zlecenieDist.y, zlecenieDist.z)
if distCar <= 25.0 or zlecDist <= 25.0 then
DrawMarker(27, wezCar.x, wezCar.y, wezCar.z-0.90, 0, 0, 0, 0, 0, 0, 1.301, 1.3001, 1.3001, 255, 255, 255, 200, 0, 0, 0, 0)
DrawMarker(27, zlecenieDist.x, zlecenieDist.y, zlecenieDist.z-0.90, 0, 0, 0, 0, 0, 0, 1.301, 1.3001, 1.3001, 255, 255, 255, 200, 0, 0, 0, 0)
else
Citizen.Wait(1500)
end
if distCar <= 1.0 then
DrawText3D(wezCar.x, wezCar.y, wezCar.z, "[E] To take a forklift")
if IsControlJustPressed(0, Keys['E']) then
PozyczPojazd('1')
end
end
if zlecDist <= 1.0 then
DrawText3D(zlecenieDist.x, zlecenieDist.y, zlecenieDist.z, "[E] Take order")
DrawText3D(zlecenieDist.x, zlecenieDist.y, zlecenieDist.z-0.13, "[G] Take over the hangar")
if IsControlJustPressed(0, Keys['E']) then
if PrzejetyHangar == 1 then
TriggerEvent('tostdostawa:rampanpcdawaj','1')
TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_CLIPBOARD", 0, false)
Citizen.Wait(2000)
ClearPedTasks(GetPlayerPed(-1))
TriggerEvent(Notify,'The package to be delivered is marked on the GPS, use a forklift.')
else
TriggerEvent(Notify,'You must take over the hangar')
end
elseif IsControlJustPressed(0, Keys['G']) then
if PrzejetyHangar == 1 then
TriggerEvent(Notify,'You already have a hangar')
else
TriggerServerEvent("tostdostawa:przejmijHangar", '1')
Citizen.Wait(500)
end
end
end
end
end)
----garaz 2
Citizen.CreateThread(function()
while true do
Citizen.Wait(3)
local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
local distCar2 = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, wezCar2.x, wezCar2.y, wezCar2.z)
local zlecDist2 = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, zlecenieDist2.x, zlecenieDist2.y, zlecenieDist2.z)
if distCar2 <= 25.0 or zlecDist2 <= 25.0 then
DrawMarker(27, wezCar2.x, wezCar2.y, wezCar2.z-0.90, 0, 0, 0, 0, 0, 0, 1.301, 1.3001, 1.3001, 255, 255, 255, 200, 0, 0, 0, 0)
DrawMarker(27, zlecenieDist2.x, zlecenieDist2.y, zlecenieDist2.z-0.90, 0, 0, 0, 0, 0, 0, 1.301, 1.3001, 1.3001, 255, 255, 255, 200, 0, 0, 0, 0)
else
Citizen.Wait(1500)
end
if distCar2 <= 1.0 then
DrawText3D(wezCar2.x, wezCar2.y, wezCar2.z, "[E] To take a forklift")
if IsControlJustPressed(0, Keys['E']) then
PozyczPojazd('2')
end
end
if zlecDist2 <= 1.0 then
DrawText3D(zlecenieDist2.x, zlecenieDist2.y, zlecenieDist2.z, "[E] Take order")
DrawText3D(zlecenieDist2.x, zlecenieDist2.y, zlecenieDist2.z-0.13, "[G] Take over the hangar")
if IsControlJustPressed(0, Keys['E']) then
if PrzejetyHangar == 1 then
TriggerEvent('tostdostawa:rampanpcdawaj','2')
TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_CLIPBOARD", 0, false)
Citizen.Wait(2000)
ClearPedTasks(GetPlayerPed(-1))
TriggerEvent(Notify,'The package to be delivered is marked on the GPS, use a forklift.')
else
TriggerEvent(Notify,'You must take over the hangar')
end
elseif IsControlJustPressed(0, Keys['G']) then
if PrzejetyHangar == 1 then
TriggerEvent(Notify,'You already have a hangar')
else
TriggerServerEvent("tostdostawa:przejmijHangar", '2')
Citizen.Wait(500)
end
end
end
end
end)
local PojazdWyjety = 0
local wozek
function PozyczPojazd(a)
if a=='1'then
if PojazdWyjety==0 then
RequestModel(GetHashKey('forklift'))
while not HasModelLoaded(GetHashKey('forklift'))do
Citizen.Wait(0)
end
ClearAreaOfVehicles(wezCar.x,wezCar.y,wezCar.z,15.0,false,false,false,false,false)
wozek=CreateVehicle(GetHashKey('forklift'),wezCar.x,wezCar.y,wezCar.z,-2.436,996.786,25.1887,true,true)
SetEntityHeading(wozek,52.00)
TaskWarpPedIntoVehicle(GetPlayerPed(-1),wozek,-1)
SetVehicleColours(wozek,111,111)PojazdWyjety=1
TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(wozek))
else
PojazdWyjety=0
DeleteEntity(wozek)TriggerEvent(Notify,'Your previous vehicle has been deleted, you can retreive a new one')
end
elseif a=='2'then
if PojazdWyjety==0 then
RequestModel(GetHashKey('forklift'))
while not HasModelLoaded(GetHashKey('forklift'))do
Citizen.Wait(0)end
ClearAreaOfVehicles(wezCar2.x,wezCar2.y,wezCar2.z,15.0,false,false,false,false,false)
wozek=CreateVehicle(GetHashKey('forklift'),wezCar2.x,wezCar2.y,wezCar2.z,-2.436,996.786,25.1887,true,true)
SetEntityHeading(wozek,52.00)
TaskWarpPedIntoVehicle(GetPlayerPed(-1),wozek,-1)
SetVehicleColours(wozek,111,111)PojazdWyjety=1
TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(wozek))
else
PojazdWyjety=0
DeleteEntity(wozek)TriggerEvent(Notify,'Your previous vehicle has been deleted, you can retreive a new one')
end
end
end
----
Citizen.CreateThread(function()
while true do
Citizen.Wait(1500)
local a=GetEntityCoords(GetPlayerPed(-1),false)
local b=Vdist(a.x,a.y,a.z,zlecenieDist2.x,zlecenieDist2.y,zlecenieDist2.z)
local c=Vdist(a.x,a.y,a.z,zlecenieDist.x,zlecenieDist.y,zlecenieDist.z)
if PrzejetyHangar==1 then
if b>205.0 then
TriggerEvent(Notify,'Too far away from the warehouse because you lost the owner.')
TriggerServerEvent("tostdostawa:OdszedlDalekoo")
Citizen.Wait(1500)
else
Citizen.Wait(3500)
end
if c>205.0 then
TriggerEvent(Notify,'Too far away from the warehouse because you lost the owner.')
TriggerServerEvent("tostdostawa:OdszedlDalekoo")
Citizen.Wait(1500)
else
Citizen.Wait(3500)
end
end
end
end)