forked from bl1tzzz/lua-is
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exscord_src.lua
2214 lines (1902 loc) · 76.4 KB
/
exscord_src.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
-- localize vars
local type = type;
local setmetatable = setmetatable;
local tostring = tostring;
local math_pi = math.pi;
local math_min = math.min;
local math_max = math.max;
local math_deg = math.deg;
local math_rad = math.rad;
local math_sqrt = math.sqrt;
local math_sin = math.sin;
local math_cos = math.cos;
local math_atan = math.atan;
local math_acos = math.acos;
local math_fmod = math.fmod;
-- set up vector3 metatable
local _V3_MT = {};
_V3_MT.__index = _V3_MT;
--
-- create Vector3 object
--
local function Vector3( x, y, z )
-- check args
if( type( x ) ~= "number" ) then
x = 0.0;
end
if( type( y ) ~= "number" ) then
y = 0.0;
end
if( type( z ) ~= "number" ) then
z = 0.0;
end
x = x or 0.0;
y = y or 0.0;
z = z or 0.0;
return setmetatable(
{
x = x,
y = y,
z = z
},
_V3_MT
);
end
function _V3_MT.__sub( a, b ) -- subtract another vector or number
local a_type = type( a );
local b_type = type( b );
if( a_type == "table" and b_type == "table" ) then
return Vector3(
a.x - b.x,
a.y - b.y,
a.z - b.z
);
elseif( a_type == "table" and b_type == "number" ) then
return Vector3(
a.x - b,
a.y - b,
a.z - b
);
elseif( a_type == "number" and b_type == "table" ) then
return Vector3(
a - b.x,
a - b.y,
a - b.z
);
end
end
function _V3_MT:length_sqr() -- squared 3D length
return ( self.x * self.x ) + ( self.y * self.y ) + ( self.z * self.z );
end
function _V3_MT:length() -- 3D length
return math_sqrt( self:length_sqr() );
end
function _V3_MT:dot( other ) -- dot product
return ( self.x * other.x ) + ( self.y * other.y ) + ( self.z * other.z );
end
function _V3_MT:cross( other ) -- cross product
return Vector3(
( self.y * other.z ) - ( self.z * other.y ),
( self.z * other.x ) - ( self.x * other.z ),
( self.x * other.y ) - ( self.y * other.x )
);
end
function _V3_MT:dist_to( other ) -- 3D length to another vector
return ( other - self ):length();
end
function _V3_MT:normalize() -- normalizes this vector and returns the length
local l = self:length();
if( l <= 0.0 ) then
return 0.0;
end
self.x = self.x / l;
self.y = self.y / l;
self.z = self.z / l;
return l;
end
function _V3_MT:normalized() -- returns a normalized unit vector
local l = self:length();
if( l <= 0.0 ) then
return Vector3();
end
return Vector3(
self.x / l,
self.y / l,
self.z / l
);
end
local function angle_forward( angle ) -- angle -> direction vector (forward)
local sin_pitch = math_sin( math_rad( angle.x ) );
local cos_pitch = math_cos( math_rad( angle.x ) );
local sin_yaw = math_sin( math_rad( angle.y ) );
local cos_yaw = math_cos( math_rad( angle.y ) );
return Vector3(
cos_pitch * cos_yaw,
cos_pitch * sin_yaw,
-sin_pitch
);
end
local function get_FOV( view_angles, start_pos, end_pos ) -- get fov to a vector (needs client view angles, start position (or client eye position for example) and the end position)
local type_str;
local fwd;
local delta;
local fov;
fwd = angle_forward( view_angles );
delta = ( end_pos - start_pos ):normalized();
fov = math_acos( fwd:dot( delta ) / delta:length() );
return math_max( 0.0, math_deg( fov ) );
end
local ffi = require("ffi")
local line_goes_through_smoke
do
local success, match = client.find_signature("client_panorama.dll", "\x55\x8B\xEC\x83\xEC\x08\x8B\x15\xCC\xCC\xCC\xCC\x0F\x57")
if success and match ~= nil then
local lgts_type = ffi.typeof("bool(__thiscall*)(float, float, float, float, float, float, short);")
line_goes_through_smoke = ffi.cast(lgts_type, match)
end
end
--endregion
--region math
function math.round(number, precision)
local mult = 10 ^ (precision or 0)
return math.floor(number * mult + 0.5) / mult
end
--endregion
--region angle
--- @class angle_c
--- @field public p number Angle pitch.
--- @field public y number Angle yaw.
--- @field public r number Angle roll.
local angle_c = {}
local angle_mt = {
__index = angle_c
}
--- Create a new vector object.
--- @param p number
--- @param y number
--- @param r number
--- @return angle_c
local function angle(p, y, r)
return setmetatable(
{
p = p or 0,
y = y or 0,
r = r or 0
},
angle_mt
)
end
-- VECTOR LIBRARY ABOVE --
-- reference library
local ui_set, ui_get, ui_ref, ui_callback, ui_visibile = ui.set, ui.get, ui.reference, ui.set_callback
local ui_new_checkbox, ui_new_color_picker, ui_new_slider = ui.new_checkbox, ui.new_color_picker, ui.new_slider
local entity_get_player_name, entity_get_bounding_box, entity_is_alive, entity_get_prop, entity_get_local_player, entity_get_player_weapon, entity_get_players = entity.get_player_name, entity.get_bounding_box, entity.is_alive, entity.get_prop, entity.get_local_player, entity.get_player_weapon, entity.get_players
local client_set_event_callback, client_unset_event_callback, client_log, client_color_log, client_screensize, client_draw_indicator, client_draw_text = client.set_event_callback, client.unset_event_callback, client.log, client.color_log, client.screen_size, client.draw_indicator, client.draw_text
local string_format, math_floor, bit_band = string.format, math.floor, bit.band
local renderer_text, renderer_measure_text = renderer.text, renderer.measure_text
-- endregion
-- end of lua / console logs
-- menu reference
local aatab = { "LUA", "B" }
local luatab = { "LUA", "B" }
-- steamid 32 to 64 and protection system 0_0
local ffi = require( "ffi" )
-- menu
-- start of actual LUA
-- start ui
local nickname = "rose"
local usertype = ""
if nickname == 'rose' then nickname = 'admin' end
if nickname == 'admin' then usertype = '[dev]' else usertype = '[alpha]' end
-- anti-aim options ui
local aa =
{
enable_checkbox = ui.new_checkbox( aatab[1], aatab[2], "exscord extensions - " ..nickname ),
-- exscord UI
configure_combobox = ui.new_combobox( aatab[1], aatab[2], "Current tab: ",
"Anti-aim",
"Ragebot",
"Indicators",
"Config" ),
-- Ragebot UI
-- increase_speed = ui.new_checkbox( aatab[1], aatab[2] , "[+] Extend doubletap speed" ),
-- dt_accuracy = ui.new_checkbox( aatab[1], aatab[2] , "[+] Improve DT accuracy" ),
ideal_peek = ui.new_hotkey( aatab[1], aatab[2], "[+] Ideal peek" ),
-- Anti-aim UI
jitter_checkbox = ui.new_checkbox( aatab[1], aatab[2], "[+] Extend anti-aimbot settings" ),
freestand_mode_combobox = ui.new_combobox( aatab[1], aatab[2], "[+] Custom DSY Freestanding", "Default", "Reversed" ),
lowdelta_slow_walk_checkbox = ui.new_checkbox( aatab[1], aatab[2], "[+] Smart delta on slow-walk" ),
in_air_checkbox = ui.new_checkbox( aatab[1], aatab[2] , "[+] Air anti-aim changes"),
edge_yaw_checkbox = ui.new_checkbox (aatab[1], aatab[2], "[+] Smart edge-yaw" ),
legmovement_checkbox = ui.new_checkbox( aatab[1], aatab[2], "[+] Adaptive leg breaker" ),
legit_aa_on_e = ui.new_checkbox( aatab[1], aatab[2], "[+] Legit anti-aim on E key" ),
legit_aa_hotkey = ui.new_hotkey( aatab[1], aatab[2], " [-] Custom key", false ),
--Manual anti-aim ui
manualaa_checkbox = ui.new_checkbox( aatab[1], aatab[2], "[+] Manual anti-aim" ),
manual_left_hotkey = ui.new_hotkey( aatab[1], aatab[2], " [-] Left", false ),
manual_back_hotkey = ui.new_hotkey( aatab[1], aatab[2], " [-] Backwards", false ),
manual_right_hotkey = ui.new_hotkey( aatab[1], aatab[2]," [-] Right", false ),
manual_state = ui.new_slider("AA", "Other", "Manual direction", 0, 3, 0)
}
-- visual options start ui
local visuals =
{
configure_vis_combobox = ui.new_combobox( aatab[1], aatab[2], "Indicator customization ",
"Text & Indicators"),
-- visual indicator colours ui
-- visual indicators ui
indicators_multiselect = ui.new_multiselect( aatab[1], aatab[2], "Indicators", {
"Screen indicators",
"Arrows"} ),
-- visual text indicators choice ui
textindicators_multiselect = ui.new_multiselect( aatab[1], aatab[2], "Text display", {
"LUA Name",
"AA State",
"Ragebot state indicators" } ),
-- visual indicator y position ui
indicatorypos_slider = ui.new_slider( aatab[1], aatab[2], "Indicator Y Positon", -100, 100, 0, true, "px" ),
fontstyle_combobox = ui.new_combobox( aatab[1], aatab[2], "Font style", {
"Block",
"Default",
"Bold" } ),
centered_text = ui.new_checkbox( aatab[1], aatab[2], "Centered text" ),
banepa_label = ui.new_label( aatab[1], aatab[2], "LUA Name color" ),
banepa_colourpicker = ui.new_color_picker( aatab[1], aatab[2], "byc", 255, 255, 255, 255 ),
arrow_label = ui.new_label( aatab[1], aatab[2], "Arrow color" ),
arrow_colourpicker = ui.new_color_picker( aatab[1], aatab[2], "cac", 255, 151, 0, 255 ),
}
local set_cfg = ui.new_button(aatab[1], aatab[2], "Set default config", function()
ui.set(aa.enable_checkbox, true)
ui.set(aa.jitter_checkbox, true)
ui.set(aa.lowdelta_slow_walk_checkbox, true)
ui.set(aa.in_air_checkbox, true)
ui.set(aa.legmovement_checkbox, true)
ui.set(aa.legit_aa_on_e, true)
ui.set(visuals.configure_vis_combobox, "Text & Indicators")
ui.set(visuals.indicators_multiselect, "Screen indicators", "Arrows")
ui.set(visuals.textindicators_multiselect, "Screen indicators", "LUA Name", "AA State", "Ragebot state indicators")
ui.set(visuals.indicatorypos_slider, "-38")
ui.set(visuals.fontstyle_combobox, "Bold")
ui.set(visuals.centered_text, true)
end)
local reset_cfg = ui.new_button(aatab[1], aatab[2], "Reset config", function()
ui.set(aa.enable_checkbox, true)
ui.set(aa.jitter_checkbox, false)
ui.set(aa.lowdelta_slow_walk_checkbox, false)
ui.set(aa.in_air_checkbox, false)
ui.set(aa.legmovement_checkbox, false)
ui.set(aa.legit_aa_on_e, false)
-- ui.set(aa.increase_speed, false)
-- ui.set(aa.dt_accuracy, false)
ui.set(visuals.configure_vis_combobox, "Text & Indicators")
ui.set(visuals.indicators_multiselect, "Screen indicators", "")
ui.set(visuals.textindicators_multiselect, "Screen indicators")
ui.set(visuals.indicatorypos_slider, "0")
ui.set(visuals.fontstyle_combobox, "Block")
ui.set(visuals.centered_text, false)
end)
-- anti-aim references
local ref_aa_enabled = ui.reference( "AA", "Anti-aimbot angles", "Enabled" )
local ref_body_freestanding = ui.reference( "AA", "Anti-aimbot angles", "Freestanding body yaw" )
local ref_pitch = ui.reference( "AA", "Anti-aimbot angles", "Pitch" )
local ref_yaw, ref_yaw_offset = ui.reference( "AA", "Anti-aimbot angles", "Yaw" )
local ref_body_yaw, ref_body_yaw_offset = ui.reference( "AA", "Anti-aimbot angles", "Body yaw" )
local ref_yaw_base = ui.reference( "AA", "Anti-aimbot angles", "Yaw base" )
local ref_jitter, ref_jitter_slider = ui.reference( "AA", "Anti-aimbot angles", "Yaw jitter" )
local ref_fake_limit = ui.reference( "AA", "Anti-aimbot angles", "Fake yaw limit" )
local ref_edge_yaw = ui.reference( "AA", "Anti-aimbot angles", "Edge yaw" )
local ref_freestanding, ref_freestanding_key = ui.reference( "AA", "Anti-aimbot angles", "Freestanding" )
local ref_fake_lag = ui.reference ( "AA", "Fake lag", "Amount" )
local ref_fake_lag_limit = ui.reference ( "AA", "Fake lag", "Limit" )
local ref_fakeduck = ui.reference ( "RAGE", "Other", "Duck peek assist" )
local ref_legmovement = ui.reference ( "AA", "Other", "Leg movement" )
local ref_slow_walk, ref_slow_walk_key = ui.reference ( "AA", "Other", "Slow motion" )
-- rage references
local ref_doubletap = { ui.reference( "RAGE", "Other", "Double Tap" ) }
local ref_doubletaptwo = ui.reference( "RAGE", "Other", "Double Tap" )
local ref_dt_hit_chance = ui.reference( "RAGE", "Other", "Double tap hit chance" )
local ref_osaa, ref_osaa_hkey = ui.reference( "AA", "Other", "On shot anti-aim" )
local ref_mindmg = ui.reference( "RAGE", "Aimbot", "Minimum damage" )
local ref_fba_key = ui.reference( "RAGE", "Other", "Force body aim" )
local ref_fsp_key = ui.reference( "RAGE", "Aimbot", "Force safe point" )
-- misc references
local sv_maxusrcmdprocessticks = ui.reference( "MISC", "Settings", "sv_maxusrcmdprocessticks" )
-- end of menu references and menu creation
-- main vars
-- anti-aim vars
local predict_ticks = 17
local in_yaw = -5
local out_yaw = -3
local randomiser_allowed = true
local aa_yaw = -5
local allow_reset_hit = true
local static_yaw = 0
local shooting_low_delta = false
local low_delta_hit = false
local should_swap = false
local last_time_peeked = nil
-- indicator vars
local dtState_y = 0
local hsState_y = 0
local baimstate_y = 0
local spstate_y = 0
local freestandState_y = 0
local cur_alpha = 255
local target_alpha = 0
local max_alpha = 255
local min_alpha = 0
local speed = 0.04
-- log info vars
local AASTATE_INFO = "UNKNOWN"
local INVERTS_INFO = 0
local ANTIBF_INFO = "NOT_INVERTED"
-- dt hitchance vars
local hitchance = 0
local vel = 0
local spread_compensation = 0
-- dt vars
local next_attack = 0
local next_shot_secondary = 0
local next_shot = 0
-- end of vars
-- create the table where info will be stored
local data = {
side = 1,
last_side = 0,
last_hit = 0,
hit_side = 0
}
-- end of table
-- start of FUNCTIONS
-- this will check what is chosen in the multiselect box for indicators
local function draw_circle( ctx, x, y, r, g, b, a, radius, start_degrees, percentage )
client.draw_circle( ctx, x, y, r, g, b, a, radius, start_degrees, percentage )
end
local function draw_rectangle(x, y, w, h, r, g, b, a)
renderer.rectangle(x, y, w, h, r, g, b, a)
end
local function draw_gradient( ctx, x, y, w, h, r1, g1, b1, a1, r2, g2, b2, a2, ltr )
client.draw_gradient( ctx, x, y, w, h, r1, g1, b1, a1, r2, g2, b2, a2, ltr )
end
local function draw_circle_outline( ctx, x, y, r, g, b, a, radius, start_degrees, percentage, thickness )
client.draw_circle_outline( ctx, x, y, r, g, b, a, radius, start_degrees, percentage, thickness )
end
local function contains( tab, val )
for index, value in ipairs( tab ) do
if value == val then return true end
end
return false
end
--function dt_speed( )
-- ui.set_visible( sv_maxusrcmdprocessticks, true )
-- ui.set_callback( aa.increase_speed, function( ) ui.set( sv_maxusrcmdprocessticks, ui.get( aa.increase_speed ) and 18 or 16 ) cvar.cl_clock_correction:set_int( ui.get( aa.increase_speed ) and 0 or 1 ) end )
-- ui.set_callback( ref_fake_lag_limit, function( ) ui.set( ref_fake_lag_limit, math.min( 14, ui.get( ref_fake_lag_limit ) ) ) end )
--end
-- get nearest function
-- distance conversion
local function units_to_meters( units )
return math.floor( ( units*0.0254 )+0.5)
end
local function units_to_feet( units )
return math.floor( ( units_to_meters( units )*3.281 )+0.5 )
end
-- end of distance conversion
-- this gets the closest target -- thanks to peer
local function get_nearest( )
local me = Vector3( entity.get_prop( entity.get_local_player( ), "m_vecOrigin" ) )
local nearest_distance
local nearest_entity
for _, player in ipairs( entity.get_players( true ) ) do
local target = Vector3( entity.get_prop( player, "m_vecOrigin") )
local _distance = me:dist_to( target )
if ( nearest_distance == nil or _distance < nearest_distance ) then
nearest_entity = player
nearest_distance = _distance
end
end
if ( nearest_distance ~= nil and nearest_entity ~= nil ) then
return ( { target = nearest_entity, distance = units_to_feet( nearest_distance ) } )
end
end
-- end of getting closest target
-- start of dt function to check whether dt is charged or not
local function is_dt( )
local dt = false
local local_player = entity.get_local_player()
if local_player == nil then
return
end
if not entity.is_alive( local_player ) then
return
end
local active_weapon = entity.get_prop( local_player, "m_hActiveWeapon" )
if active_weapon == nil then
return
end
next_attack = entity.get_prop( local_player,"m_flNextAttack" )
next_shot = entity.get_prop( active_weapon,"m_flNextPrimaryAttack" )
next_shot_secondary = entity.get_prop( active_weapon,"m_flNextSecondaryAttack" )
if next_attack == nil or next_shot == nil or next_shot_secondary == nil then
return
end
next_attack = next_attack+0.5
next_shot = next_shot+0.5
next_shot_secondary = next_shot_secondary+0.5
if ui.get( ref_doubletap[ 1 ] ) and ui.get( ref_doubletap[ 2 ] ) then
if math.max( next_shot, next_shot_secondary ) < next_attack then
if next_attack-globals.curtime( ) > 0.00 then
dt = false
else
dt = true
end
else -- shooting or just shot
if math.max( next_shot, next_shot_secondary )-globals.curtime( ) > 0.00 then
dt = false
else
if math.max( next_shot, next_shot_secondary )-globals.curtime( ) < 0.00 then
dt = true
else
dt = true
end
end
end
end
return dt
end
-- end of dt function to check whether dt is charged or not
-- start of the anti-aim peeking function for smart jitter
local function get_near_target( )
local enemy_players = entity.get_players( true )
if #enemy_players ~= 0 then
local own_x, own_y, own_z = client.eye_position( )
local own_pitch, own_yaw = client.camera_angles( )
local closest_enemy = nil
local closest_distance = 999999999
for i = 1, #enemy_players do
local enemy = enemy_players[i]
local enemy_x, enemy_y, enemy_z = entity.get_prop( enemy, "m_vecOrigin" )
local x = enemy_x - own_x
local y = enemy_y - own_y
local z = enemy_z - own_z
local yaw = ( ( math.atan2( y, x )*180/math.pi ) )
local pitch = -( math.atan2( z, math.sqrt( math.pow( x, 2 ) + math.pow( y, 2 ) ) )*180/math.pi )
local yaw_dif = math.abs( own_yaw%360-yaw%360 )%360
local pitch_dif = math.abs( own_pitch-pitch )%360
if yaw_dif > 180 then yaw_dif = 360-yaw_dif end
local real_dif = math.sqrt( math.pow( yaw_dif, 2)+math.pow( pitch_dif, 2 ) )
if closest_distance > real_dif then
closest_distance = real_dif
closest_enemy = enemy
end
end
if closest_enemy ~= nil then
return closest_enemy, closest_distance
end
end
return nil, nil
end
-- end of the anti-aim peeking function for smart jitter
-- this is a function to help with on peeking and getting peeked functions
local function distance_3d( x1, y1, z1, x2, y2, z2 )
return math.sqrt( ( x1-x2 )*( x1-x2 )+( y1-y2 )*( y1-y2 ) )
end
-- function for extrapolating player
local function extrapolate( player , ticks , x, y, z )
local xv, yv, zv = entity.get_prop( player, "m_vecVelocity" )
local new_x = x+globals.tickinterval( )*xv*ticks
local new_y = y+globals.tickinterval( )*yv*ticks
local new_z = z+globals.tickinterval( )*zv*ticks
return new_x, new_y, new_z
end
-- end of functions to help with on peeking and getting peeked functions
-- this is the start of a function for detecting whether the local player is peeking an enemy
local function is_enemy_peeking( player )
local vx,vy,vz = entity.get_prop( player, "m_vecVelocity" )
local speed = math.sqrt( vx*vx+vy*vy+vz*vz )
if speed < 5 then
return false
end
local ex, ey, ez = entity.get_origin( player )
local lx, ly, lz = entity.get_origin( entity.get_local_player ( ) )
local start_distance = math.abs( distance_3d( ex, ey, ez, lx, ly, lz ) )
local smallest_distance = 999999
for ticks = 1, predict_ticks do
local tex,tey,tez = extrapolate( player, ticks, ex, ey, ez )
local distance = math.abs( distance_3d( tex, tey, tez, lx, ly, lz ) )
if distance < smallest_distance then
smallest_distance = distance
end
if smallest_distance < start_distance then
return true
end
end
--client.log(smallest_distance .. " " .. start_distance)
return smallest_distance < start_distance
end
-- this is the end of a function for detecting whether the local player is peeking an enemy
-- this is the start of a function for detecting whether the enemy is peeking the local player
local function is_local_peeking_enemy( player )
local vx,vy,vz = entity.get_prop( entity.get_local_player(), "m_vecVelocity")
local speed = math.sqrt( vx*vx+vy*vy+vz*vz )
if speed < 5 then
return false
end
local ex,ey,ez = entity.get_origin( player )
local lx,ly,lz = entity.get_origin( entity.get_local_player() )
local start_distance = math.abs( distance_3d( ex, ey, ez, lx, ly, lz ) )
local smallest_distance = 999999
if ticks ~= nil then
TICKS_INFO = ticks
else
end
for ticks = 1, predict_ticks do
local tex,tey,tez = extrapolate( entity.get_local_player(), ticks, lx, ly, lz )
local distance = distance_3d( ex, ey, ez, tex, tey, tez )
if distance < smallest_distance then
smallest_distance = math.abs(distance)
end
if smallest_distance < start_distance then
return true
end
end
return smallest_distance < start_distance
end
-- this is the end of a function for detecting whether the enemy is peeking the local player
function in_air( )
return ( bit.band( entity.get_prop( entity.get_local_player( ), "m_fFlags" ), 1 ) == 0 )
end
local function get_closest_point(A, B, P)
local a_to_p = { P[1] - A[1], P[2] - A[2] }
local a_to_b = { B[1] - A[1], B[2] - A[2] }
local ab = a_to_b[1]^2 + a_to_b[2]^2
local dots = a_to_p[1]*a_to_b[1] + a_to_p[2]*a_to_b[2]
local t = dots / ab
return { A[1] + a_to_b[1]*t, A[2] + a_to_b[2]*t }
end
local function vec3_dot(ax, ay, az, bx, by, bz)
return ax*bx + ay*by + az*bz
end
local function vec3_normalize(x, y, z)
local len = math.sqrt(x * x + y * y + z * z)
if len == 0 then
return 0, 0, 0
end
local r = 1 / len
return x*r, y*r, z*r
end
local function angle_to_vec(pitch, yaw)
local p, y = math.rad(pitch), math.rad(yaw)
local sp, cp, sy, cy = math.sin(p), math.cos(p), math.sin(y), math.cos(y)
return cp*cy, cp*sy, -sp
end
local function get_fov_cos(ent, vx,vy,vz, lx,ly,lz)
local ox,oy,oz = entity.get_prop(ent, "m_vecOrigin")
if ox == nil then
return -1
end
-- get direction to player
local dx,dy,dz = vec3_normalize(ox-lx, oy-ly, oz-lz)
return vec3_dot(dx,dy,dz, vx,vy,vz)
end
local function Angle_Vector(angle_x, angle_y)
local sp, sy, cp, cy = nil
sy = math.sin(math.rad(angle_y));
cy = math.cos(math.rad(angle_y));
sp = math.sin(math.rad(angle_x));
cp = math.cos(math.rad(angle_x));
return cp * cy, cp * sy, -sp;
end
-- start of MAIN FUNCTIONS
-- TARGET CAN SEE OUR HEAD
function can_enemy_hit_head( ent )
if ent == nil then return end
if in_air( ent ) then return false end
local origin_x, origin_y, origin_z = entity_get_prop( ent, "m_vecOrigin" )
if origin_z == nil then return end
origin_z = origin_z + 64
local hx,hy,hz = entity.hitbox_position( entity.get_local_player( ), 0 )
local _, head_dmg = client.trace_bullet( ent, origin_x, origin_y, origin_z, hx, hy, hz, true )
return head_dmg ~= nil and head_dmg > 25
end
-- this gets the current bomb time if planted
local function get_bomb_time( )
local bomb = entity.get_all( "CPlantedC4" )[1]
if bomb == nil then
return 0
end
local bomb_time = entity.get_prop( bomb, "m_flC4Blow" )-globals.curtime( )
if bomb_time == nil then
return 0
end
if bomb_time > 0 then
return bomb_time
end
return 0
end
-- end of function for getting bomb time
-- checks if the local player has a defuser
local function has_defuser( player )
return entity.get_prop( player, "m_bHasDefuser" ) == 1
end
-- end of checking if the local player has a defuser
local function side_freestanding( cmd )
-- gets the local player
local local_player = entity.get_local_player( )
-- checks if our local player is dead
if ( not local_player or entity.get_prop( local_player, "m_lifeState" ) ~= 0 ) or not ui.get( aa.enable_checkbox ) == true then
return
end
local server_time = globals.curtime( )
-- check if we have invert desync on side is done
if data.hit_side ~= 0 and server_time - data.last_hit > 5 then
-- if so set the last side to '0' so the anti-aim updates
data.last_side = 0
-- And reset the smart mode info
data.last_hit = 0
data.hit_side = 0
end
-- Get what mode our freestanding is using
local _mode = ui.get( aa.freestand_mode_combobox )
-- Get some properties
local x, y, z = client.eye_position( )
local _, yaw = client.camera_angles( )
-- Create a table where the trace data will be stored
local trace_data = { left = 0, right = 0 }
for i = yaw-120, yaw+120, 30 do
-- don't do any calculations if the yaw is the correct value
-- this means that this is the center point
if i ~= yaw then
-- Convert our yaw to radians in order to do further calculations
local rad = math.rad( i )
-- Calculate our destination point
local px, py, pz = x+256*math.cos( rad ), y+256*math.sin( rad ), z
-- Trace a line from our eye position to the previously calculated point
local fraction = client.trace_line( local_player, x, y, z, px, py, pz )
local side = i < yaw and "left" or "right"
-- Add the trace's fraction to the trace table
trace_data[ side ] = trace_data[ side ]+fraction
end
end
-- Get which side has the lowest fraction amount, which means that it is closer to us.
data.side = trace_data.left < trace_data.right and 1 or 2
-- If our side didn't change from the last tick then there's no need to update our anti-aim
if data.side == data.last_side then
return
end
-- If it did change, then update our cached side to do further checks
data.last_side = data.side
-- Check if we should override our side due to the smart mode
if data.hit_side ~= 0 then
data.side = data.hit_side == 1 and 2 or 1
end
-- Get the fake angle's maximum length and calculate what our next body offset should be
local limit = 90
local lby = _mode == "Reversed" and ( data.side == 1 and limit or -limit ) or ( data.side == 1 and -limit or limit )
static_yaw = lby
-- Update our body yaw settings
ui.set( ref_body_yaw_offset, limit )
end
-- this is the check for checking if we should use eye yaw or opposite
local multi_exec = function(func, list)
if func == nil then
return
end
for ref, val in pairs(list) do
func(ref, val)
end
end
local compare = function(tab, val)
for i = 1, #tab do
if tab[i] == val then
return true
end
end
return false
end
--#endregion /helpers
local bind_system = {
left = false,
right = false,
back = false,
}
function bind_system:update()
ui.set( aa.manual_left_hotkey, "On hotkey" )
ui.set( aa.manual_right_hotkey , "On hotkey" )
ui.set( aa.manual_back_hotkey, "On hotkey" )
local m_state = ui.get( aa.manual_state )
local left_state, right_state, backward_state =
ui.get( aa.manual_left_hotkey ),
ui.get( aa.manual_right_hotkey ),
ui.get( aa.manual_back_hotkey )
if left_state == self.left and
right_state == self.right and
backward_state == self.back then
return
end
self.left, self.right, self.back =
left_state,
right_state,
backward_state
if (left_state and m_state == 1) or (right_state and m_state == 2) or (backward_state and m_state == 3) then
ui.set( aa.manual_state , 0)
return
end
if left_state and m_state ~= 1 then
ui.set( aa.manual_state , 1)
end
if right_state and m_state ~= 2 then
ui.set( aa.manual_state , 2)
end
if backward_state and m_state ~= 3 then
ui.set( aa.manual_state , 3)
end
end
local menu_callback = function(e, menu_call)
local state = not ui.get( aa.manualaa_checkbox ) -- or (e == nil and menu_call == nil)
multi_exec(ui.set_visible, {
[ aa.manual_left_hotkey ] = not state,
[ aa.manual_right_hotkey ] = not state,
[ aa.manual_back_hotkey ] = not state,
[ aa.manual_state ] = false,
})
end
ui.set_callback( aa.manualaa_checkbox , menu_callback)
function handle_manual_anti_aim()
local direction = ui.get( aa.manual_state )
manual_yaw =
{
[0] = 0,
[1] = -90,
[2] = 90,
[3] = 0,
}
if ui.get( aa.manualaa_checkbox ) then
if direction == 1 or direction == 2 then
ui.set( ref_yaw_base, "Local view" )
else
ui.set( ref_yaw_base, "At targets" )
end
end
if ui.get( aa.manualaa_checkbox ) then
ui.set( ref_yaw_offset, manual_yaw[direction] )
end
local callback = enabled and client.set_event_callback or client.unset_event_callback
end
-- start of setup_command
local reset = false
local function on_setup_command( cmd )
if ui.get( aa.legit_aa_on_e ) then
local gun = entity.get_player_weapon( entity.get_local_player( ) )
if gun ~= nil and entity.get_classname( gun ) == "CC4" then
if cmd.in_attack == 1 then
cmd.in_attack = 0
cmd.in_use = 1
end
else
if cmd.chokedcommands == 0 then
cmd.in_use = 0
end
end
end
-- this gets the desync angle of the local player
if cmd.chokedcommands == 0 then
angle = cmd.in_use == 0 and ui.get( ref_aa_enabled ) and ui.get( ref_body_yaw ) ~= "Off" and math.min( 57, math.abs( entity.get_prop( entity.get_local_player( ), "m_flPoseParameter", 11 )*120-60 ) ) or 0
end
--fakelag
choked_commands = cmd.chokedcommands
local bFreezePeriod = entity.get_prop(entity.get_game_rules(), "m_bFreezePeriod")
if bFreezePeriod then
INVERTS_INFO = 0
ui.set( ref_fake_limit, 58 )
end
if ui.get(aa.ideal_peek) then
ui.set(ref_doubletap[1], true)
ui.set(ref_doubletap[2], "Always on")
ui.set(ref_freestanding_key, "Always on")
ui.set(ref_freestanding, "Default")
ui.set(ref_fake_lag_limit, 1)
reset = false
else
if not reset then
ui.set(ref_doubletap[1], true)