-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathKeramiScriptLib.lua
1787 lines (1676 loc) · 74.3 KB
/
KeramiScriptLib.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
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
local menuroot = menu.my_root()
local menuAction = menu.action
local menuToggle = menu.toggle
local menuToggleLoop = menu.toggle_loop
local joaat = util.joaat
local wait = util.yield
local createPed = PED.CREATE_PED
local getEntityCoords = ENTITY.GET_ENTITY_COORDS
local getPlayerPed = PLAYER.GET_PLAYER_PED
local requestModel = STREAMING.REQUEST_MODEL
local hasModelLoaded = STREAMING.HAS_MODEL_LOADED
local noNeedModel = STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED
local setPedCombatAttr = PED.SET_PED_COMBAT_ATTRIBUTES
local giveWeaponToPed = WEAPON.GIVE_WEAPON_TO_PED
WhiteText = {r = 1.0, g = 1.0, b = 1.0, a = 1.0}
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MISC FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
function GetLocalPed()
return PLAYER.PLAYER_PED_ID()
end
function ToastCoordinates(v3coords)
util.toast(v3coords.x .. " || " .. v3coords.y .. " || " .. v3coords.z)
end
function SE_add_explosion(x, y, z, exptype, dmgscale, isheard, isinvis, camshake, nodmg)
FIRE.ADD_EXPLOSION(x, y, z, exptype, dmgscale, isheard, isinvis, camshake, nodmg)
end
function SE_add_owned_explosion(ped, x, y, z, exptype, dmgscale, isheard, isinvis, camshake)
FIRE.ADD_OWNED_EXPLOSION(ped, x, y, z, exptype, dmgscale, isheard, isinvis, camshake)
end
function DistanceBetweenTwoCoords(v3_1, v3_2)
local distance = math.sqrt(((v3_2.x - v3_1.x)^2) + ((v3_2.y - v3_1.y)^2) + ((v3_2.z - v3_1.z)^2))
return distance
end
function GetPlayerName_ped(ped)
local playerID = NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(ped)
local playerName = NETWORK.NETWORK_PLAYER_GET_NAME(playerID)
return playerName
end
function GetPlayerName_pid(pid)
local playerName = NETWORK.NETWORK_PLAYER_GET_NAME(pid)
return playerName
end
function GetEntityTypeString(handle)
local t = ENTITY.GET_ENTITY_TYPE(handle)
if (t == 1) then return "Ped" elseif (t == 2) then return "Vehicle" elseif (t == 3) then return "Object" else return nil end
end
--thank you to: https://easings.net for the functions!
function EaseOutCubic(x)
return 1 - ((1-x) ^ 3)
end
function EaseInCubic(x)
return x * x * x
end
function EaseInOutCubic(x) --Thank you QUICKNET for re-writing this function!
if(x < 0.5) then
return 4 * x * x * x;
else
return 1 - ((-2 * x + 2) ^ 3) / 2
end
end
function GetTableFromV3Instance(v3int)
local tbl = {x = v3.getX(v3int), y = v3.getY(v3int), z = v3.getZ(v3int)}
return tbl
end
function DoesTableContainValue(table, value)
for _, v in pairs(table) do
if v == value then return true end
end
return false
end
function GetValueIndexFromTable(table, value)
for i, v in pairs(table) do
if v == value then return i end
end
return nil
end
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MISC FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- CAM FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
function SmoothTeleportToCord(v3coords, teleportFrame)
local wppos = v3coords
local localped = getPlayerPed(players.user())
if wppos ~= nil then --cam setup here
if not CAM.DOES_CAM_EXIST(CCAM) then
CAM.DESTROY_ALL_CAMS(true)
CCAM = CAM.CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", true)
CAM.SET_CAM_ACTIVE(CCAM, true)
CAM.RENDER_SCRIPT_CAMS(true, false, 0, true, true, 0)
end
--
if teleportFrame then
util.create_tick_handler(function ()
if CAM.DOES_CAM_EXIST(CCAM) then
local tickCamCoord = CAM.GET_CAM_COORD(CCAM)
if not PED.IS_PED_IN_ANY_VEHICLE(localped, true) then --if they not in a vehicle
ENTITY.SET_ENTITY_COORDS(localped, tickCamCoord.x, tickCamCoord.y, tickCamCoord.z, false, false, false, false) --teleport the player
else
local veh = PED.GET_VEHICLE_PED_IS_IN(localped, false)
ENTITY.SET_ENTITY_COORDS(veh, tickCamCoord.x, tickCamCoord.y, tickCamCoord.z, false, false, false, false) --teleport the vehicle
end
else
return false
end
end)
end
--
local pc = getEntityCoords(getPlayerPed(players.user()))
--
for i = 0, 1, STP_SPEED_MODIFIER do --make the cam move up here
CAM.SET_CAM_COORD(CCAM, pc.x, pc.y, pc.z + EaseOutCubic(i) * STP_COORD_HEIGHT)
directx.draw_text(0.5, 0.5, tostring(EaseOutCubic(i) * STP_COORD_HEIGHT), 1, 0.6, WhiteText, false)
local look = util.v3_look_at(CAM.GET_CAM_COORD(CCAM), pc)
CAM.SET_CAM_ROT(CCAM, look.x, look.y, look.z, 2)
wait()
end
--CAM.DO_SCREEN_FADE_OUT(1000) --fade out the screen
------------
local currentZ = CAM.GET_CAM_COORD(CCAM).z
local coordDiffx = wppos.x - pc.x
local coordDiffxy = wppos.y - pc.y
for i = 0, 1, STP_SPEED_MODIFIER / 2 do --make the camera on x/y plane
CAM.SET_CAM_COORD(CCAM, pc.x + (EaseInOutCubic(i) * coordDiffx), pc.y + (EaseInOutCubic(i) * coordDiffxy), currentZ)
wait()
end
-- local groundZ = PATHFIND.GET_APPROX_HEIGHT_FOR_POINT(wppos.x, wppos.y)
-- ENTITY.SET_ENTITY_COORDS(localped, wppos.x, wppos.y, groundZ, false, false, false, false)
local success, ground_z
repeat
STREAMING.REQUEST_COLLISION_AT_COORD(wppos.x, wppos.y, wppos.z)
success, ground_z = util.get_ground_z(wppos.x, wppos.y)
util.yield()
until success
if not PED.IS_PED_IN_ANY_VEHICLE(localped, true) then --if they not in a vehicle
ENTITY.SET_ENTITY_COORDS(localped, wppos.x, wppos.y, ground_z, false, false, false, false) --teleport the player
else
local veh = PED.GET_VEHICLE_PED_IS_IN(localped, false)
local v3Out = memory.alloc()
local headOut = memory.alloc()
PATHFIND.GET_CLOSEST_VEHICLE_NODE_WITH_HEADING(wppos.x, wppos.y, ground_z, v3Out, headOut, 1, 3.0, 0)
local head = memory.read_float(headOut)
memory.free(headOut)
memory.free(v3Out)
ENTITY.SET_ENTITY_COORDS(veh, wppos.x, wppos.y, ground_z, false, false, false, false) --teleport the vehicle
ENTITY.SET_ENTITY_HEADING(veh, head)
end
wait()
local pc2 = getEntityCoords(getPlayerPed(players.user()))
local coordDiffz = CAM.GET_CAM_COORD(CCAM).z - ground_z -2
local camcoordz = CAM.GET_CAM_COORD(CCAM).z
--CAM.DO_SCREEN_FADE_IN(2000) --fade in the screen
for i = 0, 1, STP_SPEED_MODIFIER / 2 do --move the camera down
local pc23 = getEntityCoords(getPlayerPed(players.user()))-- extra for x/y
CAM.SET_CAM_COORD(CCAM, pc23.x, pc23.y, camcoordz - (EaseOutCubic(i) * coordDiffz))
wait()
end
-------------
----
wait()
--camera deletion here
CAM.RENDER_SCRIPT_CAMS(false, false, 0, true, true, 0)
if CAM.IS_CAM_ACTIVE(CCAM) then
CAM.SET_CAM_ACTIVE(CCAM, false)
end
CAM.DESTROY_CAM(CCAM, true)
else
util.toast("No waypoint set!")
end
end
function SmoothTeleportToVehicle(pedInVehicle)
local wppos = getEntityCoords(pedInVehicle)
local localped = getPlayerPed(players.user())
--check for emtpy seats
local maxPassengers = VEHICLE.GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(veh)
local seatFree = false
local continueQ
local veh = PED.GET_VEHICLE_PED_IS_IN(pedInVehicle, false)
for i = -1, maxPassengers do --check for empty seats
seatFree = VEHICLE.IS_VEHICLE_SEAT_FREE(veh, i, false)
if seatFree then
continueQ = true
end
end
if seatFree == false then
util.toast("No seats available in said vehicle.")
continueQ = false
end
-- > --
if wppos ~= nil then --cam setup here
if not CAM.DOES_CAM_EXIST(CCAM) then
CAM.DESTROY_ALL_CAMS(true)
CCAM = CAM.CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", true)
CAM.SET_CAM_ACTIVE(CCAM, true)
CAM.RENDER_SCRIPT_CAMS(true, false, 0, true, true, 0)
end
--
local pc = getEntityCoords(getPlayerPed(players.user()))
--
for i = 0, 1, STP_SPEED_MODIFIER do --make the cam move up here
CAM.SET_CAM_COORD(CCAM, pc.x, pc.y, pc.z + EaseOutCubic(i) * STP_COORD_HEIGHT)
directx.draw_text(0.5, 0.5, tostring(EaseOutCubic(i) * STP_COORD_HEIGHT), 1, 0.6, WhiteText, false)
local look = util.v3_look_at(CAM.GET_CAM_COORD(CCAM), pc)
CAM.SET_CAM_ROT(CCAM, look.x, look.y, look.z, 2)
wait()
end
--CAM.DO_SCREEN_FADE_OUT(1000) --fade out the screen
------------
local currentZ = CAM.GET_CAM_COORD(CCAM).z
local coordDiffx = wppos.x - pc.x
local coordDiffxy = wppos.y - pc.y
for i = 0, 1, STP_SPEED_MODIFIER / 2 do --make the camera on x/y plane
CAM.SET_CAM_COORD(CCAM, pc.x + (EaseInOutCubic(i) * coordDiffx), pc.y + (EaseInOutCubic(i) * coordDiffxy), currentZ)
wait()
end
PED.SET_PED_INTO_VEHICLE(localped, veh, i)
if continueQ then
wait()
local pc2 = getEntityCoords(getPlayerPed(players.user()))
local coordDiffz = CAM.GET_CAM_COORD(CCAM).z - pc2.z
local camcoordz = CAM.GET_CAM_COORD(CCAM).z
--CAM.DO_SCREEN_FADE_IN(2000) --fade in the screen
for i = 0, 1, STP_SPEED_MODIFIER / 2 do --move the camera down
local pc23 = getEntityCoords(pedInVehicle)-- extra for x/y
CAM.SET_CAM_COORD(CCAM, pc23.x, pc23.y, camcoordz - (EaseOutCubic(i) * coordDiffz))
wait()
end
end
wait()
--camera deletion here
CAM.RENDER_SCRIPT_CAMS(false, false, 0, true, true, 0)
if CAM.IS_CAM_ACTIVE(CCAM) then
CAM.SET_CAM_ACTIVE(CCAM, false)
end
CAM.DESTROY_CAM(CCAM, true)
else
util.toast("No waypoint set!")
end
end
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- CAM FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- NETWORK FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
function FastNet(entity, playerID)
local netID = NETWORK.NETWORK_GET_NETWORK_ID_FROM_ENTITY(entity)
NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity)
if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then
for i = 1, 30 do
if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then
NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity)
wait(10)
else
goto continue
end
end
end
::continue::
if SE_Notifications then
util.toast("Has control.")
end
NETWORK.NETWORK_REQUEST_CONTROL_OF_NETWORK_ID(netID)
wait(10)
NETWORK.SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(netID)
wait(10)
NETWORK.SET_NETWORK_ID_CAN_MIGRATE(netID, false)
wait(10)
NETWORK.SET_NETWORK_ID_ALWAYS_EXISTS_FOR_PLAYER(netID, playerID, true)
wait(10)
ENTITY.SET_ENTITY_AS_MISSION_ENTITY(entity, true, false)
wait(10)
ENTITY.SET_ENTITY_SHOULD_FREEZE_WAITING_ON_COLLISION(entity, false)
wait(10)
if ENTITY.IS_ENTITY_AN_OBJECT(entity) then
NETWORK.OBJ_TO_NET(entity)
end
wait(10)
if BA_visible then
ENTITY.SET_ENTITY_VISIBLE(entity, true, 0)
else
ENTITY.SET_ENTITY_VISIBLE(entity, false, 0)
wait()
ENTITY.SET_ENTITY_VISIBLE(entity, false, 0)
wait()
ENTITY.SET_ENTITY_VISIBLE(entity, false, 0)
end
end
function NetIt(entity, playerID)
local netID = NETWORK.NETWORK_GET_NETWORK_ID_FROM_ENTITY(entity)
NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity)
if not NETWORK.NETWORK_HAS_CONTROL_OF_ENTITY(entity) then
for i = 1, 100 do
NETWORK.NETWORK_REQUEST_CONTROL_OF_ENTITY(entity)
wait(50)
end
else
if SE_Notifications then
util.toast("Has control.")
end
end
wait(10)
NETWORK.NETWORK_REQUEST_CONTROL_OF_NETWORK_ID(netID)
wait(10)
NETWORK.SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(netID)
wait(10)
NETWORK.SET_NETWORK_ID_CAN_MIGRATE(netID, false)
wait(10)
NETWORK.SET_NETWORK_ID_ALWAYS_EXISTS_FOR_PLAYER(netID, playerID, true)
wait(10)
ENTITY.SET_ENTITY_AS_MISSION_ENTITY(entity, true, false)
wait(10)
ENTITY.SET_ENTITY_SHOULD_FREEZE_WAITING_ON_COLLISION(entity, false)
wait(10)
if ENTITY.IS_ENTITY_AN_OBJECT(entity) then
NETWORK.OBJ_TO_NET(entity)
end
wait(10)
if BA_visible then
ENTITY.SET_ENTITY_VISIBLE(entity, true, 0)
else
ENTITY.SET_ENTITY_VISIBLE(entity, false, 0)
wait()
ENTITY.SET_ENTITY_VISIBLE(entity, false, 0)
wait()
ENTITY.SET_ENTITY_VISIBLE(entity, false, 0)
end
end
function GetGamerHandleFromPlayer(playerID)
local gmr_hndl = memory.alloc(104)
NETWORK.NETWORK_HANDLE_FROM_PLAYER(playerID, gmr_hndl, 13)
if NETWORK.NETWORK_IS_HANDLE_VALID(gmr_hndl, 13) then
local gamerHandle = gmr_hndl
memory.free(gmr_hndl)
return gamerHandle
else
memory.free(gmr_hndl)
util.toast("GamerHandle failed!")
return nil
end
end
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- NETWORK FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- POSITION FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
function Get_Waypoint_Pos2()
if HUD.IS_WAYPOINT_ACTIVE() then
local blip = HUD.GET_FIRST_BLIP_INFO_ID(8)
local waypoint_pos = HUD.GET_BLIP_COORDS(blip)
return waypoint_pos
else
util.toast("NO_WAYPOINT_SET")
end
end
function GetClosestPlayerWithRange(range)
local pedPointers = entities.get_all_peds_as_pointers()
local rangesq = range * range
local ourCoords = getEntityCoords(GetLocalPed())
local tbl = {}
local closest_player = 0
for i = 1, #pedPointers do
local tarcoords = entities.get_position(pedPointers[i])
local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if vdist <= rangesq then
tbl[#tbl+1] = entities.pointer_to_handle(pedPointers[i])
end
end
if tbl ~= nil then
local dist = 999999
for i = 1, #tbl do
if tbl[i] ~= GetLocalPed() then
if PED.IS_PED_A_PLAYER(tbl[i]) then
local tarcoords = getEntityCoords(tbl[i])
local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if e < dist then
dist = e
closest_player = tbl[i]
end
end
end
end
end
if closest_player ~= 0 then
return closest_player
else
return nil
end
end
function GetClosestPlayerWithRange_Whitelist(range, inair) --variation of getClosestPlayerWithinRange to work with my whitelisting feature for silent aimbot
local pedPointers = entities.get_all_peds_as_pointers()
local rangesq = range * range
local ourCoords = getEntityCoords(GetLocalPed())
local tbl = {}
local closest_player = 0
for i = 1, #pedPointers do
local tarcoords = entities.get_position(pedPointers[i])
local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if vdist <= rangesq then
local handle = entities.pointer_to_handle(pedPointers[i])
if (inair and (ENTITY.GET_ENTITY_HEIGHT_ABOVE_GROUND(handle) >= 9)) or (not inair) then --air check
local playerID = NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(handle)
if not AIM_WHITELIST[playerID] then --this is the whitelist check.
tbl[#tbl+1] = handle
end
end
end
end
if tbl ~= nil then
local dist = 999999
for i = 1, #tbl do
if tbl[i] ~= GetLocalPed() then
if PED.IS_PED_A_PLAYER(tbl[i]) then
local tarcoords = getEntityCoords(tbl[i])
local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if e < dist then
dist = e
closest_player = tbl[i]
end
end
end
end
end
if closest_player ~= 0 then
return closest_player
else
return nil
end
end
function GetSuitableAimbotTarget(fov, fovcheck, dist, loscheck)
local ourped = GetLocalPed()
local distsq = dist * dist
local ourc = getEntityCoords(ourped)
local entTable = entities.get_all_peds_as_pointers()
local inRange = {}
for _, entity in pairs(entTable) do
local entpos = entities.get_position(entity)
if SYSTEM.VDIST2(ourc.x, ourc.y, ourc.z, entpos.x, entpos.y, entpos.z) <= distsq then --distance check
local handle = entities.pointer_to_handle(entity)
if (handle ~= ourped) then
if (not PED.IS_PED_DEAD_OR_DYING(handle)) and (INTERIOR.GET_INTERIOR_FROM_ENTITY(handle) == 0) then --dead/interior check
if (fovcheck and PED.IS_PED_FACING_PED(ourped, handle, fov)) or (not fovcheck) then --fov check
if (PED.IS_PED_A_PLAYER(handle)) and (not AIM_WHITELIST[NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(handle)]) then --whitelist, player check
if (loscheck and ENTITY.HAS_ENTITY_CLEAR_LOS_TO_ENTITY(ourped, handle, 17)) or (not loscheck) then --line-of-sight check
inRange[#inRange+1] = handle
end
end
end
end
end
end
end
local retplayer
local d = 99999999999
if #inRange ~= 0 then
for _, ped in pairs(inRange) do
local tc = getEntityCoords(ped)
local vidsti = SYSTEM.VDIST2(ourc.x, ourc.y, ourc.z, tc.x, tc.y, tc.z)
if vidsti < d then
retplayer = ped
d = vidsti
end
end
return retplayer
end
return nil
end
function ShootSingleBulletBetweenCoords(coords1, coords2, dmg, weaponhash, ownerped, audible, invisible, speed)
MISC.SHOOT_SINGLE_BULLET_BETWEEN_COORDS(
coords1.x, coords1.y, coords1.z,
coords2.x, coords2.y, coords2.z,
dmg, true, weaponhash, ownerped, audible, invisible, speed)
end
function ShootBulletAtPedBone(ped, boneID, dmg, weaponHash, speed)
local bonecoords = PED.GET_PED_BONE_COORDS(ped, boneID, 0, 0, 0)
local ourped = GetLocalPed()
local ourhead = PED.GET_PED_BONE_COORDS(ourped, 12844, 0, 0, 0); local ourfront = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ourped, 0, 1, 0)
ourfront.z = ourhead.z --to shoot out of infront of our head
ShootSingleBulletBetweenCoords(ourfront, bonecoords, dmg, weaponHash, ourped, true, false, speed)
end
function GetClosestPlayerWithRange_Whitelist_DisallowEntities(range, disallowedEntities, inair) --variation of GetClosestPlayerWithRange_Whitelist, that makes entities not returned if they are in the table.
local pedPointers = entities.get_all_peds_as_pointers()
local rangesq = range * range
local ourCoords = getEntityCoords(GetLocalPed())
local tbl = {}
local closest_player = 0
for i = 1, #pedPointers do
local tarcoords = entities.get_position(pedPointers[i])
local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if vdist <= rangesq then
local handle = entities.pointer_to_handle(pedPointers[i])
local playerID = NETWORK.NETWORK_GET_PLAYER_INDEX_FROM_PED(handle)
if (inair and (ENTITY.GET_ENTITY_HEIGHT_ABOVE_GROUND(handle) >= 9)) or (not inair) then --air check
if not AIM_WHITELIST[playerID] then --this is the whitelist check.
if not DoesTableContainValue(disallowedEntities, handle) then --this is the disallowed entities table check
tbl[#tbl+1] = handle
end
end
end
end
end
if tbl ~= nil then
local dist = 999999
for i = 1, #tbl do
if tbl[i] ~= GetLocalPed() then
if PED.IS_PED_A_PLAYER(tbl[i]) then
local tarcoords = getEntityCoords(tbl[i])
local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if e < dist then
dist = e
closest_player = tbl[i]
end
end
end
end
end
if closest_player ~= 0 then
return closest_player
else
return nil
end
end
function GetClosestNonPlayerPedWithRange(range)
local pedPointers = entities.get_all_peds_as_pointers()
local rangesq = range * range
local ourCoords = getEntityCoords(GetLocalPed())
local tbl = {}
local closest_ped = 0
for i = 1, #pedPointers do
local tarcoords = entities.get_position(pedPointers[i])
local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if vdist <= rangesq then
tbl[#tbl+1] = entities.pointer_to_handle(pedPointers[i])
end
end
if tbl ~= nil then
local dist = 999999
for i = 1, #tbl do
if tbl[i] ~= GetLocalPed() then
if not PED.IS_PED_A_PLAYER(tbl[i]) then
local tarcoords = getEntityCoords(tbl[i])
local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if e < dist then
dist = e
closest_ped = tbl[i]
end
end
end
end
end
if closest_ped ~= 0 then
return closest_ped
else
return nil
end
end
function GetClosestNonPlayerPedWithRange_DisallowedEntities(range, disallowedEntities, inair) --modified version of GetClosestNonPlayerPedWithRange that takes a table of disallowed entities (blacklisted peds)
local pedPointers = entities.get_all_peds_as_pointers()
local rangesq = range * range
local ourCoords = getEntityCoords(GetLocalPed())
local tbl = {}
local closest_ped = 0
for i = 1, #pedPointers do
local tarcoords = entities.get_position(pedPointers[i])
local vdist = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if vdist <= rangesq then
local handle = entities.pointer_to_handle(pedPointers[i])
if (inair and (ENTITY.GET_ENTITY_HEIGHT_ABOVE_GROUND(handle) >= 9)) or (not inair) then
if not DoesTableContainValue(disallowedEntities, handle) then
tbl[#tbl+1] = handle
end
end
end
end
if tbl ~= nil then
local dist = 999999
for i = 1, #tbl do
if tbl[i] ~= GetLocalPed() then
if not PED.IS_PED_A_PLAYER(tbl[i]) then
local tarcoords = getEntityCoords(tbl[i])
local e = SYSTEM.VDIST2(ourCoords.x, ourCoords.y, ourCoords.z, tarcoords.x, tarcoords.y, tarcoords.z)
if e < dist then
dist = e
closest_ped = tbl[i]
end
end
end
end
end
if closest_ped ~= 0 then
return closest_ped
else
return nil
end
end
function ScanHandleAndCoordsOfPed(joaatHash)
local peds = entities.get_all_peds_as_pointers()
for _, ped in pairs(peds) do
if entities.get_model_hash(ped) == joaatHash then
local handle = entities.pointer_to_handle(ped)
local pos = getEntityCoords(handle)
return handle, pos
end
end
return nil, nil
end
function ScanHandleAndCoordsOfModel(joaatHash)
local objs = entities.get_all_objects_as_pointers()
for _, obj in pairs(objs) do
if entities.get_model_hash(obj) == joaatHash then
local handle = entities.pointer_to_handle(obj)
local pos = getEntityCoords(handle)
return handle, pos
end
end
return nil, nil
end
function ScanHandleAndCoordsOfModelReturnFirst(hashes)
local objs = entities.get_all_objects_as_pointers()
for idx, model in ipairs(hashes) do
for _, obj in pairs(objs) do
if entities.get_model_hash(obj) == model then
local handle = entities.pointer_to_handle(obj)
local pos = getEntityCoords(handle)
return handle, pos
end
end
end
return nil, nil
end
function ScanHandleAndCoordsOfModels(hashes)
--not even sure if this function works lmfao but it should :(
local objs = entities.get_all_objects_as_pointers()
local ret = {handles = {}, positions = {}}
for idx, model in ipairs(hashes) do
for _, obj in pairs(objs) do
if entities.get_model_hash(obj) == model then
local handle = entities.pointer_to_handle(obj)
ret["handles"][#ret["handles"]+1] = handle
ret["positions"][#ret["positions"]+1] = getEntityCoords(handle)
end
end
end
return ret
end
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- POSITION FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MODEL FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
function RqModel (hash)
STREAMING.REQUEST_MODEL(hash)
local count = 0
util.toast("Requesting model...")
while not STREAMING.HAS_MODEL_LOADED(hash) and count < 100 do
STREAMING.REQUEST_MODEL(hash)
count = count + 1
wait(10)
end
if not STREAMING.HAS_MODEL_LOADED(hash) then
util.toast("Tried for 1 second, couldn't load this specified model!")
end
end
function SpawnObjectAtCoords(hash, v3Coords)
RqModel(hash)
local object = entities.create_object(hash, v3Coords)
STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(hash)
return object
end
function SpawnPedAtCoords(hash, v3Coords)
RqModel(hash)
local entity = entities.create_ped(26, hash, v3Coords, 0)
STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(hash)
return entity
end
function SpawnPedOnPlayer(hash, pid)
RqModel(hash)
local lc = getEntityCoords(getPlayerPed(pid))
local pe = entities.create_ped(26, hash, lc, 0)
STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(hash)
return pe
end
function SpawnObjectOnPlayer(hash, pid)
RqModel(hash)
local lc = getEntityCoords(getPlayerPed(pid))
local ob = entities.create_object(hash, lc)
STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(hash)
return ob
end
function SpawnPickupOnPlayer(pickuphash, modelhash, value, pid)
RqModel(modelhash)
local pc = getEntityCoords(getPlayerPed(pid))
OBJECT.CREATE_PICKUP(pickuphash, pc.x, pc.y, pc.z, 99999, value, true, modelhash)
end
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- MODEL FUNCTIONS END ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- SUICIDE FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
function MakePlayerExplodeSuicide(pid)
local playerPed = getPlayerPed(pid)
local playerCoords = getEntityCoords(playerPed)
-- checks for interior, godmode, and vehicle all in one if / elseif statement...
if players.is_godmode(pid) and not players.is_in_interior(pid) then
util.toast("Player is in godmode, stopping explode...")
elseif players.is_in_interior(pid) then
util.toast("Player is in an interior, stopping explode...")
elseif PED.IS_PED_IN_ANY_VEHICLE(playerPed, true) then
for i = 0, 50, 1 do --50 explosions to account for armored vehicles, using type 5, as a tank shell as well xD
SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 5, 10, SEisExploAudible, SEisExploInvis, 0)
wait(10)
end
else
SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 1, 10, SEisExploAudible, SEisExploInvis, 0)
end
end
function MakePlayerMolotovSuicide(pid)
local playerPed = getPlayerPed(pid)
local playerCoords = getEntityCoords(playerPed)
--checks for godmode and interior
if players.is_godmode(pid) and not players.is_in_interior(pid) then
util.toast("Player is in godmode, stopping explode...")
elseif players.is_in_interior(pid) then
util.toast("Player is in an interior, stopping explode...")
else
SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 3, 10, SEisExploAudible, SEisExploInvis, 0)
end
end
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- SUICIDE FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
---- >> ---- ---- >> ---- ---- >> ---- ---- >> ---- TOXIC FUNCTIONS START ---- >> ---- ---- >> ---- ---- >> ---- ---- >> ----
function EveryoneExplodeSuicides()
for i = 0, 31, 1 do
if players.exists(i) then --checks for if the PID exists in session
local playerPed = getPlayerPed(i)
local playerCoords = getEntityCoords(playerPed)
if PED.IS_PED_IN_ANY_VEHICLE(playerPed, true) then
for a = 0, 50, 1 do --50 explosions to account for armored vehicles, using type 5, as a tank shell as well xD
SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 5, 10, SEisExploAudible, SEisExploInvis, 0)
wait(10)
end
else
SE_add_owned_explosion(playerPed, playerCoords.x, playerCoords.y, playerCoords.z, 1, 10, SEisExploAudible, SEisExploInvis, 0)
end
end
end
end
function PizzaCAll()
for p = 0, 31, 1 do
if p ~= players.user() and ENTITY.DOES_ENTITY_EXIST(getPlayerPed(p)) then
for i = 1, 10 do
local cord = getEntityCoords(getPlayerPed(p))
requestModel(-930879665)
wait(10)
requestModel(3613262246)
wait(10)
requestModel(452618762)
wait(10)
while not hasModelLoaded(-930879665) do wait() end
while not hasModelLoaded(3613262246) do wait() end
while not hasModelLoaded(452618762) do wait() end
local a1 = entities.create_object(-930879665, cord)
wait(10)
local a2 = entities.create_object(3613262246, cord)
wait(10)
local b1 = entities.create_object(452618762, cord)
wait(10)
local b2 = entities.create_object(3613262246, cord)
wait(300)
entities.delete_by_handle(a1)
entities.delete_by_handle(a2)
entities.delete_by_handle(b1)
entities.delete_by_handle(b2)
noNeedModel(452618762)
wait(10)
noNeedModel(3613262246)
wait(10)
noNeedModel(-930879665)
wait(10)
end
if SE_Notifications then
util.toast("Finished with player // " .. tostring(PLAYER.GET_PLAYER_NAME(p)) .. " // of index " .. p)
end
end
end
end
function FreemodeDeathAll()
for p = 0, 31 do
if p ~= players.user() and NETWORK.NETWORK_IS_PLAYER_CONNECTED(p) then
for i = -1, 1 do
for n = -1, 1 do
util.trigger_script_event(1 << p, {-65587051, 28, i, n})
end
end
for i = -1, 1 do
for n = -1, 1 do
util.trigger_script_event(1 << p, {1445703181, 28, i, n})
end
end
wait(100)
util.trigger_script_event(1 << p, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112})
util.trigger_script_event(1 << p, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000})
util.trigger_script_event(1 << p, {2002459655, -1000000, -10000, -100000000})
util.trigger_script_event(1 << p, {911179316, -38, -30, -75, -59, 85, 82})
end
for i = -1, 1 do
for a = -1, 1 do
util.trigger_script_event(1 << p, {916721383, i, a, 0, 26})
end
end
end
end
TXC_SLOW = false
function AIOKickAll()
menu.trigger_commands("scripthost")
NETWORK.NETWORK_REQUEST_TO_BE_HOST_OF_THIS_SCRIPT()
for i = 0, 31 do
if i ~= players.user() and NETWORK.NETWORK_IS_PLAYER_CONNECTED(i) then
util.toast("Player connected " .. tostring(PLAYER.GET_PLAYER_NAME(i) .. ", commencing AIO."))
util.trigger_script_event(1 << i, {0x37437C28, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-1308840134, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {0x4E0350C6, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-0x114C63AC, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-0x15F5B1D4, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-0x249FE11B, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-0x76B11968, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {0x9C050EC, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {0x3B873479, 1, 15, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {0x23F74138, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
--[[
util.trigger_script_event(1 << i, {0xAD63290E, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
]]
--[[
util.trigger_script_event(1 << i, {0x39624029, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
]]
util.trigger_script_event(1 << i, {-0x529CD6F2, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-0x756DBC8A, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-0x69532BA0, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {0x68C5399F, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {0x7DE8CAC0, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {0x285DDF33, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
util.trigger_script_event(1 << i, {-0x177132B8, math.random(-2147483647, 2147483647), 1, 115, math.random(-2147483647, 2147483647)})
wait(10)
--util.toast("Main block done. // AIO")
util.trigger_script_event(1 << i, {memory.script_global(1893548 + (1 + (i * 600) + 511)), i})
for a = -1, 1 do
for n = -1, 1 do
util.trigger_script_event(1 << i, {-65587051, 28, a, n})
wait(10)
end
end
--util.toast("Second block done. // AIO")
for a = -1, 1 do
for n = -1, 1 do
util.trigger_script_event(1 << i, {1445703181, 28, a, n})
wait(10)
end
end
--util.toast("Third block done. // AIO")
if TXC_SLOW then
wait(10)
util.trigger_script_event(1 << i, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112})
wait(10)
util.trigger_script_event(1 << i, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000})
wait(10)
util.trigger_script_event(1 << i, {2002459655, -1000000, -10000, -100000000})
wait(10)
util.trigger_script_event(1 << i, {911179316, -38, -30, -75, -59, 85, 82})
wait(10)
--[[
for n = -10, -7 do
for a = -60, 60 do
util.trigger_script_event(1 << i, {0x39624029, n, 623656, a, 73473741, -7, 856844, -51251, 856844})
wait(10)
end
end
]]
util.trigger_script_event(1 << i, {-290218924, -32190, -71399, 19031, 85474, 4468, -2112})
wait(10)
util.trigger_script_event(1 << i, {-1386010354, 91645, -99683, 1788, 60877, 55085, 72028})
wait(10)
util.trigger_script_event(1 << i, {-227800145, -1000000, -10000000, -100000000, -100000000, -100000000})
wait(10)
for g = -28, 0 do
for n = -1, 1 do
for a = -1, 1 do
util.trigger_script_event(1 << i, {1445703181, i, n, a})
end
end
wait(10)
end
--[[for a = -28, 20 do
for n = -10, 2 do
for b = -100, 100 do
util.trigger_script_event(1 << i, {-1782442696, b, n, a})
util.log("Number 6, iteration " .. b)
end
util.log("Number 7, iteration " .. n)
end
util.log("Number 8, iteration " .. a)
wait(10)
end]]
for a = -11, 11 do
util.trigger_script_event(1 << i, {2002459655, -1000000, a, -100000000})
end
for a = -10, 10 do
for n = 30, -30 do
util.trigger_script_event(1 << i, {911179316, a, n, -75, -59, 85, 82})
end
end
for a = -10, 10 do
util.trigger_script_event(1 << i, {-65587051, a, -1, -1})
end
util.trigger_script_event(1 << i, {951147709, i, 1000000, nil, nil})
for a = -10, 10 do
util.trigger_script_event(1 << i, {-1949011582, a, 1518380048})
end
for a = -10, 4 do
for n = -10, 5 do
util.trigger_script_event(1 << i, {1445703181, 28, a, n})
end
end
end
util.toast("Fourth block done. // AIO")
util.toast("Iteration " .. i .. " complete of AIO kick.")
util.toast("Player " .. PLAYER.GET_PLAYER_NAME(i) .. " done.")
end
end
wait(100)
end
function FreemodeDeathPlayer(pid)