-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgui_c.lua
More file actions
3185 lines (2789 loc) · 98.9 KB
/
Copy pathgui_c.lua
File metadata and controls
3185 lines (2789 loc) · 98.9 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
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
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- ADMIN SHIT --
local isAdmin = false
--[[ isAdmin = false
RegisterNetEvent("sendAdminPermissionToClient")
AddEventHandler("sendAdminPermissionToClient", function(state)
isAdmin = state
end)--]]
local control = 244 -- set to whatever key you want key ids below
local title = "Toolbox"
-- need key ids? get them here: https://rhys19.life/ or https://docs.fivem.net/
--[[-----------------------------------------------------
Coded By Rhys19 © 2018
Functions are not copied they are off a gta5 animation site functions are built together from docs.fivem.net & the Native Reference
Lock code Removed -- Making my own.
Radar By Rhys19 (Coming Soon)
Fix is very simple to create!
Door controls by rhys19 -- your litterally just checking if the car has the door and setting it as opened lol.
-------------------------------------------------------
]]
--[[
Key IDS {
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
},
]]
--isAdmin = false
_menuPool = NativeUI.CreatePool()
mainMenu = NativeUI.CreateMenu(title, "~b~Main Menu") -- menu name appears at top of menu
_menuPool:Add(mainMenu)
_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)
local fe = false
function AddMenuVeh(menu)
local submenu = _menuPool:AddSubMenu(menu, "Vehicle")
for i = 1, 1 do
local Item = NativeUI.CreateItem("Lock", "Locks your car!, ~r~Not working yet!")
Item.Activated = function(ParentMenu, SelectedItem)
--Do stuff
ShowNotification('~r~Not working yet!')
end
local Item2 = NativeUI.CreateItem("Unlock", "Unlocks your car!, ~r~Not working yet!")
Item2.Activated = function(ParentMenu, SelectedItem)
--Do stuff
ShowNotification('~r~Not working yet!')
end
local Item3 = NativeUI.CreateItem("Roll Windows Front", "Roll Front Windows Up And Down")
Item3.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('frontWindow')
end
local Item4 = NativeUI.CreateItem("Roll Rear Windows", "Roll Rear Windows Up And Down")
Item4.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('rearWindow')
end
local Item5 = NativeUI.CreateItem("Save Vehicle", "Save the vehicle!, ~r~Not working yet!")
Item5.Activated = function(ParentMenu, SelectedItem)
--Do stuff
ShowNotification('~r~Not working yet!')
end
local Item6 = NativeUI.CreateItem("Engine", "Toggle Your Engine!")
Item6.Activated = function(ParentMenu, SelectedItem)
--Do stuff
EngineToggle()
end
local Item7 = NativeUI.CreateItem("Repair", "Repair Your Vehicle!")
Item7.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('fixveh')
end
local Item8 = NativeUI.CreateItem("~r~Delete~r~", "~r~Delete your Vehicle!")
Item8.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('deleteVehicle')
end
local extra2 = {0,1,2,3,4,5,6,7,8,9}
local newitem2 = NativeUI.CreateListItem("Livery", extra2, 1, false)
-- menu:AddItem(newitem2)
submenu.OnListChange = function(sender, item, index)
if item == newitem2 then
quantity = item:IndexToItem(index)
ShowNotification("~g~ Success: ~w~Livery Changed to ~y~#".. quantity)
local Veh = GetVehiclePedIsIn(GetPlayerPed(-1))
SetVehicleLivery(Veh, quantity)
end
end
submenu:AddItem(Item)
submenu:AddItem(Item2)
submenu:AddItem(Item3)
submenu:AddItem(Item4)
submenu:AddItem(Item5)
submenu:AddItem(Item6)
submenu:AddItem(Item7)
submenu:AddItem(Item8)
submenu:AddItem(newitem2)
_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)
end
end
function AddMenuleo(menu)
local submenu = _menuPool:AddSubMenu(menu, "LEO")
for i = 1, 1 do
--if isAdmin then
local Item = NativeUI.CreateItem("Cuff", "")
Item.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('cuff')
end
local Item2 = NativeUI.CreateItem("Drag", "")
Item2.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('grabNear')
end
local Item3 = NativeUI.CreateItem("Put In Vehicle", "")
Item3.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('seat')
end
local Item4 = NativeUI.CreateItem("Take Out Of Vehicle", "")
Item4.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('unseat')
end
local Item5 = NativeUI.CreateItem("Uncuff", "")
Item5.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('cuff')
end
local Item6 = NativeUI.CreateItem("Undrag", "")
Item6.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('grabNear')
end
local Item7 = NativeUI.CreateItem("unrack", "unrack your carbine")
Item7.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('unrack')
end
local Item8 = NativeUI.CreateItem("rack", "rack your carbine")
Item8.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('rack')
end
local Item9 = NativeUI.CreateItem("Deploy Spikes", "Deploy Spikes")
Item9.Activated = function(ParentMenu, SelectedItem)
--Do stuff
spikes()
end
local Item10 = NativeUI.CreateItem("Remove Spikes", "Remove Spikes")
Item10.Activated = function(ParentMenu, SelectedItem)
--Do stuff
delspike()
end
local Item11 = NativeUI.CreateItem("Radar", "Toggle the Radar Menu")
Item11.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('wk:radarRC')
ToggleMenu()
end
local Item12 = NativeUI.CreateItem("Police Megaphone", "")
Item12.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('polspeak:openMenu')
ToggleMenu()
end
local Item13 = NativeUI.CreateItem("Exit", "")
Item13.Activated = function(ParentMenu, SelectedItem)
--Do stuff
ToggleMenu()
end
submenu:AddItem(Item)
submenu:AddItem(Item2)
submenu:AddItem(Item3)
submenu:AddItem(Item4)
submenu:AddItem(Item5)
submenu:AddItem(Item6)
submenu:AddItem(Item7)
submenu:AddItem(Item8)
submenu:AddItem(Item9)
submenu:AddItem(Item10)
submenu:AddItem(Item11)
submenu:AddItem(Item12)
submenu:AddItem(Item13)
_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)
--else
--ShowNotification("~R~Insufficient Permissions")
--end
end
end
RegisterNetEvent('police:toggleDrag')
AddEventHandler('police:toggleDrag', function(t)
if(handCuffed) then
drag = not drag
officerDrag = t
end
end)
function GetPlayers()
local players = {}
for i = 0, 255 do
if NetworkIsPlayerActive(i) then
table.insert(players, i)
end
end
return players
end
function GetClosestPlayer()
local players = GetPlayers()
local closestDistance = -1
local closestPlayer = -1
local ply = PlayerPedId()
local plyCoords = GetEntityCoords(ply, 0)
for index,value in ipairs(players) do
local target = GetPlayerPed(value)
if(target ~= ply) then
local targetCoords = GetEntityCoords(GetPlayerPed(value), 0)
local distance = Vdist(targetCoords["x"], targetCoords["y"], targetCoords["z"], plyCoords["x"], plyCoords["y"], plyCoords["z"])
if(closestDistance == -1 or closestDistance > distance) then
closestPlayer = value
closestDistance = distance
end
end
end
return closestPlayer, closestDistance
end
--[[ seat me start ]]
RegisterNetEvent('seat')
AddEventHandler('seat',function()
local t, distance = GetClosestPlayer()
if(distance ~= -1 and distance < 3) then
TriggerServerEvent("seatServer", GetPlayerServerId(t))
else
ShowNotification("There is no nearby player to seat")
end
end)
RegisterNetEvent('unseat')
AddEventHandler('unseat',function()
local t, distance = GetClosestPlayer()
if(distance ~= -1 and distance < 2) then
TriggerServerEvent("unSeatServer", GetPlayerServerId(t))
else
ShowNotification("There is no nearby player to unseat")
end
end)
RegisterNetEvent('seatClient')
AddEventHandler('seatClient', function(veh)
local pos = GetEntityCoords(PlayerPedId())
local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0)
local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0)
local _, _, _, _, vehicleHandle = GetRaycastResult(rayHandle)
if vehicleHandle ~= nil then
if(IsVehicleSeatFree(vehicleHandle, 1)) then
SetPedIntoVehicle(PlayerPedId(), vehicleHandle, 1)
else
if(IsVehicleSeatFree(vehicleHandle, 2)) then
SetPedIntoVehicle(PlayerPedId(), vehicleHandle, 2)
end
end
end
end)
RegisterNetEvent('unSeatClient')
AddEventHandler('unSeatClient', function(t)
local ped = GetPlayerPed(t)
ClearPedTasksImmediately(ped)
plyPos = GetEntityCoords(PlayerPedId(), true)
local xnew = plyPos.x+2
local ynew = plyPos.y+2
SetEntityCoords(PlayerPedId(), xnew, ynew, plyPos.z)
end)
--[[seat me end]]
function AddMenudoorctrl(menu)
local submenu = _menuPool:AddSubMenu(menu, "Doors")
for i = 1, 1 do
local Item = NativeUI.CreateItem("Toggle Left Front Door", "")
Item.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('frontLeft')
end
local Item2 = NativeUI.CreateItem("Toggle Left Rear Door", "")
Item2.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('rearLeft')
end
local Item3 = NativeUI.CreateItem("Toggle Right Front Door", "")
Item3.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('frontRight')
end
local Item4 = NativeUI.CreateItem("Toggle Right Rear Door", "")
Item4.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('rearRight')
end
local Item5 = NativeUI.CreateItem("Open All Doors", "")
Item5.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('frontLeft')
TriggerEvent('rearLeft')
TriggerEvent('frontRight')
TriggerEvent('rearRight')
TriggerEvent('openHood')
TriggerEvent('openTrunk')
end
local Item6 = NativeUI.CreateItem("Close All Doors", "")
Item6.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('frontLeft')
TriggerEvent('rearLeft')
TriggerEvent('frontRight')
TriggerEvent('rearRight')
TriggerEvent('openHood')
TriggerEvent('openTrunk')
end
local Item7 = NativeUI.CreateItem("Toggle Hood", "")
Item7.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('openHood')
end
local Item8 = NativeUI.CreateItem("Toggle Trunk", "")
Item8.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('openTrunk')
end
submenu:AddItem(Item)
submenu:AddItem(Item2)
submenu:AddItem(Item3)
submenu:AddItem(Item4)
submenu:AddItem(Item5)
submenu:AddItem(Item6)
submenu:AddItem(Item7)
submenu:AddItem(Item8)
_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)
end
end
function AddMenuciv(menu)
local submenu = _menuPool:AddSubMenu(menu, "Civ")
for i = 1, 1 do
local Item = NativeUI.CreateItem("Handsup", "")
Item.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('Handsup2')
end
local Item2 = NativeUI.CreateItem("Kneel", "")
Item2.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('KneelHU2')
end
local Item3 = NativeUI.CreateItem("Set RP Name", "Set your roleplay name!")
Item3.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('rpname')
end
local Item4 = NativeUI.CreateItem("Show ID", "Show your roleplay name!")
Item4.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('rpnameshow')
end
local Item5 = NativeUI.CreateItem("Cancel Emote", "Cancel your current emote/animation")
Item5.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('cancelEmote')
end
submenu:AddItem(Item)
submenu:AddItem(Item2)
submenu:AddItem(Item3)
submenu:AddItem(Item4)
submenu:AddItem(Item5)
_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)
end
end
function AddMenuloadout(menu)
local submenu = _menuPool:AddSubMenu(menu, "Loadouts")
for i = 1, 1 do
local Item = NativeUI.CreateItem("PD loadout", "Equip the PD Loadout")
Item.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('leoloadout')
end
local Item2 = NativeUI.CreateItem("Sheriff Loadout", "Equip the Sheriff Loadout")
Item2.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('bcloadout')
end
local Item3 = NativeUI.CreateItem("Highway loadout", "Equip the Highway Loadout")
Item3.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('leoloadout')
end
local Item4 = NativeUI.CreateItem("SRU/Swat Loadout", "Equip the SRU/Swat Loadout")
Item4.Activated = function(ParentMenu, SelectedItem)
--Do stuff
TriggerEvent('swatloadout')
end
local NewItem5 = NativeUI.CreateCheckboxItem("Equip Fire Extinguisher", fe, "Equip your Fire Extinguisher!")
NewItem5.OnCheckboxChange = function(sender, item, checked_)
if item == NewItem5 then
fe = checked_
ShowNotification("~r~Added Fire Extinguisher ~b~")
TriggerEvent("Equip_Fire_Extinguisher")
end
end
submenu:AddItem(Item)
submenu:AddItem(Item2)
submenu:AddItem(Item3)
submenu:AddItem(Item4)
submenu:AddItem(NewItem5)
_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)
end
end
local emotes = {
"Smoke",
"Party",
"Drink",
"Pushups",
"Phone",
"Weed",
"Coffee",
"Photo",
"Binoculars",
"Situps",
"Film",
"Weights",
"Flex",
"Stance",
"Investigate",
"Citation",
"Notes",
"Weld",
"Traffic",
"Medic",
}
function AddMenuEmotes(menu)
local submenu = _menuPool:AddSubMenu(menu, "Emotes")
for i = 1, 1 do
local Item = NativeUI.CreateListItem("Emotes", emotes, 1)
Item.OnListChanged = function(ParentMenu, SelectedItem, Index)
local Item = SelectedItem:IndexToItem(Index)
if Item == "Smoke" then
TriggerEvent("Smoke")
elseif Item == "Party" then
TriggerEvent("Party")
elseif Item == "Drink" then
TriggerEvent("Drink")
elseif Item == "Pushups" then
TriggerEvent("Pushups")
elseif Item == "Phone" then
TriggerEvent("Phone")
elseif Item == "Weed" then
TriggerEvent("Weed")
elseif Item == "Coffee" then
TriggerEvent("Coffee")
elseif Item == "Photo" then
TriggerEvent("Photo")
elseif Item == "Binoculars" then
TriggerEvent("Binoculars")
elseif Item == "Situps" then
TriggerEvent("Situps")
elseif Item == "Film" then
TriggerEvent("Film")
elseif Item == "Weights" then
TriggerEvent("Weights")
elseif Item == "Flex" then
TriggerEvent("Flex")
elseif Item == "Stance" then
TriggerEvent("Stance")
elseif Item == "Investigate" then
TriggerEvent("Investigate")
elseif Item == "Citation" then
TriggerEvent("Citation")
elseif Item == "Notes" then
TriggerEvent("Notes")
elseif Item == "Weld" then
TriggerEvent("Weld")
elseif Item == "Traffic" then
TriggerEvent("Traffic")
elseif Item == "Medic" then
TriggerEvent("Medic")
end
end
submenu:AddItem(Item)
_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)
end
end
AddMenuleo(mainMenu)
AddMenuciv(mainMenu)
AddMenuVeh(mainMenu)
AddMenuloadout(mainMenu)
AddMenudoorctrl(mainMenu)
AddMenuEmotes(mainMenu)
_menuPool:RefreshIndex()
function ToggleMenu()
_menuPool:CloseAllMenus()
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
_menuPool:ProcessMenus()
if IsControlJustPressed(1, control) and GetLastInputMethod( 0 ) then
mainMenu:Visible(not mainMenu:Visible())
end
end
end)
RegisterNetEvent("Equip_Fire_Extinguisher")
AddEventHandler("Equip_Fire_Extinguisher", function()
local ped = GetPlayerPed(PlayerId())
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("weapon_fireextinguisher"), 1000, false)
TriggerServerEvent("unrackmsg")
end)
RegisterNetEvent("unrack")
AddEventHandler("unrack", function()
local ped = GetPlayerPed(PlayerId())
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false)
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_CARBINERIFLE_CLIP_02")) -- Carbine - Extended Clip
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_AT_AR_FLSH")) -- carbine flashlight
--GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_AT_SCOPE_MEDIUM")) -- carbine scope
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("COMPONENT_AT_AR_AFGRIP")) -- carbine grip
TriggerServerEvent("unrackmsg")
end)
RegisterNetEvent("rack")
AddEventHandler("rack", function()
local ped = GetPlayerPed(PlayerId())
RemoveWeaponFromPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"))
--TriggerEvent('chatMessage', 'Toolbox', {255, 255, 255}, ''..GetPlayerName(sourceID)..' Has racked their carbine rifle')
TriggerServerEvent("rackmsg")
end)
RegisterNetEvent("leoloadout")
AddEventHandler("leoloadout", function()
local ped = PlayerPedId()
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_COMBATPISTOL"), 1000, false) -- equip the combat pistol
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_COMBATPISTOL"), GetHashKey("COMPONENT_AT_PI_FLSH")) -- equip the flashlight attachment!
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_BZGAS"), 1000, false) -- equip BZ Gas
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLARE"), 1000, false) -- Equip Flare
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_NIGHTSTICK"), 1000, false) -- Equip NightStick
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLASHLIGHT"), 1000, false) -- Equip Flashlight
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_STUNGUN"), 1000, false) -- Equip Tazer
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PUMPSHOTGUN "), 1000, false) -- Equip Shotgun
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_HANDCUFFS "), 1000, false) -- Equip Handcuffs
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false)
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0x91109691")) -- Carbine - Extended Clip
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0x7BC4CDDC")) -- carbine flashlight
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0xA0D89C42")) -- carbine scope
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0xC164F53")) -- carbine grip
drawNotification("~g~Your LEO loadout has been equipped!")
end)
RegisterNetEvent("bcloadout")
AddEventHandler("bcloadout", function()
local ped = PlayerPedId()
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_COMBATPISTOL"), 1000, false) -- equip the combat pistol
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_COMBATPISTOL"), GetHashKey("COMPONENT_AT_PI_FLSH")) -- equip the flashlight attachment!
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_BZGAS"), 1000, false) -- equip BZ Gas
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLARE"), 1000, false) -- Equip Flare
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_NIGHTSTICK"), 1000, false) -- Equip NightStick
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLASHLIGHT"), 1000, false) -- Equip Flashlight
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_STUNGUN"), 1000, false) -- Equip Tazer
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PUMPSHOTGUN"), 1000, false) -- Equip Shotgun
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PUMPSHOTGUN"), GetHashKey("COMPONENT_AT_AR_FLSH"))
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_HANDCUFFS "), 1000, false) -- Equip Handcuffs
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false)
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0x91109691")) -- Carbine - Extended Clip
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0x7BC4CDDC")) -- carbine flashlight
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0xA0D89C42")) -- carbine scope
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0xC164F53")) -- carbine grip
drawNotification("~g~Your Sheriff loadout has been equipped!")
end)
RegisterNetEvent("fdloadout")
AddEventHandler("fdloadout", function()
local ped = PlayerPedId()
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLARE"), 1000, false) -- Equip Flare
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLASHLIGHT"), 1000, false) -- equip Flashlight
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_STUNGUN"), 1000, false) -- equip stungun
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLAREGUN"), 1000, false) -- equip flaregun
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_MOLOTOV"), 1000, false) -- equip molotov
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FIREEXTINGUISHER"), 1000, false) -- equip fire Extinguisher
drawNotification("~g~Your Fire Department loadout has been equipped!")
end)
RegisterNetEvent("emsloadout")
AddEventHandler("emsloadout", function()
local ped = PlayerPedId()
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLASHLIGHT"), 1000, false) -- equip flashlight
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_STUNGUN"), 1000, false) -- equip stungun
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_GARBAGEBAG"), 1000, false) -- equip bag
drawNotification("~g~Your EMS loadout has been equipped!")
end)
RegisterNetEvent("swatLoadout")
AddEventHandler("swatLoadout", function()
local ped = PlayerPedId()
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_COMBATPISTOL"), 1000, false) -- equip the combat pistol
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_COMBATPISTOL"), GetHashKey("COMPONENT_AT_PI_FLSH")) -- equip the flashlight attachment!
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false)
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0x91109691")) -- Carbine - Extended Clip
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0x7BC4CDDC")) -- carbine flashlight
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0xA0D89C42")) -- carbine scope
GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), GetHashKey("0xC164F53")) -- carbine grip
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_BZGAS"), 1000, false) -- equip BZ Gas
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLARE"), 1000, false) -- Equip Flare
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_NIGHTSTICK"), 1000, false) -- Equip NightStick
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_FLASHLIGHT"), 1000, false) -- Equip Flashlight
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_STUNGUN"), 1000, false) -- Equip Tazer
drawNotification("~g~Your SWAT loadout has been equipped!")
end)
-------------- FUNCTIONS --------------------
---------------- Put your hands up ----------------
RegisterNetEvent("Handsup2")
AddEventHandler("Handsup2", function()
local lPed = GetPlayerPed(-1)
if DoesEntityExist(lPed) then
Citizen.CreateThread(function()
RequestAnimDict("random@arrests")
while not HasAnimDictLoaded("random@arrests") do
Citizen.Wait(100)
end
if IsEntityPlayingAnim(lPed, "random@arrests", "idle_2_hands_up", 3) then
ClearPedSecondaryTask(lPed)
SetEnableHandcuffs(lPed, false)
else
TaskPlayAnim(lPed, "random@arrests", "idle_2_hands_up", 8.0, -8, -1, 49, 0, 0, 0, 0)
SetEnableHandcuffs(lPed, true)
end
end)
end
end)
---------------- Put your hands up ----------------
--------------- Kneel with hands up ----------------
function loadAnimDict( dict )
while ( not HasAnimDictLoaded( dict ) ) do
RequestAnimDict( dict )
Citizen.Wait( 5 )
end
end
RegisterNetEvent( 'KneelHU2' )
AddEventHandler( 'KneelHU2', function()
local player = GetPlayerPed( -1 )
if ( DoesEntityExist( player ) and not IsEntityDead( player )) then
loadAnimDict( "random@arrests" )
loadAnimDict( "random@arrests@busted" )
if ( IsEntityPlayingAnim( player, "random@arrests", "kneeling_arrest_idle", 3 ) ) then
TaskPlayAnim( player, "random@arrests@busted", "exit", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (3000)
TaskPlayAnim( player, "random@arrests", "kneeling_arrest_get_up", 8.0, 1.0, -1, 128, 0, 0, 0, 0 )
else
TaskPlayAnim( player, "random@arrests", "idle_2_hands_up", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (4000)
TaskPlayAnim( player, "random@arrests", "kneeling_arrest_idle", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
--[[Wait (500)
TaskPlayAnim( player, "random@arrests@busted", "enter", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (1000)
TaskPlayAnim( player, "random@arrests@busted", "idle_a", 8.0, 1.0, -1, 9, 0, 0, 0, 0 )--]]
end
end
end )
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests@busted", "idle_a", 3) then
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
DisableControlAction(0, 21, true)
end
end
end)
---------------- Kneel with hands up ----------------
function drawNotification(text) --Just Don't Edit!
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(false, false)
end
-- Front Windows Start
local windowup = true
RegisterNetEvent("frontWindow")
AddEventHandler('frontWindow', function()
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
local playerCar = GetVehiclePedIsIn(playerPed, false)
if ( GetPedInVehicleSeat( playerCar, -1 ) == playerPed ) then
SetEntityAsMissionEntity( playerCar, true, true )
if ( windowup ) then
RollDownWindow(playerCar, 0)
RollDownWindow(playerCar, 1)
drawNotification("You rolled down your front windows.")
windowup = false
else
RollUpWindow(playerCar, 0)
RollUpWindow(playerCar, 1)
drawNotification("You rolled up your front windows.")
windowup = true
end
end
end
end )
-- Front Windows End
-- Rear Windows Start
local windowup = true
RegisterNetEvent("rearWindow")
AddEventHandler('rearWindow', function()
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
local playerCar = GetVehiclePedIsIn(playerPed, false)
if ( GetPedInVehicleSeat( playerCar, -1 ) == playerPed ) then
SetEntityAsMissionEntity( playerCar, true, true )
if ( windowup ) then
RollDownWindow(playerCar, 2)
RollDownWindow(playerCar, 3)
drawNotification("~w~You rolled down your rear windows.")
windowup = false
else
RollUpWindow(playerCar, 2)
RollUpWindow(playerCar, 3)
drawNotification("~w~You rolled up your rear windows.")
windowup = true
end
end
end
end )
-- Rear Windows End
--[LEO Animations Start]
-- Hand on Radio Start
RegisterNetEvent('Radio')
AddEventHandler('Radio', function()
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
Citizen.CreateThread( function()
RequestAnimDict( "random@arrests" )
while ( not HasAnimDictLoaded( "random@arrests" ) ) do
Citizen.Wait( 100 )
end
if IsEntityPlayingAnim(ped, "random@arrests", "generic_radio_chatter", 3) then
ClearPedSecondaryTask(ped)
SetCurrentPedWeapon(ped, GetHashKey("GENERIC_RADIO_CHATTER"), true)
else
TaskPlayAnim(ped, "random@arrests", "generic_radio_chatter", 8.0, 2.5, -1, 49, 0, 0, 0, 0 )
SetCurrentPedWeapon(ped, GetHashKey("GENERIC_RADIO_CHATTER"), true)
end
end )
end
end )
-- Hand on Radio End
-- Hand on Radio W/ Gun Start
function loadAnimDict( dict )
while ( not HasAnimDictLoaded( dict ) ) do
RequestAnimDict( dict )
Citizen.Wait( 5 )
end
end
RegisterNetEvent( 'RadioGunPoint' )
AddEventHandler( 'RadioGunPoint', function()
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped )) then
loadAnimDict( "random@arrests" )
if ( IsEntityPlayingAnim( ped, "random@arrests", "radio_chatter", 3 ) ) then
ClearPedSecondaryTask(ped)
SetEnableHandcuffs(ped, false)
SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
else
TaskPlayAnim(ped, "random@arrests", "radio_chatter", 8.0, 2.5, -1, 49, 0, 0, 0, 0 )
SetCurrentPedWeapon(ped, GetHashKey("WEAPON_PISTOL"), true)
end
end
end )
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests", "radio_chatter", 3) then
DisableControlAction(0, 21, true)
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
end
end
end)
-- Hand on Radio W/ Gun End
-- LEO Stance Start
RegisterNetEvent('Stance')
AddEventHandler('Stance', function()
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
TaskStartScenarioInPlace(PlayerPedId(), "WORLD_HUMAN_COP_IDLES", 0, true);
Citizen.Wait(15000)
ClearPedTasksImmediately(GetPlayerPed(-1))
end
end )
-- LEO Stance End
-- Investigate Start
RegisterNetEvent('Investigate')
AddEventHandler('Investigate', function()
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
TaskStartScenarioInPlace(PlayerPedId(), "WORLD_HUMAN_GUARD_STAND", 0, true);
Citizen.Wait(15000)
ClearPedTasksImmediately(GetPlayerPed(-1))
end
end )
-- Investigate End
-- Holster Start
RegisterNetEvent( 'Holster' )
AddEventHandler( 'Holster', function()
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped )) then
loadAnimDict( "move_m@intimidation@cop@unarmed" )
if ( IsEntityPlayingAnim( ped, "move_m@intimidation@cop@unarmed", "idle", 3 ) ) then
ClearPedSecondaryTask(ped)
SetEnableHandcuffs(ped, false)
SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
else
TaskPlayAnim(ped, "move_m@intimidation@cop@unarmed", "idle", 8.0, 2.5, -1, 49, 0, 0, 0, 0 )
SetEnableHandcuffs(ped, true)
SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
end
end
end )
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "move_m@intimidation@cop@unarmed", "idle", 3) then
DisableControlAction(0, 21, true)
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
end
end
end)
-- Holster End
-- Citation Start
RegisterNetEvent('Citation')
AddEventHandler('Citation', function()
local ped = GetPlayerPed( -1 )
if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
TaskStartScenarioInPlace(PlayerPedId(), "CODE_HUMAN_MEDIC_TIME_OF_DEATH", 0, true);
Citizen.Wait(9999999000)
ClearPedTasksImmediately(GetPlayerPed(-1))
end
end )