-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEntity.lua
More file actions
2489 lines (2025 loc) · 79.4 KB
/
Copy pathEntity.lua
File metadata and controls
2489 lines (2025 loc) · 79.4 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
------------------------------------------
-- Entity Options
------------------------------------------
local Entity_Options <const> = menu.list(Menu_Root, "实体选项", {}, "")
--#region Entity NPC Options
local Entity_NPC_Options <const> = menu.list(Entity_Options, "NPC选项", {}, "")
local EntityNPC = {
ped_select = 1,
}
function EntityNPC.checkPed(ped, pedTypeSelect)
if is_player_ped(ped) then
return false
end
if pedTypeSelect == 1 and not is_friendly_ped(ped) then
return true
end
if pedTypeSelect == 2 and is_hostile_ped(ped) then
return true
end
if pedTypeSelect == 3 then
return true
end
return false
end
menu.divider(Entity_NPC_Options, "全部NPC")
menu.list_select(Entity_NPC_Options, "NPC类型", {}, "", Misc_T.PedType, 1, function(value)
EntityNPC.ped_select = value
end)
menu.action(Entity_NPC_Options, "删除", { "delPed" }, "", function()
for _, ped in pairs(entities.get_all_peds_as_handles()) do
if EntityNPC.checkPed(ped, EntityNPC.ped_select) then
entities.delete(ped)
end
end
end)
menu.action(Entity_NPC_Options, "死亡", { "deadPed" }, "", function()
for _, ped in pairs(entities.get_all_peds_as_handles()) do
if not ENTITY.IS_ENTITY_DEAD(ped) and EntityNPC.checkPed(ped, EntityNPC.ped_select) then
SET_ENTITY_HEALTH(ped, 0)
end
end
end)
menu.action(Entity_NPC_Options, "爆头击杀", { "killPed" }, "", function()
local weaponHash = util.joaat("WEAPON_APPISTOL")
for _, ped in pairs(entities.get_all_peds_as_handles()) do
if not ENTITY.IS_ENTITY_DEAD(ped) and EntityNPC.checkPed(ped, EntityNPC.ped_select) then
shoot_ped_head(ped, weaponHash, players.user_ped())
end
end
end)
menu.divider(Entity_NPC_Options, "警察和特警")
menu.toggle_loop(Entity_NPC_Options, "删除", { "delCops" }, "", function()
for _, ped_ptr in pairs(entities.get_all_peds_as_pointers()) do
local hash = entities.get_model_hash(ped_ptr)
if hash == 1581098148 or hash == -1320879687 or hash == -1920001264 then
entities.delete(ped_ptr)
end
end
end)
menu.toggle_loop(Entity_NPC_Options, "死亡", { "deadCops" }, "", function()
for _, ped_ptr in pairs(entities.get_all_peds_as_pointers()) do
local hash = entities.get_model_hash(ped_ptr)
if hash == 1581098148 or hash == -1320879687 or hash == -1920001264 then
rs_memory.set_entity_health(ped_ptr, 0)
end
end
end)
menu.divider(Entity_NPC_Options, "友方NPC")
menu.action(Entity_NPC_Options, "无敌强化", { "strongFriendlyPed" }, "", function()
for _, ent in pairs(entities.get_all_peds_as_handles()) do
if not ENTITY.IS_ENTITY_DEAD(ent) and not is_player_ped(ent) then
local rel = PED.GET_RELATIONSHIP_BETWEEN_PEDS(ent, players.user_ped())
if rel == 0 or rel == 1 then -- Respect or Like
increase_ped_combat_ability(ent, true)
increase_ped_combat_attributes(ent)
end
end
end
end)
menu.list_action(Entity_NPC_Options, "给予武器", {}, "", RS_T.CommonWeapons, function(value)
local weaponHash = value
for _, ent in pairs(entities.get_all_peds_as_handles()) do
if not ENTITY.IS_ENTITY_DEAD(ent) and not is_player_ped(ent) then
local rel = PED.GET_RELATIONSHIP_BETWEEN_PEDS(ent, players.user_ped())
if rel == 0 or rel == 1 then -- Respect or Like
WEAPON.GIVE_WEAPON_TO_PED(ent, weaponHash, 9999, false, true)
WEAPON.SET_CURRENT_PED_WEAPON(ent, weaponHash, false)
end
end
end
end)
--#endregion
--#region NPC Weak Options
local NPC_Weak_Options <const> = menu.list(Entity_Options, "弱化NPC选项", {}, "")
EntityNPC.Weak = {
ped_select = 1,
time_delay = 2000,
toggle = {
health = false,
weapon_damage = true,
vehicle_weapon = false,
deaf_blind = false,
},
}
menu.list_select(NPC_Weak_Options, "NPC类型", {}, "", Misc_T.PedType, 1, function(value)
EntityNPC.Weak.ped_select = value
end)
menu.toggle_loop(NPC_Weak_Options, "弱化", { "WeakPed" }, "", function()
local weak_health = 100
local weak_weapon_damage = 0.01
for _, ped in pairs(entities.get_all_peds_as_handles()) do
if not ENTITY.IS_ENTITY_DEAD(ped) and EntityNPC.checkPed(ped, EntityNPC.Weak.ped_select) then
if EntityNPC.Weak.toggle.health then
if ENTITY.GET_ENTITY_HEALTH(ped) > weak_health then
SET_ENTITY_HEALTH(ped, weak_health)
end
end
if EntityNPC.Weak.toggle.weapon_damage then
PED.SET_COMBAT_FLOAT(ped, 29, weak_weapon_damage) -- WEAPON_DAMAGE_MODIFIER
end
PED.SET_PED_SHOOT_RATE(ped, 0)
PED.SET_PED_ACCURACY(ped, 0)
PED.SET_COMBAT_FLOAT(ped, 6, 0.0) -- WEAPON_ACCURACY
PED.SET_PED_COMBAT_ABILITY(ped, 0)
PED.STOP_PED_WEAPON_FIRING_WHEN_DROPPED(ped)
PED.DISABLE_PED_INJURED_ON_GROUND_BEHAVIOUR(ped)
if EntityNPC.Weak.toggle.vehicle_weapon then
if PED.IS_PED_IN_ANY_VEHICLE(ped, false) then
local ped_veh = PED.GET_VEHICLE_PED_IS_IN(ped, false)
if VEHICLE.DOES_VEHICLE_HAVE_WEAPONS(ped_veh) then
local veh_weapon_hash = get_ped_vehicle_weapon(ped)
if veh_weapon_hash ~= 0 then
VEHICLE.DISABLE_VEHICLE_WEAPON(true, veh_weapon_hash, ped_veh, ped)
end
end
end
end
if EntityNPC.Weak.toggle.deaf_blind then
PED.SET_PED_HIGHLY_PERCEPTIVE(ped, false)
PED.SET_PED_VISUAL_FIELD_PERIPHERAL_RANGE(ped, 0.0)
PED.SET_PED_SEEING_RANGE(ped, 0.0)
PED.SET_PED_HEARING_RANGE(ped, 0.0)
PED.SET_PED_ID_RANGE(ped, 0.0)
PED.SET_PED_VISUAL_FIELD_MIN_ANGLE(ped, 0.0)
PED.SET_PED_VISUAL_FIELD_MAX_ANGLE(ped, 0.0)
PED.SET_PED_VISUAL_FIELD_MIN_ELEVATION_ANGLE(ped, 0.0)
PED.SET_PED_VISUAL_FIELD_MAX_ELEVATION_ANGLE(ped, 0.0)
PED.SET_PED_VISUAL_FIELD_CENTER_ANGLE(ped, 0.0)
end
end
end
util.yield(EntityNPC.Weak.time_delay)
end)
menu.divider(NPC_Weak_Options, "设置")
menu.toggle(NPC_Weak_Options, "弱化血量", {}, "修改血量为: 100", function(toggle)
EntityNPC.Weak.toggle.health = toggle
end)
menu.toggle(NPC_Weak_Options, "弱化武器伤害", {}, "修改武器伤害为: 0.01", function(toggle)
EntityNPC.Weak.toggle.weapon_damage = toggle
end, true)
menu.toggle(NPC_Weak_Options, "禁用载具武器", {}, "", function(toggle)
EntityNPC.Weak.toggle.vehicle_weapon = toggle
end)
menu.toggle(NPC_Weak_Options, "变成聋瞎", {}, "", function(toggle)
EntityNPC.Weak.toggle.deaf_blind = toggle
end)
menu.slider(NPC_Weak_Options, "循环间隔", { "setting_weak_ped_time_delay" }, "单位: 毫秒",
0, 5000, 2000, 100, function(value)
EntityNPC.Weak.time_delay = value
end)
menu.divider(NPC_Weak_Options, "其它(默认设置)")
menu.readonly(NPC_Weak_Options, "射击频率", "0")
menu.readonly(NPC_Weak_Options, "精准度", "0")
menu.readonly(NPC_Weak_Options, "作战技能", "弱")
menu.readonly(NPC_Weak_Options, "禁止武器掉落时走火", "是")
menu.readonly(NPC_Weak_Options, "禁止受伤倒地时的行为", "是")
--#endregion
--#region Entity Hostile Options
local Entity_Hostile_Options <const> = menu.list(Entity_Options, "敌对实体选项", {}, "")
menu.action(Entity_Hostile_Options, "爆炸敌对NPC", { "hPedExplode" }, "", function()
explode_hostile_peds()
end)
menu.action(Entity_Hostile_Options, "爆炸敌对载具", { "hVehExplode" }, "", function()
explode_hostile_vehicles()
end)
menu.action(Entity_Hostile_Options, "爆炸敌对物体", { "hObjExplode" }, "", function()
explode_hostile_objects()
end)
menu.divider(Entity_Hostile_Options, "")
menu.action(Entity_Hostile_Options, "破坏敌对载具引擎", { "hVehKillEngine" }, "", function()
for _, vehicle in pairs(entities.get_all_vehicles_as_handles()) do
if is_hostile_entity(vehicle) then
VEHICLE.SET_VEHICLE_ENGINE_HEALTH(vehicle, -4000.0)
end
end
end)
menu.action(Entity_Hostile_Options, "杀死敌对物体", { "hObjKill" }, "", function()
for _, object in pairs(entities.get_all_objects_as_handles()) do
if is_hostile_entity(object) then
SET_ENTITY_HEALTH(object, 0)
end
end
end)
--#endregion
--#region Entity Vehicle Options
local Entity_Vehicle_Options <const> = menu.list(Entity_Options, "载具选项", {}, "")
local EntityVehicle = {
exceptPlayer = false,
}
function EntityVehicle.checkVehicle(vehicle)
if EntityVehicle.exceptPlayer and is_player_vehicle(vehicle) then
return false
end
return true
end
menu.divider(Entity_Vehicle_Options, "全部载具")
menu.action(Entity_Vehicle_Options, "解锁车门和打开引擎", { "unlockVehsDoor" }, "", function()
for _, vehicle in pairs(entities.get_all_vehicles_as_handles()) do
if EntityVehicle.checkVehicle(vehicle) then
unlock_vehicle_doors(vehicle)
VEHICLE.SET_VEHICLE_UNDRIVEABLE(vehicle, false)
VEHICLE.SET_VEHICLE_ENGINE_ON(vehicle, true, true, false)
clear_vehicle_wanted(vehicle)
ENTITY.FREEZE_ENTITY_POSITION(vehicle, false)
end
end
end)
menu.action(Entity_Vehicle_Options, "打开左右车门和引擎", { "openVehsDoor" }, "", function()
for _, vehicle in pairs(entities.get_all_vehicles_as_handles()) do
if EntityVehicle.checkVehicle(vehicle) then
VEHICLE.SET_VEHICLE_ENGINE_ON(vehicle, true, true, false)
VEHICLE.SET_VEHICLE_DOOR_OPEN(vehicle, 0, false, false)
VEHICLE.SET_VEHICLE_DOOR_OPEN(vehicle, 1, false, false)
end
end
end)
menu.action(Entity_Vehicle_Options, "拆下左右车门和打开引擎", { "brokenVehsDoor" }, "", function()
for _, vehicle in pairs(entities.get_all_vehicles_as_handles()) do
if EntityVehicle.checkVehicle(vehicle) then
VEHICLE.SET_VEHICLE_ENGINE_ON(vehicle, true, true, false)
VEHICLE.SET_VEHICLE_DOOR_BROKEN(vehicle, 0, false)
VEHICLE.SET_VEHICLE_DOOR_BROKEN(vehicle, 1, false)
end
end
end)
menu.toggle_loop(Entity_Vehicle_Options, "按F解锁附近载具车门", { "fOpenVeh" }, "", function()
-- INPUT_ENTER 23
if PAD.IS_CONTROL_PRESSED(0, 23) and not PED.IS_PED_IN_ANY_VEHICLE(players.user_ped(), false) then
for _, vehicle in pairs(entities.get_all_vehicles_as_handles()) do
if EntityVehicle.checkVehicle(vehicle) then
unlock_vehicle_doors(vehicle)
VEHICLE.SET_VEHICLE_UNDRIVEABLE(vehicle, false)
VEHICLE.SET_VEHICLE_ENGINE_ON(vehicle, true, true, false)
clear_vehicle_wanted(vehicle)
ENTITY.FREEZE_ENTITY_POSITION(vehicle, false)
end
end
end
end)
menu.divider(Entity_Vehicle_Options, "设置")
menu.toggle(Entity_Vehicle_Options, "排除 玩家载具", {}, "", function(toggle)
EntityVehicle.exceptPlayer = toggle
end, EntityVehicle.exceptPlayer)
--#endregion
--#region Entity Pickup Options
local Entity_Pickup_Options <const> = menu.list(Entity_Options, "拾取物选项", {}, "")
local EntityPickup = {
mission = true,
}
menu.toggle(Entity_Pickup_Options, "任务拾取物", {}, "", function(toggle)
EntityPickup.mission = toggle
end, true)
menu.action(Entity_Pickup_Options, "全部传送到我", { "tpmePickups" }, "", function()
for _, pickup in pairs(entities.get_all_pickups_as_handles()) do
if EntityPickup.mission and not ENTITY.IS_ENTITY_A_MISSION_ENTITY(pickup) then
goto continue
end
OBJECT.SET_PICKUP_OBJECT_COLLECTABLE_IN_VEHICLE(pickup)
tp_entity_to_me(pickup)
::continue::
end
end)
--#endregion
--#region Entity Object Options
local Entity_Object_Options <const> = menu.list(Entity_Options, "摄像头和门", {}, "")
menu.divider(Entity_Object_Options, "摄像头")
local Cams <const> = {
548760764, --prop_cctv_cam_01a
-354221800, --prop_cctv_cam_01b
-1159421424, --prop_cctv_cam_02a
1449155105, --prop_cctv_cam_03a
-1095296451, --prop_cctv_cam_04a
-1884701657, --prop_cctv_cam_04c
-173206916, --prop_cctv_cam_05a
168901740, --prop_cctv_cam_06a
-1340405475, --prop_cctv_cam_07a
2090203758, --prop_cs_cctv
289451089, --p_cctv_s
-1007354661, --hei_prop_bank_cctv_01
-1842407088, --hei_prop_bank_cctv_02
-1233322078, --ch_prop_ch_cctv_cam_02a
-247409812, --xm_prop_x17_server_farm_cctv_01
2135655372 --prop_cctv_pole_04
}
local Cams2 <const> = {
1919058329, --prop_cctv_cam_04b
1849991131 --prop_snow_cam_03a
}
menu.action(Entity_Object_Options, "删除", { "delCams" }, "", function()
for _, ent_ptr in pairs(entities.get_all_objects_as_pointers()) do
local model_hash = entities.get_model_hash(ent_ptr)
if table.contains(Cams, model_hash) then
entities.delete(ent_ptr)
end
end
end)
menu.click_slider(Entity_Object_Options, "上下移动", { "moveCams" }, "易导致bug",
-30, 30, 0, 1, function(value)
for _, ent_ptr in pairs(entities.get_all_objects_as_pointers()) do
local model_hash = entities.get_model_hash(ent_ptr)
if table.contains(Cams, model_hash) then
local ent = entities.pointer_to_handle(ent_ptr)
set_entity_move(ent, 0.0, 0.0, value)
end
end
end)
menu.divider(Entity_Object_Options, "佩里科岛的门(本地有效)")
local CayoPericoDoors <const> = {
-- 豪宅内 各种铁门
-1052729812, -- h4_prop_h4_gate_l_01a
1866987242, -- h4_prop_h4_gate_r_01a
-1360938964, -- h4_prop_h4_gate_02a
-2058786200, -- h4_prop_h4_gate_03a
-630812075, -- h4_prop_h4_gate_05a
-- 豪宅内 电梯门
-1240156945, -- v_ilev_garageliftdoor
-576022807, -- h4_prop_office_elevator_door_01
-- 豪宅大门
-1574151574, -- h4_prop_h4_gate_r_03a
1215477734, -- h4_prop_h4_gate_l_03a
-- 豪宅外 铁门
227019171, -- prop_fnclink_02gate6_r
1526539404, -- prop_fnclink_02gate6_l
141297241, -- h4_prop_h4_garage_door_01a
-1156020871 -- prop_fnclink_03gate5
}
local CayoPericoDoors2 <const> = -607013269 -- h4_prop_h4_door_01a 豪宅内的库房门
menu.action(Entity_Object_Options, "删除门", { "deletePericoDoors" }, "", function()
for _, ent_ptr in pairs(entities.get_all_objects_as_pointers()) do
local model_hash = entities.get_model_hash(ent_ptr)
if table.contains(CayoPericoDoors, model_hash) then
entities.delete(ent_ptr)
end
end
end)
menu.action(Entity_Object_Options, "开启无碰撞", {}, "可以直接穿过门,包括库房门", function()
for _, ent_ptr in pairs(entities.get_all_objects_as_pointers()) do
local model_hash = entities.get_model_hash(ent_ptr)
if model_hash == CayoPericoDoors2 or table.contains(CayoPericoDoors, model_hash) then
local ent = entities.pointer_to_handle(ent_ptr)
ENTITY.SET_ENTITY_COLLISION(ent, false, true)
end
end
end)
menu.action(Entity_Object_Options, "关闭无碰撞", {}, "", function()
for _, ent_ptr in pairs(entities.get_all_objects_as_pointers()) do
local model_hash = entities.get_model_hash(ent_ptr)
if model_hash == CayoPericoDoors2 or table.contains(CayoPericoDoors, model_hash) then
local ent = entities.pointer_to_handle(ent_ptr)
ENTITY.SET_ENTITY_COLLISION(ent, true, true)
end
end
end)
--#endregion
--#region Nearby Area Options
local Nearby_Area_Options <const> = menu.list(Entity_Options, "附近区域选项", {}, "")
local NearbyArea = {
radius = 100.0,
target = {
ped = 2,
vehicle = 1,
object = 1,
},
except = {
dead = true,
mission = false,
},
}
function NearbyArea.CheckDistance(entity, playerPos)
local radius = NearbyArea.radius
if radius <= 0 then
return true
end
if v3.distance(ENTITY.GET_ENTITY_COORDS(entity), playerPos) <= radius then
return true
end
return false
end
function NearbyArea.CheckExcept(entity)
if NearbyArea.except.dead and ENTITY.IS_ENTITY_DEAD(entity) then
return false
end
if NearbyArea.except.mission and ENTITY.IS_ENTITY_A_MISSION_ENTITY(entity) then
return false
end
return true
end
function NearbyArea.CheckPed(ped)
if not NearbyArea.CheckExcept(ped) then
return false
end
if is_player_ped(ped) then
return false
end
local target_select = NearbyArea.target.ped
if target_select == 2 and not is_friendly_ped(ped) then
return true
end
if target_select == 3 and is_hostile_ped(ped) then
return true
end
if target_select == 4 and not PED.IS_PED_IN_ANY_VEHICLE(ped, false) then
return true
end
if target_select == 5 and PED.IS_PED_IN_ANY_VEHICLE(ped, false) then
return true
end
if target_select == 6 then
return true
end
return false
end
function NearbyArea.CheckVehicle(vehicle)
if not NearbyArea.CheckExcept(vehicle) then
return false
end
if is_player_vehicle(vehicle) then
return false
end
local target_select = NearbyArea.target.vehicle
if target_select == 2 then
return true
end
if target_select == 3 and is_hostile_entity(vehicle) then
return true
end
if target_select == 4 and not VEHICLE.IS_VEHICLE_SEAT_FREE(vehicle, -1, false) then
return true
end
if target_select == 5 and VEHICLE.IS_VEHICLE_SEAT_FREE(vehicle, -1, false) then
return true
end
return false
end
function NearbyArea.CheckObject(object)
if not NearbyArea.CheckExcept(object) then
return false
end
local target_select = NearbyArea.target.object
if target_select == 4 and ENTITY.IS_ENTITY_A_MISSION_ENTITY(object) then
return true
end
local blip = HUD.GET_BLIP_FROM_ENTITY(object)
if not HUD.DOES_BLIP_EXIST(blip) then
return false
end
if target_select == 2 and is_hostile_entity(object) then
return true
end
if target_select == 3 then
return true
end
return false
end
function NearbyArea.GetEntities()
local entity_list = {}
local player_pos = ENTITY.GET_ENTITY_COORDS(players.user_ped())
if NearbyArea.target.ped > 1 then
for _, ent in pairs(entities.get_all_peds_as_handles()) do
if NearbyArea.CheckDistance(ent, player_pos) then
if NearbyArea.CheckPed(ent) then
table.insert(entity_list, ent)
end
end
end
end
if NearbyArea.target.vehicle > 1 then
for _, ent in pairs(entities.get_all_vehicles_as_handles()) do
if NearbyArea.CheckDistance(ent, player_pos) then
if NearbyArea.CheckVehicle(ent) then
table.insert(entity_list, ent)
end
end
end
end
if NearbyArea.target.object > 1 then
for _, ent in pairs(entities.get_all_objects_as_handles()) do
if NearbyArea.CheckDistance(ent, player_pos) then
if NearbyArea.CheckObject(ent) then
table.insert(entity_list, ent)
end
end
end
end
return entity_list
end
----------------
-- Setting
----------------
menu.slider_float(Nearby_Area_Options, "范围半径", { "radius_nearby_area" }, "",
0, 100000, 10000, 1000, function(value)
NearbyArea.radius = value * 0.01
end)
menu.toggle_loop(Nearby_Area_Options, "绘制范围", {}, "", function()
local coords = ENTITY.GET_ENTITY_COORDS(players.user_ped())
DRAW_MARKER_SPHERE(coords, NearbyArea.radius)
end)
local Nearby_Area_Setting <const> = menu.list(Nearby_Area_Options, "设置", {}, "")
menu.divider(Nearby_Area_Setting, "目标")
menu.list_select(Nearby_Area_Setting, "NPC", {}, "", {
{ 1, "关闭", },
{ 2, "全部NPC (排除友好)", },
{ 3, "敌对NPC", },
{ 4, "步行NPC", },
{ 5, "载具内NPC", },
{ 6, "全部NPC", },
}, 2, function(value)
NearbyArea.target.ped = value
end)
menu.list_select(Nearby_Area_Setting, "载具", {}, "默认排除玩家载具", {
{ 1, "关闭", },
{ 2, "全部载具", {}, "" },
{ 3, "敌对载具", {}, "敌对NPC驾驶或者有敌对地图标识的载具" },
{ 4, "NPC载具", {}, "有NPC作为司机驾驶的载具" },
{ 5, "空载具", {}, "没有任何NPC驾驶的载具" },
}, 1, function(value)
NearbyArea.target.vehicle = value
end)
menu.list_select(Nearby_Area_Setting, "物体", {}, "", {
{ 1, "关闭" },
{ 2, "敌对物体", {}, "有敌对地图标记点的物体" },
{ 3, "标记点物体", {}, "有地图标记点的物体" },
{ 4, "任务物体", {}, "" },
}, 1, function(value)
NearbyArea.target.object = value
end)
menu.divider(Nearby_Area_Setting, "排除")
menu.toggle(Nearby_Area_Setting, "排除 死亡实体", {}, "", function(toggle)
NearbyArea.except.dead = toggle
end, true)
menu.toggle(Nearby_Area_Setting, "排除 任务实体", {}, "", function(toggle)
NearbyArea.except.mission = toggle
end)
menu.divider(Nearby_Area_Options, "")
--#region Nearby Area Shoot
local Nearby_Area_Shoot <const> = menu.list(Nearby_Area_Options, "射击区域", {}, "若半径是0,则为全部范围")
local NearbyAreaShoot = {
shootPedHead = true,
weaponHash = "PLAYER_CURRENT_WEAPON",
isOwned = true,
damage = 1000,
speed = 2000,
perfectAccuracy = true,
createTraceVfx = true,
allowRumble = true,
startFromPlayer = false,
offset = v3(0, 0, 0.1),
delay = 1000,
}
function NearbyAreaShoot.Shoot(startPos, endPos, weaponHash, targetEntity)
local owner = 0
if NearbyAreaShoot.isOwned then
owner = players.user_ped()
end
local ignoreEntity = entities.get_user_vehicle_as_handle(false)
if ignoreEntity == INVALID_GUID then
ignoreEntity = players.user_ped()
end
MISC.SHOOT_SINGLE_BULLET_BETWEEN_COORDS_IGNORE_ENTITY(
startPos.x, startPos.y, startPos.z,
endPos.x, endPos.y, endPos.z,
NearbyAreaShoot.damage,
NearbyAreaShoot.perfectAccuracy,
weaponHash,
owner,
NearbyAreaShoot.createTraceVfx,
NearbyAreaShoot.allowRumble,
NearbyAreaShoot.speed,
ignoreEntity,
targetEntity)
end
function NearbyAreaShoot.Handle(action)
local user_ped = players.user_ped()
local weaponHash = NearbyAreaShoot.weaponHash
if weaponHash == "PLAYER_CURRENT_WEAPON" then
weaponHash = WEAPON.GET_SELECTED_PED_WEAPON(user_ped)
end
if not WEAPON.HAS_WEAPON_ASSET_LOADED(weaponHash) then
request_weapon_asset(weaponHash)
end
local player_pos = ENTITY.GET_ENTITY_COORDS(user_ped)
local offset = NearbyAreaShoot.offset
local start_pos, ent_pos
for _, ent in pairs(NearbyArea.GetEntities()) do
ent_pos = ENTITY.GET_ENTITY_COORDS(ent)
if ENTITY.IS_ENTITY_A_PED(ent) and NearbyAreaShoot.shootPedHead then
ent_pos = PED.GET_PED_BONE_COORDS(ent, 0x322c, 0, 0, 0)
end
if NearbyAreaShoot.startFromPlayer then
start_pos = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(user_ped, offset.x, offset.y, offset.z)
elseif ENTITY.IS_ENTITY_A_PED(ent) and NearbyAreaShoot.shootPedHead then
-- offsetX: up/down, offsetY: forward/backward, offsetZ: left/right
start_pos = PED.GET_PED_BONE_COORDS(ent, 0x322c, offset.z, offset.y, offset.x)
else
start_pos = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, offset.x, offset.y, offset.z)
end
if action == "drawline" then
DRAW_LINE(start_pos, ent_pos)
else
NearbyAreaShoot.Shoot(start_pos, ent_pos, weaponHash, ent)
end
end
end
----------------
-- Setting
----------------
local Nearby_Area_ShootSetting <const> = menu.list(Nearby_Area_Shoot, "设置", {}, "")
menu.toggle(Nearby_Area_ShootSetting, "射击NPC头部", {}, "", function(toggle)
NearbyAreaShoot.shootPedHead = toggle
end, true)
local Nearby_Area_ShootWeapon <const> = rs_menu.all_weapons_without_melee(Nearby_Area_ShootSetting, "武器", {}, "",
function(hash)
NearbyAreaShoot.weaponHash = hash
end, true)
rs_menu.current_weapon_action(Nearby_Area_ShootWeapon, "玩家当前使用的武器", function()
NearbyAreaShoot.weaponHash = "PLAYER_CURRENT_WEAPON"
end, true)
menu.toggle(Nearby_Area_ShootSetting, "署名射击", {}, "以玩家名义", function(toggle)
NearbyAreaShoot.isOwned = toggle
end, true)
menu.slider(Nearby_Area_ShootSetting, "伤害", { "nearby_area_shoot_damage" }, "", 0, 10000, 1000, 100,
function(value)
NearbyAreaShoot.damage = value
end)
menu.slider(Nearby_Area_ShootSetting, "速度", { "nearby_area_shoot_speed" }, "", 0, 10000, 2000, 100,
function(value)
NearbyAreaShoot.speed = value
end)
menu.divider(Nearby_Area_ShootSetting, "起始射击位置偏移")
menu.toggle(Nearby_Area_ShootSetting, "从玩家位置起始射击", {},
"如果关闭,则起始位置为目标位置+偏移\n如果开启,建议偏移Z>1.0", function(toggle)
NearbyAreaShoot.startFromPlayer = toggle
end)
menu.slider_float(Nearby_Area_ShootSetting, "左/右", { "nearby_area_shoot_x" }, "", -10000, 10000, 0, 10,
function(value)
NearbyAreaShoot.offset.x = value * 0.01
end)
menu.slider_float(Nearby_Area_ShootSetting, "前/后", { "nearby_area_shoot_y" }, "", -10000, 10000, 0, 10,
function(value)
NearbyAreaShoot.offset.y = value * 0.01
end)
menu.slider_float(Nearby_Area_ShootSetting, "上/下", { "nearby_area_shoot_z" }, "", -10000, 10000, 10, 10,
function(value)
NearbyAreaShoot.offset.z = value * 0.01
end)
----------------
-- Main
----------------
menu.toggle_loop(Nearby_Area_Shoot, "绘制模拟射击连线", {}, "", function()
NearbyAreaShoot.Handle("drawline")
end)
menu.divider(Nearby_Area_Shoot, "")
menu.action(Nearby_Area_Shoot, "射击", { "shoot_nearby_area" }, "", function()
NearbyAreaShoot.Handle()
end)
menu.slider(Nearby_Area_Shoot, "循环延迟", { "nearby_area_shoot_delay" }, "单位: ms",
0, 5000, 1000, 100, function(value)
NearbyAreaShoot.delay = value
end)
menu.toggle_loop(Nearby_Area_Shoot, "循环射击", {}, "", function()
NearbyAreaShoot.Handle()
util.yield(NearbyAreaShoot.delay)
end)
--#endregion Nearby Area Shoot
--#region Nearby Area Explosion
local Nearby_Area_Explosion <const> = menu.list(Nearby_Area_Options, "爆炸区域", {}, "若半径是0,则为全部范围")
local NearbyAreaExplosion = {
explosionType = 2,
isOwned = true,
damage = 1000,
isAudible = true,
isInvisible = false,
cameraShake = 0,
offset = v3(0, 0, 0),
delay = 1000,
}
function NearbyAreaExplosion.Explosion(pos)
if NearbyAreaExplosion.isOwned then
FIRE.ADD_OWNED_EXPLOSION(players.user_ped(),
pos.x, pos.y, pos.z,
NearbyAreaExplosion.explosionType,
NearbyAreaExplosion.damage,
NearbyAreaExplosion.isAudible,
NearbyAreaExplosion.isInvisible,
NearbyAreaExplosion.cameraShake)
else
FIRE.ADD_EXPLOSION(pos.x, pos.y, pos.z,
NearbyAreaExplosion.explosionType,
NearbyAreaExplosion.damage,
NearbyAreaExplosion.isAudible,
NearbyAreaExplosion.isInvisible,
NearbyAreaExplosion.cameraShake,
false)
end
end
function NearbyAreaExplosion.Handle(action)
local player_pos = ENTITY.GET_ENTITY_COORDS(players.user_ped())
local offset = NearbyAreaExplosion.offset
for _, ent in pairs(NearbyArea.GetEntities()) do
local ent_pos = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, offset.x, offset.y, offset.z)
if action == "drawline" then
DRAW_LINE(player_pos, ent_pos)
else
NearbyAreaExplosion.Explosion(ent_pos)
end
end
end
----------------
-- Setting
----------------
local Nearby_Area_ExplosionSetting <const> = menu.list(Nearby_Area_Explosion, "设置", {}, "")
menu.list_select(Nearby_Area_ExplosionSetting, "爆炸类型", {}, "", Misc_T.ExplosionType, 4, function(value)
NearbyAreaExplosion.explosionType = value
end)
menu.toggle(Nearby_Area_ExplosionSetting, "署名爆炸", {}, "以玩家名义", function(toggle)
NearbyAreaExplosion.isOwned = toggle
end, true)
menu.slider(Nearby_Area_ExplosionSetting, "伤害", { "nearby_area_explosion_damage" }, "", 0, 10000, 1000, 100,
function(value)
NearbyAreaExplosion.damage = value
end)
menu.toggle(Nearby_Area_ExplosionSetting, "可听见", {}, "", function(toggle)
NearbyAreaExplosion.isAudible = toggle
end, true)
menu.toggle(Nearby_Area_ExplosionSetting, "不可见", {}, "", function(toggle)
NearbyAreaExplosion.isInvisible = toggle
end)
menu.divider(Nearby_Area_ExplosionSetting, "位置偏移")
menu.slider_float(Nearby_Area_ExplosionSetting, "左/右", { "nearby_area_explosion_x" }, "",
-10000, 10000, 0, 10, function(value)
NearbyAreaExplosion.offset.x = value * 0.01
end)
menu.slider_float(Nearby_Area_ExplosionSetting, "前/后", { "nearby_area_explosion_y" }, "",
-10000, 10000, 0, 10, function(value)
NearbyAreaExplosion.offset.y = value * 0.01
end)
menu.slider_float(Nearby_Area_ExplosionSetting, "上/下", { "nearby_area_explosion_z" }, "",
-10000, 10000, 0, 10, function(value)
NearbyAreaExplosion.offset.z = value * 0.01
end)
----------------
-- Main
----------------
menu.toggle_loop(Nearby_Area_Explosion, "连线指示实体", {}, "", function()
NearbyAreaExplosion.Handle("drawline")
end)
menu.divider(Nearby_Area_Explosion, "")
menu.action(Nearby_Area_Explosion, "爆炸", { "explosion_nearby_area" }, "", function()
NearbyAreaExplosion.Handle()
end)
menu.slider(Nearby_Area_Explosion, "循环延迟", { "nearby_area_explosion_delay" }, "单位: ms",
0, 5000, 1000, 100, function(value)
NearbyAreaExplosion.delay = value
end)
menu.toggle_loop(Nearby_Area_Explosion, "循环爆炸", {}, "", function()
NearbyAreaExplosion.Handle()
util.yield(NearbyAreaExplosion.delay)
end)
--#endregion Nearby Area Explosion
menu.action(Nearby_Area_Options, "击杀区域", { "kill_nearby_area" }, "", function()
for _, ent in pairs(NearbyArea.GetEntities()) do
SET_ENTITY_HEALTH(ent, 0)
if ENTITY.IS_ENTITY_A_VEHICLE(ent) then
VEHICLE.SET_VEHICLE_ENGINE_HEALTH(ent, -4000.0)
end
end
end)
--#endregion Nearby Area Options
menu.divider(Entity_Options, "")
Entity_Info = {}
function Entity_Info.GetEntityInfo(entity)
if not ENTITY.DOES_ENTITY_EXIST(entity) then
return nil
end
local all_info = {}
all_info.entity = Entity_Info.EntityInfo(entity)
if ENTITY.IS_ENTITY_A_PED(entity) then
all_info.ped = Entity_Info.PedInfo(entity)
end
if ENTITY.IS_ENTITY_A_VEHICLE(entity) then
all_info.vehicle = Entity_Info.VehicleInfo(entity)
end
return all_info
end
function Entity_Info.EntityInfo(entity)
local entity_info = {
main = {}
}
local info = {} -- name, value
local t = ""
local model_hash = ENTITY.GET_ENTITY_MODEL(entity)
-- Model Name
local model_name = util.reverse_joaat(model_hash)
if model_name ~= "" then
info = { "Model Name", model_name }
table.insert(entity_info.main, info)
end
-- Model Hash
info = { "Model Hash", model_hash }
table.insert(entity_info.main, info)
-- Entity Type