-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathclient.lua
More file actions
898 lines (761 loc) · 32.3 KB
/
client.lua
File metadata and controls
898 lines (761 loc) · 32.3 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
--[[
──────────────────────────────────────────────────────────────
SEM_InteractionMenu (client.lua) - Created by Scott M
Current Version: v1.7.1 (Sep 2021)
Support: https://semdevelopment.com/discord
!!! Change vaules in the 'config.lua' !!!
DO NOT EDIT THIS IF YOU DON'T KNOW WHAT YOU ARE DOING
──────────────────────────────────────────────────────────────
]]
--Cuffing Event
local isCuffed = false
RegisterNetEvent('SEM_InteractionMenu:Cuff')
AddEventHandler('SEM_InteractionMenu:Cuff', function()
local Ped = PlayerPedId()
if (DoesEntityExist(Ped)) then
Citizen.CreateThread(function()
RequestAnimDict('mp_arresting')
while not HasAnimDictLoaded('mp_arresting') do
Citizen.Wait(0)
end
if isCuffed then
isCuffed = false
Citizen.Wait(500)
SetEnableHandcuffs(Ped, false)
ClearPedTasksImmediately(Ped)
else
isCuffed = true
SetEnableHandcuffs(Ped, true)
TaskPlayAnim(Ped, 'mp_arresting', 'idle', 8.0, -8, -1, 49, 0, 0, 0, 0)
end
end)
end
end)
--Cuff Animation & Restructions
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
if isCuffed then
if not IsEntityPlayingAnim(GetPlayerPed(PlayerId()), 'mp_arresting', 'idle', 3) then
TaskPlayAnim(GetPlayerPed(PlayerId()), 'mp_arresting', 'idle', 8.0, -8, -1, 49, 0, 0, 0, 0)
end
SetCurrentPedWeapon(PlayerPedId(), 'weapon_unarmed', true)
if not Config.VehEnterCuffed then
DisableControlAction(1, 23, true) --F | Enter Vehicle
DisableControlAction(1, 75, true) --F | Exit Vehicle
end
DisableControlAction(1, 140, true) --R
DisableControlAction(1, 141, true) --Q
DisableControlAction(1, 142, true) --LMB
SetPedPathCanUseLadders(GetPlayerPed(PlayerId()), false)
if IsPedInAnyVehicle(GetPlayerPed(PlayerId()), false) then
DisableControlAction(0, 59, true) --Vehicle Driving
end
end
end
end)
--Dragging Event
local Drag = false
local OfficerDrag = -1
RegisterNetEvent('SEM_InteractionMenu:Drag')
AddEventHandler('SEM_InteractionMenu:Drag', function(ID)
Drag = not Drag
OfficerDrag = ID
if not Drag then
DetachEntity(PlayerPedId(), true, false)
end
end)
--Drag Attachment
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
if Drag then
local Ped = GetPlayerPed(GetPlayerFromServerId(OfficerDrag))
local Ped2 = PlayerPedId()
AttachEntityToEntity(Ped2, Ped, 4103, 0.35, 0.38, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
DisableControlAction(1, 140, true) --R
DisableControlAction(1, 141, true) --Q
DisableControlAction(1, 142, true) --LMB
end
end
end)
--Force Seat Player Event
RegisterNetEvent('SEM_InteractionMenu:Seat')
AddEventHandler('SEM_InteractionMenu:Seat', 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
SetPedIntoVehicle(PlayerPedId(), VehicleHandle, 1)
end
end)
--Force Unseat Player Event
RegisterNetEvent('SEM_InteractionMenu:Unseat')
AddEventHandler('SEM_InteractionMenu:Unseat', function(ID)
local Ped = GetPlayerPed(ID)
ClearPedTasksImmediately(Ped)
PlayerPos = GetEntityCoords(PlayerPedId(), true)
local X = PlayerPos.x - 0
local Y = PlayerPos.y - 0
SetEntityCoords(PlayerPedId(), X, Y, PlayerPos.z)
end)
--Spike Strip Spawn Event
local SpawnedSpikes = {}
RegisterNetEvent('SEM_InteractionMenu:Spikes-SpawnSpikes')
AddEventHandler('SEM_InteractionMenu:Spikes-SpawnSpikes', function(Length)
if IsPedInAnyVehicle(PlayerPedId(), false) then
Notify('~r~You can\'t set spikes while in a vehicle!')
return
end
local SpawnCoords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(PlayerId()) , 0.0, 2.0, 0.0)
for a = 1, Length do
local Spike = CreateObject(GetHashKey('P_ld_stinger_s'), SpawnCoords.x, SpawnCoords.y, SpawnCoords.z, 1, 1, 1)
local NetID = NetworkGetNetworkIdFromEntity(Spike)
SetNetworkIdExistsOnAllMachines(NetID, true)
SetNetworkIdCanMigrate(NetID, false)
SetEntityHeading(Spike, GetEntityHeading(GetPlayerPed(PlayerId()) ))
PlaceObjectOnGroundProperly(Spike)
FreezeEntityPosition(Spike, true)
SpawnCoords = GetOffsetFromEntityInWorldCoords(Spike, 0.0, 4.0, 0.0)
table.insert(SpawnedSpikes, NetID)
end
end)
--Spike Strip Delete Event
RegisterNetEvent('SEM_InteractionMenu:Spikes-DeleteSpikes')
AddEventHandler('SEM_InteractionMenu:Spikes-DeleteSpikes', function()
for a = 1, #SpawnedSpikes do
local Spike = NetworkGetEntityFromNetworkId(SpawnedSpikes[a])
DeleteEntity(Spike)
end
Notify('~r~Spikes Strips Removed!')
SpawnedSpikes = {}
end)
--Spike Strip Tire Popping
Citizen.CreateThread(function()
while true do
Citizen.Wait(25)
if IsPedInAnyVehicle(PlayerPedId() , false) then
local Vehicle = GetVehiclePedIsIn(PlayerPedId() , false)
if GetPedInVehicleSeat(Vehicle, -1) == PlayerPedId() then
local VehiclePos = GetEntityCoords(Vehicle, false)
local Spike = GetClosestObjectOfType(VehiclePos.x, VehiclePos.y, VehiclePos.z, 2.0, GetHashKey('P_ld_stinger_s'), 1, 1, 1)
if Spike ~= 0 then
local Tires = {
{bone = 'wheel_lf', index = 0},
{bone = 'wheel_rf', index = 1},
{bone = 'wheel_lm', index = 2},
{bone = 'wheel_rm', index = 3},
{bone = 'wheel_lr', index = 4},
{bone = 'wheel_rr', index = 5}
}
for a = 1, #Tires do
local TirePos = GetWorldPositionOfEntityBone(Vehicle, GetEntityBoneIndexByName(Vehicle, Tires[a].bone))
local Spike = GetClosestObjectOfType(TirePos.x, TirePos.y, TirePos.z, 2.0, GetHashKey('P_ld_stinger_s'), 1, 1, 1)
local SpikePos = GetEntityCoords(Spike, false)
local Distance = Vdist(TirePos.x, TirePos.y, TirePos.z, SpikePos.x, SpikePos.y, SpikePos.z)
if Distance < 1.8 then
if not IsVehicleTyreBurst(Vehicle, Tires[a].index, true) or IsVehicleTyreBurst(Vehicle, Tires[a].index, false) then
SetVehicleTyreBurst(Vehicle, Tires[a].index, false, 1000.0)
end
end
end
end
end
end
end
end)
--Backup
RegisterNetEvent('SEM_InteractionMenu:CallBackup')
AddEventHandler('SEM_InteractionMenu:CallBackup', function(Code, StreetName, Coords)
if LEORestrict() then
local BackupBlip = nil
local BackupBlips = {}
local function CreateBlip(x, y, z, Name, Sprite, Size, Colour)
BackupBlip = AddBlipForCoord(x, y, z)
SetBlipSprite(BackupBlip, Sprite)
SetBlipDisplay(BackupBlip, 4)
SetBlipScale(BackupBlip, Size)
SetBlipColour(BackupBlip, Colour)
SetBlipAsShortRange(BackupBlip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentString(Name)
EndTextCommandSetBlipName(BackupBlip)
table.insert(BackupBlips, BackupBlip)
Citizen.Wait(Config.BackupBlipTimeout * 60000)
for _, Blip in pairs(BackupBlips) do
RemoveBlip(Blip)
end
end
if Code == 1 then
Notify('An officer is requesting ~g~Code 1 ~w~backup at ~b~' .. StreetName)
CreateBlip(Coords.x, Coords.y, Coords.z, 'Code 1 Backup Requested', 56, 0.8, 2)
elseif Code == 2 then
Notify('An officer is requesting ~y~Code 2 ~w~backup at ~b~' .. StreetName)
CreateBlip(Coords.x, Coords.y, Coords.z, 'Code 2 Backup Requested', 56, 0.8, 17)
elseif Code == 3 then
Notify('An officer is requesting ~r~Code 3 ~w~backup at ~b~' .. StreetName)
CreateBlip(Coords.x, Coords.y, Coords.z, 'Code 3 Backup Requested', 56, 1.0, 49)
elseif Code == 99 then
Notify('An officer is requesting ~r~Code 99 ~w~backup at ~b~' .. StreetName)
CreateBlip(Coords.x, Coords.y, Coords.z, 'Code 99 Backup Requested', 56, 1.2, 49)
elseif Code == 'panic' then
Notify('An officer has pressed their ~r~Panic Button ~w~at ~b~' .. StreetName)
CreateBlip(Coords.x, Coords.y, Coords.z, 'Panic Button Pressed', 103, 1.2, 49)
end
end
end)
--Jail
CurrentlyJailed = false
EarlyRelease = false
OriginalJailTime = 0
RegisterNetEvent('SEM_InteractionMenu:JailPlayer')
AddEventHandler('SEM_InteractionMenu:JailPlayer', function(JailTime)
if CurrentlyJailed then
return
end
if CurrentlyHospitaled then
return
end
OriginalJailTime = JailTime
local Ped = PlayerPedId()
if DoesEntityExist(Ped) then
Citizen.CreateThread(function()
SetEntityCoords(Ped, Config.JailLocation.Jail.x, Config.JailLocation.Jail.y, Config.JailLocation.Jail.z)
SetEntityHeading(Ped, Config.JailLocation.Jail.h)
CurrentlyJailed = true
while JailTime >= 0 and not EarlyRelease do
SetEntityInvincible(Ped, true)
if IsPedInAnyVehicle(Ped, false) then
ClearPedTasksImmediately(Ped)
end
if JailTime % 30 == 0 and JailTime ~= 0 then
TriggerEvent('chat:addMessage', {
multiline = true,
color = {86, 96, 252},
args = {'Judge', JailTime .. ' months until release.'},
})
end
Citizen.Wait(1000)
local Location = GetEntityCoords(Ped, true)
local Distance = Vdist(Config.JailLocation.Jail.x, Config.JailLocation.Jail.y, Config.JailLocation.Jail.z, Location['x'], Location['y'], Location['z'])
if Distance > 100 then
SetEntityCoords(Ped, Config.JailLocation.Jail.x, Config.JailLocation.Jail.y, Config.JailLocation.Jail.z)
SetEntityHeading(Ped, Config.JailLocation.Jail.h)
TriggerEvent('chat:addMessage', {
multiline = true,
color = {86, 96, 252},
args = {'Judge', 'Don\'t try escape, its impossible'},
})
end
JailTime = JailTime - 1
end
if EarlyRelease then
TriggerServerEvent('SEM_InteractionMenu:GlobalChat', {86, 96, 252}, 'Judge', GetPlayerName(PlayerId()) .. ' was released from Jail on Parole')
else
TriggerServerEvent('SEM_InteractionMenu:GlobalChat', {86, 96, 252}, 'Judge', GetPlayerName(PlayerId()) .. ' was released from Jail after ' .. OriginalJailTime .. ' months(s).')
end
SetEntityCoords(Ped, Config.JailLocation.Release.x, Config.JailLocation.Release.y, Config.JailLocation.Release.z)
SetEntityHeading(Ped, Config.JailLocation.Release.h)
CurrentlyJailed = false
EarlyRelease = false
end)
end
end)
RegisterNetEvent('SEM_InteractionMenu:UnjailPlayer')
AddEventHandler('SEM_InteractionMenu:UnjailPlayer', function()
EarlyRelease = true
end)
--Toggle LEO Weapons
CarbineEquipped = false
ShotgunEquipped = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(50)
if Config.UnrackWeapons == 1 then
local Ped = PlayerPedId()
local CurrentWeapon = GetSelectedPedWeapon(Ped)
if CarbineEquipped then
SetCurrentPedWeapon(Ped, 'weapon_carbinerifle', true)
else
if tostring(CurrentWeapon) == '-2084633992' then
Notify('~o~You need to unrack your rifle before you can use it')
SetCurrentPedWeapon(Ped, 'weapon_unarmed', true)
end
end
if ShotgunEquipped then
SetCurrentPedWeapon(Ped, 'weapon_pumpshotgun', true)
else
if tostring(CurrentWeapon) == '487013001' then
Notify('~o~You need to unrack your shotgun before you can use it')
SetCurrentPedWeapon(Ped, 'weapon_unarmed', true)
end
end
end
end
end)
--Civilian Adverts
RegisterNetEvent('SEM_InteractionMenu:SyncAds')
AddEventHandler('SEM_InteractionMenu:SyncAds',function(Text, Name, Loc, File, ID)
Ad(Text, Name, Loc, File, ID)
end)
--Inventory
RegisterNetEvent('SEM_InteractionMenu:InventoryResult')
AddEventHandler('SEM_InteractionMenu:InventoryResult', function(Inventory)
Citizen.Wait(5000)
if Inventory == nil then
Inventory = 'Empty'
end
Notify('~b~Inventory Items: ~g~' .. Inventory)
end)
--BAC
RegisterNetEvent('SEM_InteractionMenu:BACResult')
AddEventHandler('SEM_InteractionMenu:BACResult', function(BACLevel)
Citizen.Wait(5000)
if BACLevel == nil then
BACLevel = 0.00
end
if tonumber(BACLevel) < 0.08 then
Notify('~b~BAC Level: ~g~' .. tostring(BACLevel))
else
Notify('~b~BAC Level: ~r~' .. tostring(BACLevel))
end
end)
--Hospital
CurrentlyHospitalized = false
EarlyDischarge = false
OriginalHospitalTime = 0
RegisterNetEvent('SEM_InteractionMenu:HospitalizePlayer')
AddEventHandler('SEM_InteractionMenu:HospitalizePlayer', function(HospitalTime, HospitalLocation)
if CurrentlyHospitaled then
return
end
if CurrentlyJailed then
return
end
OriginalHospitalTime = HospitalTime
local Ped = PlayerPedId()
if DoesEntityExist(Ped) then
Citizen.CreateThread(function()
SetEntityCoords(Ped, HospitalLocation.Hospital.x, HospitalLocation.Hospital.y, HospitalLocation.Hospital.z)
SetEntityHeading(Ped, HospitalLocation.Hospital.h)
CurrentlyHospitaled = true
while HospitalTime >= 0 and not EarlyDischarge do
SetEntityInvincible(Ped, true)
if IsPedInAnyVehicle(Ped, false) then
ClearPedTasksImmediately(Ped)
end
if HospitalTime % 30 == 0 and HospitalTime ~= 0 then
TriggerEvent('chat:addMessage', {
multiline = true,
color = {86, 96, 252},
args = {'Doctor', HospitalTime .. ' months until release.'},
})
end
Citizen.Wait(1000)
local Location = GetEntityCoords(Ped, true)
local Distance = Vdist(HospitalLocation.Hospital.x, HospitalLocation.Hospital.y, HospitalLocation.Hospital.z, Location['x'], Location['y'], Location['z'])
if Distance > 30 then
SetEntityCoords(Ped, HospitalLocation.Hospital.x, HospitalLocation.Hospital.y, HospitalLocation.Hospital.z)
SetEntityHeading(Ped, HospitalLocation.Hospital.h)
TriggerEvent('chat:addMessage', {
multiline = true,
color = {86, 96, 252},
args = {'Doctor', 'You cannot discharge yourself!'},
})
end
HospitalTime = HospitalTime - 1
end
if EarlyDischarge then
TriggerServerEvent('SEM_InteractionMenu:GlobalChat', {86, 96, 252}, 'Doctor', GetPlayerName(PlayerId()) .. ' was discharged from Hospital early')
else
TriggerServerEvent('SEM_InteractionMenu:GlobalChat', {86, 96, 252}, 'Doctor', GetPlayerName(PlayerId()) .. ' was discharged from Hospital after ' .. OriginalHospitalTime .. ' months(s).')
end
SetEntityCoords(Ped, HospitalLocation.Release.x, HospitalLocation.Release.y, HospitalLocation.Release.z)
SetEntityHeading(Ped, HospitalLocation.Release.h)
CurrentlyHospitaled = false
EarlyDischarge = false
end)
end
end)
RegisterNetEvent('SEM_InteractionMenu:UnhospitalizePlayer')
AddEventHandler('SEM_InteractionMenu:UnhospitalizePlayer', function()
EarlyDischarge = true
end)
--Station Blips
Citizen.CreateThread(function()
if Config.DisplayStationBlips then
local function CreateBlip(x, y, z, Name, Colour, Sprite)
StationBlip = AddBlipForCoord(x, y, z)
SetBlipSprite(StationBlip, Sprite)
if Config.StationBlipsDispalyed == 1 then
SetBlipDisplay(StationBlip, 3)
elseif Config.StationBlipsDispalyed == 2 then
SetBlipDisplay(StationBlip, 5)
else
SetBlipDisplay(StationBlip, 2)
end
SetBlipScale(StationBlip, 1.0)
SetBlipColour(StationBlip, Colour)
SetBlipAsShortRange(StationBlip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentString(Name)
EndTextCommandSetBlipName(StationBlip)
end
for _, Station in pairs(Config.LEOStations) do
CreateBlip(Station.coords.x, Station.coords.y, Station.coords.z, 'Police Station', 38, 60)
end
for _, Station in pairs(Config.FireStations) do
CreateBlip(Station.coords.x, Station.coords.y, Station.coords.z, 'Fire Station', 1, 60)
end
for _, Station in pairs(Config.HospitalStations) do
CreateBlip(Station.coords.x, Station.coords.y, Station.coords.z, 'Hospital', 2, 61)
end
end
end)
--Permissions
LEOAce = false
TriggerServerEvent('SEM_InteractionMenu:LEOPerms')
RegisterNetEvent('SEM_InteractionMenu:LEOPermsResult')
AddEventHandler('SEM_InteractionMenu:LEOPermsResult', function(Allowed)
if Allowed then
LEOAce = true
else
LEOAce = false
end
end)
FireAce = false
TriggerServerEvent('SEM_InteractionMenu:FirePerms')
RegisterNetEvent('SEM_InteractionMenu:FirePermsResult')
AddEventHandler('SEM_InteractionMenu:FirePermsResult', function(Allowed)
if Allowed then
FireAce = true
else
FireAce = false
end
end)
UnjailAllowed = false
TriggerServerEvent('SEM_InteractionMenu:UnjailPerms')
RegisterNetEvent('SEM_InteractionMenu:UnjailPermsResult')
AddEventHandler('SEM_InteractionMenu:UnjailPermsResult', function(Allowed)
if Allowed then
UnjailAllowed = true
else
UnjailAllowed = false
end
end)
UnhospitalAllowed = false
TriggerServerEvent('SEM_InteractionMenu:UnhospitalPerms')
RegisterNetEvent('SEM_InteractionMenu:UnhospitalPermsResult')
AddEventHandler('SEM_InteractionMenu:UnhospitalPermsResult', function(Allowed)
if Allowed then
UnhospitalAllowed = true
else
UnhospitalAllowed = false
end
end)
--Emote
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
if EmotePlaying then
if Config.EmoteHelp then
NotifyHelp('You are playing an Emote, ~b~Move to Cancel')
end
-- Spacebar W S A D
if (IsControlPressed(0, 22) or IsControlPressed(0, 32) or IsControlPressed(0, 33) or IsControlPressed(0, 34) or IsControlPressed(0, 35)) then
CancelEmote()
end
end
end
end)
--Commands
Citizen.CreateThread(function()
if EmoteRestrict() then
local Index = 0
local Emotes = ''
for _, Emote in pairs(Config.EmotesList) do
Index = Index + 1
if Index == 1 then
Emotes = Emotes .. Emote.name
else
Emotes = Emotes .. ', ' .. Emote.name
end
end
TriggerEvent('chat:addSuggestion', '/emotes', 'List of Current Avaliable Emotes')
TriggerEvent('chat:addSuggestion', '/emote', 'Play Emote', {{name = 'Emote Name', help = 'Emotes: ' .. Emotes}})
else
TriggerEvent('chat:removeSuggestion', '/emotes')
TriggerEvent('chat:removeSuggestion', '/emote')
end
TriggerEvent('chat:addSuggestion', '/eng', 'Toggles Engine')
TriggerEvent('chat:addSuggestion', '/hood', 'Toggles Vehicle\'s Hood')
TriggerEvent('chat:addSuggestion', '/trunk', 'Toggles Vehicle\'s Trunk')
TriggerEvent('chat:addSuggestion', '/clear', 'Clears all Weapons')
TriggerEvent('chat:addSuggestion', '/cuff', 'Cuff Player', {{name = 'ID', help = 'Players Server ID'}})
TriggerEvent('chat:addSuggestion', '/drag', 'Drag Player', {{name = 'ID', help = 'Players Server ID'}})
TriggerEvent('chat:addSuggestion', '/dropweapon', 'Drops Weapon in Hand')
TriggerEvent('chat:addSuggestion', '/loadout', 'Equips LEO Weapon Loadout')
TriggerEvent('chat:addSuggestion', '/coords', 'Shows Current Player Coords and Heading')
if Config.Radar ~= 0 then
TriggerEvent('chat:addSuggestion', '/radar', 'Toggle Radar Menu')
end
if Config.LEOAccess == 3 or Config.FireAccess == 3 then
if Config.OndutyPSWDActive then
TriggerEvent('chat:addSuggestion', '/onduty', 'Enable LEO/Fire Menu', {{name = 'Department', help = 'LEO or Fire'}, {name = 'Password', help = 'Onduty Password'}})
else
TriggerEvent('chat:addSuggestion', '/onduty', 'Enable LEO/Fire Menu', {{name = 'Department', help = 'LEO or Fire'}})
end
else
TriggerEvent('chat:removeSuggestion', '/onduty')
end
end)
LEOOnduty = false
FireOnduty = false
RegisterCommand('onduty', function(source, args, rawCommand)
if Config.LEOAccess == 3 or Config.FireAccess == 3 then
if Config.OndutyPSWDActive then
if args[2] == Config.OndutyPSWD then
local Department = args[1]:lower()
if Department == 'leo' then
LEOOnduty = not LEOOnduty
if LEOOnduty then
Notify('~g~You are onduty as an LEO')
else
Notify('~o~You are no longer onduty as an LEO')
end
elseif Department == 'fire' then
FireOnduty = not FireOnduty
if FireOnduty == true then
Notify('~g~You are onduty as an Firefighter')
else
Notify('~o~You are no longer onduty as an Firefighter')
end
else
Notify('~r~Invalid Department!')
end
else
Notify('~r~Incorrect Password')
end
else
local Department = args[1]:lower()
if Department == 'leo' then
LEOOnduty = not LEOOnduty
if LEOOnduty then
Notify('~g~You are onduty as an LEO')
else
Notify('~o~You are no longer onduty as an LEO')
end
elseif Department == 'fire' then
FireOnduty = not FireOnduty
if FireOnduty == true then
Notify('~g~You are onduty as an Firefighter')
else
Notify('~o~You are no longer onduty as an Firefighter')
end
else
Notify('~r~Invalid Department!')
end
end
end
end)
function IsOndutyLEO()
return LEOOnduty
end
function IsOndutyFire()
return FireOnduty
end
RegisterCommand('cuff', function(source, args, rawCommand)
if LEORestrict() or FireRestrict() then
if args[1] ~= nil then
local ID = tonumber(args[1])
if Config.CommandDistanceChecked then
if GetDistance(source) < Config.CommandDistance then
TriggerServerEvent('SEM_InteractionMenu:CuffNear', ID)
else
Notify('~r~That player is too far away')
end
else
TriggerServerEvent('SEM_InteractionMenu:CuffNear', ID)
end
else
TriggerServerEvent('SEM_InteractionMenu:CuffNear', GetClosestPlayer())
end
else
Notify('~r~Insufficient Permissions')
end
end)
RegisterCommand('drag', function(source, args, rawCommand)
if LEORestrict() or FireRestrict() then
if args[1] ~= nil then
local ID = tonumber(args[1])
if Config.CommandDistanceChecked then
if GetDistance(source) < Config.CommandDistance then
TriggerServerEvent('SEM_InteractionMenu:DragNear', ID)
else
Notify('~r~That player is too far away')
end
else
TriggerServerEvent('SEM_InteractionMenu:DragNear', ID)
end
else
TriggerServerEvent('SEM_InteractionMenu:DragNear', GetClosestPlayer())
end
else
Notify('~r~Insufficient Permissions')
end
end)
RegisterCommand('radar', function(source, args, rawCommand)
if Config.Radar ~= 0 then
if LEORestrict() or FireRestrict() then
ToggleRadar()
else
Notify('~r~Insufficient Permissions')
end
end
end)
RegisterCommand('loadout', function(source, args, rawCommand)
if LEORestrict() then
if args[1] then
local RequestedLoadout = args[1]
for Name, Loadout in pairs(Config.LEOLoadouts) do
if Name:lower() == RequestedLoadout:lower() then
SetEntityHealth(GetPlayerPed(-1), 200)
RemoveAllPedWeapons(GetPlayerPed(-1), true)
AddArmourToPed(GetPlayerPed(-1), 100)
for _, Weapon in pairs(Loadout) do
GiveWeapon(Weapon.weapon)
for _, Component in pairs(Weapon.components) do
AddWeaponComponent(Weapon.weapon, Component)
end
end
return
end
end
Notify('~r~Invalid Loadout')
else
SetEntityHealth(PlayerPedId(), 200)
RemoveAllPedWeapons(PlayerPedId(), true)
AddArmourToPed(PlayerPedId(), 100)
GiveWeapon('weapon_nightstick')
GiveWeapon('weapon_flashlight')
GiveWeapon('weapon_fireextinguisher')
GiveWeapon('weapon_flare')
GiveWeapon('weapon_stungun')
GiveWeapon('weapon_combatpistol')
AddWeaponComponent('weapon_combatpistol', 'component_at_pi_flsh')
Notify('~g~Loadout Spawned')
end
else
Notify('~r~You aren\'t an LEO')
end
end)
RegisterCommand('hu', function(source, args, rawCommand)
local Ped = PlayerPedId()
if DoesEntityExist(Ped) and not HandCuffed then
Citizen.CreateThread(function()
LoadAnimation('random@mugging3')
if IsEntityPlayingAnim(Ped, 'random@mugging3', 'handsup_standing_base', 3) or HandCuffed then
ClearPedSecondaryTask(Ped)
SetEnableHandcuffs(Ped, false)
elseif not IsEntityPlayingAnim(Ped, 'random@mugging3', 'handsup_standing_base', 3) or not HandCuffed then
TaskPlayAnim(Ped, 'random@mugging3', 'handsup_standing_base', 8.0, -8, -1, 49, 0, 0, 0, 0)
SetEnableHandcuffs(Ped, true)
end
end)
end
end)
RegisterCommand('huk', function(source, args, rawCommand)
local Ped = PlayerPedId()
if (DoesEntityExist(Ped) and not IsEntityDead(Ped)) and not HandCuffed then
Citizen.CreateThread(function()
LoadAnimation('random@arrests')
if (IsEntityPlayingAnim(Ped, 'random@arrests', 'kneeling_arrest_idle', 3)) then
TaskPlayAnim(Ped, 'random@arrests', 'kneeling_arrest_get_up', 8.0, 1.0, -1, 128, 0, 0, 0, 0)
else
TaskPlayAnim(Ped, 'random@arrests', 'idle_2_hands_up', 8.0, 1.0, -1, 2, 0, 0, 0, 0)
Wait (4000)
TaskPlayAnim(Ped, 'random@arrests', 'kneeling_arrest_idle', 8.0, 1.0, -1, 2, 0, 0, 0, 0)
end
end)
end
end)
RegisterCommand('dropweapon', function(source, args, rawCommand)
local CurrentWeapon = GetSelectedPedWeapon(PlayerPedId())
SetPedDropsInventoryWeapon(PlayerPedId(), CurrentWeapon, -2.0, 0.0, 0.5, 30)
Notify('~r~Weapon Dropped!')
end)
RegisterCommand('clear', function(source, args, rawCommand)
SetEntityHealth(PlayerPedId(), 200)
RemoveAllPedWeapons(PlayerPedId(), true)
Notify('~r~All Weapons Cleared!')
end)
RegisterCommand('eng', function(source, args, rawCommand)
local Veh = GetVehiclePedIsIn(PlayerPedId(), false)
if Veh ~= nil and Veh ~= 0 and GetPedInVehicleSeat(Veh, 0) then
SetVehicleEngineOn(Veh, (not GetIsVehicleEngineRunning(Veh)), false, true)
Notify('~g~Engine Toggled!')
end
end)
RegisterCommand('hood', function(source, args, rawCommand)
local Veh = GetVehiclePedIsIn(PlayerPedId(), false)
if Veh ~= nil and Veh ~= 0 and Veh ~= 1 then
if GetVehicleDoorAngleRatio(Veh, 4) > 0 then
SetVehicleDoorShut(Veh, 4, false)
else
SetVehicleDoorOpen(Veh, 4, false, false)
end
end
Notify('~g~Hood Toggled!')
end)
RegisterCommand('trunk', function(source, args, rawCommand)
local Veh = GetVehiclePedIsIn(PlayerPedId(), false)
if Veh ~= nil and Veh ~= 0 and Veh ~= 1 then
if GetVehicleDoorAngleRatio(Veh, 5) > 0 then
SetVehicleDoorShut(Veh, 5, false)
else
SetVehicleDoorOpen(Veh, 5, false, false)
end
end
Notify('~g~Trunk Toggled!')
end)
RegisterCommand('emotes', function(source, args, rawCommand)
if EmoteRestrict() then
local Index = 0
local Emotes = ''
for _, Emote in pairs(Config.EmotesList) do
Index = Index + 1
if Index == 1 then
Emotes = Emotes .. Emote.name
else
Emotes = Emotes .. ', ' .. Emote.name
end
end
TriggerEvent('chat:addMessage', {
multiline = true,
color = {255, 0 ,0},
args = {'Emotes', '\n^r^7' .. Emotes},
})
end
end)
RegisterCommand('emote', function(source, args, rawCommand)
if EmoteRestrict() then
local SelectedEmote = args[1]
for _, Emote in pairs(Config.EmotesList) do
if Emote.name == SelectedEmote then
PlayEmote(Emote.emote, Emote.name)
return
end
end
TriggerEvent('chat:addMessage', {
multiline = true,
color = {255, 0, 0},
args = {'Emotes', 'Invalid Emote!'},
})
end
end)
RegisterCommand('coords', function(source, args, rawCommand)
local Coords = GetEntityCoords(PlayerPedId())
local Heading = GetEntityHeading(PlayerPedId())
TriggerEvent('chatMessage', 'Coords', {255, 255, 0}, '\nX: ' .. Coords.x .. '\nY: ' .. Coords.y .. '\nZ: ' .. Coords.z .. '\nHeading: ' .. Heading)
end)