-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrage_aimbot.cpp
3997 lines (3560 loc) · 147 KB
/
rage_aimbot.cpp
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
#include "rage_aimbot.hpp"
#include "source.hpp"
#include "entity.hpp"
#include "player.hpp"
#include "weapon.hpp"
#include "hooked.hpp"
#include "math.hpp"
#include "displacement.hpp"
#include "lag_comp.hpp"
#include "anti_aimbot.hpp"
#include "resolver.hpp"
#include "visuals.hpp"
#include "menu.hpp"
#include "movement.hpp"
#include "prediction.hpp"
#include "autowall.hpp"
#include "misc.hpp"
#include "usercmd.hpp"
static constexpr auto total_seeds = 128;
static constexpr auto autowall_traces = 48;
std::vector<TargetListing_t> m_entities;
void c_aimbot::get_hitbox_data(C_Hitbox* rtn, C_BasePlayer* ent, int ihitbox, matrix3x4_t* matrix)
{
if (ihitbox < 0 || ihitbox > 19) return;
if (!ent) return;
const model_t* const model = ent->GetModel();
if (!model)
return;
studiohdr_t* const pStudioHdr = csgo.m_model_info()->GetStudioModel(model);
if (!pStudioHdr)
return;
mstudiobbox_t* const hitbox = pStudioHdr->pHitbox(ihitbox, ent->m_nHitboxSet());
if (!hitbox)
return;
const auto is_capsule = hitbox->radius != -1.f;
Vector min, max;
if (is_capsule) {
Math::VectorTransform(hitbox->bbmin, matrix[hitbox->bone], min);
Math::VectorTransform(hitbox->bbmax, matrix[hitbox->bone], max);
}
else
{
min = Math::VectorRotate(hitbox->bbmin, hitbox->rotation);
max = Math::VectorRotate(hitbox->bbmax, hitbox->rotation);
Math::VectorTransform(min, matrix[hitbox->bone], min);
Math::VectorTransform(max, matrix[hitbox->bone], max);
}
rtn->hitboxID = ihitbox;
rtn->isOBB = !is_capsule;
rtn->radius = hitbox->radius;
rtn->mins = min;
rtn->maxs = max;
rtn->hitgroup = hitbox->group;
rtn->hitbox = hitbox;
Math::VectorITransform(ctx.m_eye_position, matrix[hitbox->bone], rtn->start_scaled);
rtn->bone = hitbox->bone;
}
//bool c_aimbot::safe_static_point(C_BasePlayer* entity, Vector eye_pos, Vector aim_point, int hitboxIdx)
//{
// auto resolve_info = &feature::resolver->player_records[entity->entindex() - 1];
// auto log = &feature::lagcomp->records[entity->entindex() - 1];
//
// if (!log->best_record->shot_this_tick)
// return true;
//
// const auto is_colliding = [entity, hitboxIdx](Vector start, Vector end, C_Hitbox box) -> bool
// {
// //cheat::features::lagcomp.apply_record_data(entity, rec);
// const auto is_intersecting = box.isOBB ? Math::IntersectBB(start, end, box.mins, box.maxs) : Math::Intersect(start, end, box.mins, box.maxs, box.radius);
// //Source::m_pEngineTrace->ClipRayToEntity(ray, MASK_SHOT | CONTENTS_GRATE, entity, &tr);
// //const auto walldamage = cheat::features::autowall.CanHit(start, end, cheat::main::local(), entity, hitboxIdx);
// //cheat::features::lagcomp.apply_record_data(entity, orgtc);
//
// return is_intersecting;
// };
//
// /*Vector angles, direction;
// auto v6 = aim_point - eye_pos;
// Math::VectorAngles(v6, angles);
// Math::AngleVectors(angles, &direction);
// direction.Normalize();
// const auto end_point = direction * 8092.f + eye_pos;*/
// const auto angle = Math::CalcAngle(eye_pos, aim_point);
// Vector forward;
// Math::AngleVectors(angle, &forward);
// auto end = eye_pos + forward * 8092.f;
//
// //Source::m_pDebugOverlay->AddLineOverlay(eye_pos, end, 255, 0, 0, false, Source::m_pGlobalVars->interval_per_tick * 2.f);
//
// C_Hitbox box1; get_hitbox_data(&box1, entity, hitboxIdx, log->best_record->leftlmatrixes);
// C_Hitbox box2; get_hitbox_data(&box2, entity, hitboxIdx, log->best_record->rightlmatrixes);
//
// if (box1.isOBB || box2.isOBB)
// return true;
//
// //C_Tickrecord rec;
// //cheat::features::lagcomp.store_record_data(entity, &rec);
//
// if (is_colliding(eye_pos, end, box2))
// return true;
// if (is_colliding(eye_pos, end, box1))//is_colliding(eye_pos, end_point, &resolve_info->leftlrec, &rec))
// return true;
//
// return false;
//}
Vector c_aimbot::get_hitbox(C_BasePlayer* ent, int ihitbox, matrix3x4_t mat[])
{
if (ihitbox < 0 || ihitbox > 19) return Vector::Zero;
if (!ent) return Vector::Zero;
if (!ent->GetClientRenderable())
return Vector::Zero;
const model_t* const model = ent->GetModel();
if (!model)
return Vector::Zero;
studiohdr_t* const pStudioHdr = csgo.m_model_info()->GetStudioModel(model);
if (!pStudioHdr)
return Vector::Zero;
mstudiobbox_t* const hitbox = pStudioHdr->pHitbox(ihitbox, ent->m_nHitboxSet());
if (!hitbox)
return Vector::Zero;
if (hitbox->bone > 128 || hitbox->bone < 0)
return Vector::Zero;
Vector min, max;
Vector top_point;
constexpr float rotation = 0.70710678f;
Math::VectorTransform(hitbox->bbmin, mat[hitbox->bone], min);
Math::VectorTransform(hitbox->bbmin, mat[hitbox->bone], max);
auto center = (min + max) / 2.f;
return center;
}
//float c_aimbot::can_hit(int hitbox, C_BasePlayer* Entity, Vector position, matrix3x4_t mx[], bool check_center, bool predict)
//{
// static auto is_visible = [](C_BasePlayer* thisptr, Vector& Start, Vector& End) -> bool
// {
// if (!thisptr) return NULL;
//
// CGameTrace tr;
// Ray_t ray;
// static CTraceFilter traceFilter;
// traceFilter.pSkip = ctx.m_local();
//
// ray.Init(Start, End);
//
// Source::m_pEngineTrace->TraceRay(ray, MASK_SHOT_HULL | CONTENTS_HITBOX, &traceFilter, &tr);
// cheat::features::autowall.FixTraceRay(Start, End, &tr, thisptr);
//
// return (tr.m_pEnt == thisptr || tr.fraction > 0.99f);
// };
//
// auto local_weapon = (C_WeaponCSBaseGun*)(csgo.m_entity_list()->GetClientEntityFromHandle(ctx.m_local()->m_hActiveWeapon()));
//
// if (!local_weapon->GetCSWeaponData())
// return 0;
//
// auto eyepos = ctx.m_eye_position;
//
// auto cdmg = cheat::features::autowall.CanHit(eyepos, position, ctx.m_local(), Entity, hitbox);
//
// auto nob = (Entity->m_iHealth() < cheat::Cvars.RageBot_MinDamage.GetValue() && cheat::Cvars.RageBot_ScaledmgOnHp.GetValue() ? Entity->m_iHealth() : ((cheat::Cvars.RageBot_MinDmgKey.GetValue() && cheat::game::pressed_keys[(int)cheat::Cvars.RageBot_MinDmgKey.GetValue()]) ? cheat::Cvars.RageBot_MinDamage.GetValue() : cheat::Cvars.RageBot_MinDmgKey_val.GetValue()));
//
// if (check_center) {
// if (cdmg >= nob)
// return cdmg;
//
// return 0.f;
// }
//
// static std::vector<Vector> points;
//
// if (Entity->get_multipoints(hitbox, points, mx) && !points.empty())
// {
// cheat::main::points[Entity->entindex() - 1][hitbox] = points;
//
// //if (cdmg >= nob)
// // return cdmg;
//
// if (hitbox != 11 && hitbox != 12)
// {
//
// //auto dmg = cheat::features::autowall.CanHit(eyepos, points.at(1), ctx.m_local(), Entity, hitbox);
// //auto dmg2 = cheat::features::autowall.CanHit(eyepos, points.at(2), ctx.m_local(), Entity, hitbox);
// //auto dmg3 = cheat::features::autowall.CanHit(eyepos, points.at(3), ctx.m_local(), Entity, hitbox);
//
// if (hitbox == 0) {
// auto dmg = cheat::features::autowall.CanHit(eyepos, points.at(1), ctx.m_local(), Entity, hitbox);
// auto dmg2 = cheat::features::autowall.CanHit(eyepos, points.at(4), ctx.m_local(), Entity, hitbox);
// auto dmg3 = cheat::features::autowall.CanHit(eyepos, points.at(3), ctx.m_local(), Entity, hitbox);
//
// if (max(dmg, max(dmg2, dmg3)) >= nob)
// return dmg;
// }
// else
// {
// auto dmg = cheat::features::autowall.CanHit(eyepos, points.at(1), ctx.m_local(), Entity, hitbox);
// auto dmg2 = cheat::features::autowall.CanHit(eyepos, points.at(6), ctx.m_local(), Entity, hitbox);
// auto dmg3 = cheat::features::autowall.CanHit(eyepos, points.at(4), ctx.m_local(), Entity, hitbox);
//
// //auto dmg = cheat::features::autowall.CanHit(eyepos, points.at(1), ctx.m_local(), Entity, hitbox);
// //auto dmg2 = cheat::features::autowall.CanHit(eyepos, points.at(2), ctx.m_local(), Entity, hitbox);
// //auto dmg3 = cheat::features::autowall.CanHit(eyepos, points.at(3), ctx.m_local(), Entity, hitbox);
//
// if (max(dmg, max(dmg2, dmg3)) >= nob)
// return dmg;
// }
// }
// else
// {
// auto dmg1 = cheat::features::autowall.CanHit(eyepos, points.at(0), ctx.m_local(), Entity, hitbox);
// auto dmg2 = cheat::features::autowall.CanHit(eyepos, points.at(1), ctx.m_local(), Entity, hitbox);
//
// if (max(dmg1, dmg2) >= nob)
// return max(dmg1, dmg2);
// }
// }
//
// if (cdmg >= nob)
// return cdmg;
//
// return 0;
//}
int c_aimbot::hitbox2hitgroup(C_BasePlayer* m_player, int ihitbox)
{
if (ihitbox < 0 || ihitbox > 19) return 0;
if (!m_player) return 0;
const model_t* const model = m_player->GetModel();
if (!model)
return 0;
studiohdr_t* const pStudioHdr = csgo.m_model_info()->GetStudioModel(model);
if (!pStudioHdr)
return 0;
mstudiobbox_t* const hitbox = pStudioHdr->pHitbox(ihitbox, m_player->m_nHitboxSet());
if (!hitbox)
return 0;
return hitbox->group;
switch (ihitbox)
{
case HITBOX_HEAD:
case HITBOX_NECK:
return HITGROUP_HEAD;
case HITBOX_UPPER_CHEST:
case HITBOX_CHEST:
case HITBOX_THORAX:
case HITBOX_LEFT_UPPER_ARM:
case HITBOX_RIGHT_UPPER_ARM:
return HITGROUP_CHEST;
case HITBOX_PELVIS:
case HITBOX_LEFT_THIGH:
case HITBOX_RIGHT_THIGH:
case HITBOX_BODY:
return HITGROUP_STOMACH;
case HITBOX_LEFT_CALF:
case HITBOX_LEFT_FOOT:
return HITGROUP_LEFTLEG;
case HITBOX_RIGHT_CALF:
case HITBOX_RIGHT_FOOT:
return HITGROUP_RIGHTLEG;
case HITBOX_LEFT_FOREARM:
case HITBOX_LEFT_HAND:
return HITGROUP_LEFTARM;
case HITBOX_RIGHT_FOREARM:
case HITBOX_RIGHT_HAND:
return HITGROUP_RIGHTARM;
default:
return HITGROUP_STOMACH;
}
}
int c_aimbot::safe_point(C_BasePlayer* entity, Vector eye_pos, Vector aim_point, int hitboxIdx, C_Tickrecord* record)
{
resolver_records* resolve_info = &feature::resolver->player_records[entity->entindex() - 1];
c_player_records* log = &feature::lagcomp->records[entity->entindex() - 1];
//auto baimkey_shit = (cheat::Cvars.RageBot_SafePointsBaimKey.GetValue() && (cheat::game::pressed_keys[(int)cheat::Cvars.RageBot_BaimKey.GetValue()] && cheat::Cvars.RageBot_BaimKey.GetValue() > 0.f));
//auto can_safepoint = log->best_record != nullptr && !log->best_record->shot_this_tick && hitboxIdx < 2;
//if (!can_safepoint && !(baimkey_shit && ctx.m_settings.aimbot_bodyaim_key.GetValue() != 0.f))
// return true;
if (!record || !record->data_filled || !record->valid)
return 0;
const auto is_colliding = [entity, hitboxIdx](Vector start, Vector end, C_Hitbox* hbox_data, matrix3x4_t *mx) -> bool
{
Ray_t ray;
trace_t tr;
ray.Init(start, end);
tr.fraction = 1.0f;
tr.startsolid = false;
if (hbox_data->isOBB)
{
auto dir = end - start;
dir.NormalizeInPlace();
Vector delta;
Math::VectorIRotate((dir * 8192.f), mx[hbox_data->bone], delta);
return Math::IntersectBB(hbox_data->start_scaled, delta, hbox_data->mins, hbox_data->maxs);
}
else
{
if (Math::Intersect(ctx.m_eye_position, end, hbox_data->mins, hbox_data->maxs, hbox_data->radius))
return true;
}
return false;
};
auto forward = aim_point - eye_pos;
auto end = eye_pos + (forward * 8192.f);
C_Hitbox box1; get_hitbox_data(&box1, entity, hitboxIdx, record->leftmatrixes);
C_Hitbox box2; get_hitbox_data(&box2, entity, hitboxIdx, record->rightmatrixes);
C_Hitbox box3; get_hitbox_data(&box3, entity, hitboxIdx, record->matrixes);
int hits = 0;
if (is_colliding(eye_pos, end, &box1, record->leftmatrixes)) ++hits;
if (is_colliding(eye_pos, end, &box2, record->rightmatrixes)) ++hits;
if (is_colliding(eye_pos, end, &box3, record->matrixes)) ++hits;
return hits;
}
bool c_aimbot::safe_side_point(C_BasePlayer* entity, Vector eye_pos, Vector aim_point, int hitboxIdx, C_Tickrecord* record)
{
resolver_records* resolve_info = &feature::resolver->player_records[entity->entindex() - 1];
c_player_records* log = &feature::lagcomp->records[entity->entindex() - 1];
//auto baimkey_shit = (cheat::Cvars.RageBot_SafePointsBaimKey.GetValue() && (cheat::game::pressed_keys[(int)cheat::Cvars.RageBot_BaimKey.GetValue()] && cheat::Cvars.RageBot_BaimKey.GetValue() > 0.f));
//auto can_safepoint = log->best_record != nullptr && !log->best_record->shot_this_tick && hitboxIdx < 2;
//if (!can_safepoint && !(baimkey_shit && cheat::Cvars.RageBot_SafePointsBaimKey.GetValue() != 0.f))
// return true;
if (!record || !record->data_filled || !record->valid)
return false;
const auto angle = Math::CalcAngle(eye_pos, aim_point);
Vector forward;
Math::AngleVectors(angle, &forward);
auto const end(eye_pos + forward * 8192.f)/*(eye_pos.DistanceSquared(aim_point) * 1.01f)*/;
C_Hitbox box1; get_hitbox_data(&box1, entity, hitboxIdx, record->leftmatrixes);
C_Hitbox box2; get_hitbox_data(&box2, entity, hitboxIdx, record->rightmatrixes);
C_Hitbox box3; get_hitbox_data(&box3, entity, hitboxIdx, record->matrixes);
//C_Tickrecord rec;
//cheat::features::lagcomp.store_record_data(entity, &rec);
auto hits = 0;
//if (pizdets ? Math::IntersectBB(eye_pos, end, box1.mins, box1.maxs) : Math::Intersect(eye_pos, end, box1.mins, box1.maxs, box1.radius))//if (is_colliding(eye_pos, end_point, &resolve_info->leftrec, &rec))
// ++hits;
//if (pizdets ? Math::IntersectBB(eye_pos, end, box2.mins, box2.maxs) : Math::Intersect(eye_pos, end, box2.mins, box2.maxs, box2.radius))//if (is_colliding(eye_pos, end_point, &resolve_info->rightrec, &rec))
// ++hits;
//if (pizdets ? Math::IntersectBB(eye_pos, end, box3.mins, box3.maxs) : Math::Intersect(eye_pos, end, box3.mins, box3.maxs, box3.radius))//if (is_colliding(eye_pos, end_point, &resolve_info->norec, &rec))
// ++hits;
//bool ok = false;
if (box2.isOBB)
{
Vector delta1;
Math::VectorIRotate((forward * 8192.f), record->leftmatrixes[box1.bone], delta1);
Vector delta2;
Math::VectorIRotate((forward * 8192.f), record->rightmatrixes[box2.bone], delta2);
Vector delta3;
Math::VectorIRotate((forward * 8192.f), record->matrixes[box3.bone], delta3);
if (Math::IntersectBB(box1.start_scaled, delta1, box1.mins, box1.maxs))
++hits;
if (Math::IntersectBB(box2.start_scaled, delta2, box2.mins, box2.maxs))
++hits;
if (/*hitboxIdx <= 5 && hits < 2 && */Math::IntersectBB(box3.start_scaled, delta3, box3.mins, box3.maxs))
++hits;
/*trace_t ll;
Ray_t rr;
rr.Init(eye_pos, end);
for (auto i = 0; i < 2; i++)
{
rr.Init(eye_pos, get_hitbox(entity, hitboxIdx, (i == 2 ? record->rightmatrixes : (i == 1 ? record->leftmatrixes : record->matrixes))));
csgo.m_engine_trace()->ClipRayToEntity(rr, 0x4600400B, entity, &ll);
bool can_damage = (ll.hitgroup >= 0 && ll.hitgroup <= 8);
bool is_required_player = (ll.m_pEnt == entity);
if (can_damage && is_required_player)
++hits;
}*/
}
else
{
if (Math::Intersect(eye_pos, end, box1.mins, box1.maxs, box1.radius))
++hits;
if (Math::Intersect(eye_pos, end, box2.mins, box2.maxs, box2.radius))
++hits;
if (Math::Intersect(eye_pos, end, box3.mins, box3.maxs, box3.radius))
++hits;
}
//if (ok)
// ++hits;
return (hits >= 2);
}
//NEMESIS.IDB
bool c_aimbot::hit_chance(QAngle angle, Vector point, C_BasePlayer* ent, float chance, int hitbox, float damage, float* hc) // elite hitchance
{
auto weap = (C_WeaponCSBaseGun*)(csgo.m_entity_list()->GetClientEntityFromHandle(ctx.m_local()->m_hActiveWeapon()));
if (!weap)
return false;
if (chance < 2.f)
return true;
auto weap_data = weap->GetCSWeaponData();
Vector forward, right, up;
auto eye_position = ctx.m_local()->GetEyePosition();
Math::AngleVectors(angle, &forward, &right, &up);
int TraceHits = 0;
int cNeededHits = static_cast<int>(128.f * (chance / 100.f));
weap->UpdateAccuracyPenalty();
float weap_sir = weap->GetSpread();
float weap_inac = weap->GetInaccuracy();
auto recoil_index = weap->m_flRecoilIndex();
if (weap_sir <= 0.f)
return true;
for (int i = 0; i < 128; i++)
{
float a = RandomFloat(0.f, 1.f);
float b = RandomFloat(0.f, 6.2831855f);
float c = RandomFloat(0.f, 1.f);
float d = RandomFloat(0.f, 6.2831855f);
float inac = a * weap_inac;
float sir = c * weap_sir;
if (weap->m_iItemDefinitionIndex() == 64)
{
a = 1.f - a * a;
a = 1.f - c * c;
}
else if (weap->m_iItemDefinitionIndex() == 28 && recoil_index < 3.0f)
{
for (int i = 3; i > recoil_index; i--)
{
a *= a;
c *= c;
}
a = 1.0f - a;
c = 1.0f - c;
}
// credits: haircuz
else if (!(ctx.m_local()->m_fFlags() & FL_ONGROUND) && weap->m_iItemDefinitionIndex() == 40) {
if (weap->GetInaccuracy() < 0.009f) {
return true;
}
}
Vector sirVec((cos(b) * inac) + (cos(d) * sir), (sin(b) * inac) + (sin(d) * sir), 0), direction;
direction.x = forward.x + (sirVec.x * right.x) + (sirVec.y * up.x);
direction.y = forward.y + (sirVec.x * right.y) + (sirVec.y * up.y);
direction.z = forward.z + (sirVec.x * right.z) + (sirVec.y * up.z);
direction.Normalize();
QAngle viewAnglesSpread;
Math::VectorAngles(direction, up, viewAnglesSpread);
viewAnglesSpread.Normalize();
Vector viewForward;
Math::AngleVectors(viewAnglesSpread, &viewForward);
viewForward.NormalizeInPlace();
viewForward = ctx.m_local()->GetEyePosition() + (viewForward * weap_data->range);
trace_t tr;
Ray_t ray;
ray.Init(ctx.m_local()->GetEyePosition(), viewForward);
// glass fix xD
csgo.m_engine_trace()->ClipRayToEntity(ray, MASK_SHOT | CONTENTS_GRATE | CONTENTS_WINDOW, ent, &tr);
// additional checks if we are actually hitting that specific hitbox.
if (tr.m_pEnt == ent)
if (ctx.m_settings.aimbot_hitbox) {
if (tr.hitgroup == hitbox2hitgroup(ent, hitbox))
++TraceHits;
}
else ++TraceHits;
// adding manual accuracy boost calculation here
if (static_cast<int>((static_cast<float>(TraceHits) / 128.f) * 100.f) >= chance) {
if (((static_cast<float>(TraceHits) / static_cast<float>(128.f)) >= (ctx.m_settings.aimbot_accuracy_boost / 100.f)) || ctx.m_settings.aimbot_accuracy_boost <= 1.f)
return true;
}
if ((128 - i + TraceHits) < cNeededHits)
return false;
}
return false;
}
void c_aimbot::visualize_hitboxes(C_BasePlayer* entity, matrix3x4_t* mx, Color color, float time)
{
const model_t* model = entity->GetModel();
if (!model)
return;
const studiohdr_t* studioHdr = csgo.m_model_info()->GetStudioModel(model);
if (!studioHdr)
return;
const mstudiohitboxset_t* set = studioHdr->pHitboxSet(entity->m_nHitboxSet());
if (!set)
return;
for (int i = 0; i < set->numhitboxes; i++)
{
mstudiobbox_t* hitbox = set->pHitbox(i);
if (!hitbox)
continue;
Vector min, max;
Math::VectorTransform(hitbox->bbmin, mx[hitbox->bone], min);
Math::VectorTransform(hitbox->bbmax, mx[hitbox->bone], max);
if (hitbox->radius != -1)
csgo.m_debug_overlay()->AddCapsuleOverlay(min, max, hitbox->radius, color.r(), color.g(), color.b(), color.a(), time, 0, 1);
}
}
void c_aimbot::autostop(CUserCmd* cmd, C_WeaponCSBaseGun* local_weapon)
{
static auto accel = csgo.m_engine_cvars()->FindVar(sxor("sv_accelerate"));
static float last_time_stopped = csgo.m_globals()->realtime;
static bool was_onground = ctx.m_local()->m_fFlags() & FL_ONGROUND;
ctx.did_stop_before = false;
if (ctx.m_settings.autostop_only_when_shooting && (!local_weapon->can_shoot() || m_weapon()->m_iItemDefinitionIndex() == 64)) {
ctx.did_stop_before = false;
ctx.do_autostop = false;
return;
}
Engine::Prediction::Instance()->m_autostop_velocity_to_validate = 0.f;
if (ctx.m_settings.aimbot_autostop && local_weapon && local_weapon->m_iItemDefinitionIndex() != WEAPON_TASER && ctx.m_local()->m_fFlags() & FL_ONGROUND && was_onground && ctx.latest_weapon_data/* && !(cmd->buttons & IN_JUMP)*/)
{
auto v10 = cmd->buttons & ~(IN_MOVERIGHT | IN_MOVELEFT | IN_BACK | IN_FORWARD | IN_JUMP | IN_SPEED);
cmd->buttons = v10;
const auto chocked_ticks = (cmd->command_number % 3) == 0 ? (14 - csgo.m_client_state()->m_iChockedCommands) : ((14 - csgo.m_client_state()->m_iChockedCommands) / 2);
const auto max_speed = (local_weapon->GetMaxSpeed() * 0.33f) - 1.f - (float(chocked_ticks) * (m_weapon()->m_iItemDefinitionIndex() == WEAPON_AWP ? 1.35f : 1.65f) * +ctx.m_local()->m_iShotsFired()/* * 1.2f*/);//, (0.32f - float(0.005f * chocked_ticks)));
auto velocity = ctx.m_local()->m_vecVelocity();
velocity.z = 0;
auto current_speed = ((velocity.x * velocity.x) + (velocity.y * velocity.y));
current_speed = sqrtf(current_speed);
const auto cmd_speed = sqrtf((cmd->sidemove * cmd->sidemove) + (cmd->forwardmove * cmd->forwardmove));
if (feature::anti_aim->animation_speed <= 6.f && !ctx.did_stop_before) //accurate enough not to stop.
return;
auto new_sidemove = cmd->sidemove;
auto new_forwardmove = cmd->forwardmove;
if (current_speed >= 28.f) {
if (current_speed <= max_speed && ctx.m_settings.autostop_type == 0)
{
if (current_speed > 0.0f)
{
if (current_speed <= 0.1f)
{
new_sidemove = cmd->sidemove * fminf(current_speed, max_speed);
new_forwardmove = cmd->forwardmove * fminf(current_speed, max_speed);
}
else
{
new_forwardmove = (cmd->forwardmove / cmd_speed) * fminf(current_speed, max_speed);
new_sidemove = (cmd->sidemove / cmd_speed) * fminf(current_speed, max_speed);
}
}
}
else
{
QAngle angle;
Math::VectorAngles(velocity, angle);
// fix direction by factoring in where we are looking.
angle.y = ctx.cmd_original_angles.y - angle.y;
// convert corrected angle back to a direction.
Vector direction;
Math::AngleVectors(angle, &direction);
if (current_speed > 5.f) {
auto stop = direction * -current_speed;
new_forwardmove = stop.x;
new_sidemove = stop.y;
}
else
{
new_forwardmove = 0;
new_sidemove = 0;
}
}
}
if (ctx.m_local()->m_bDucking()
|| ctx.m_local()->m_fFlags() & FL_DUCKING) {
new_forwardmove = new_forwardmove / (((ctx.m_local()->m_flDuckAmount() * 0.34f) + 1.0f) - ctx.m_local()->m_flDuckAmount());
new_sidemove = new_sidemove / (((ctx.m_local()->m_flDuckAmount() * 0.34f) + 1.0f) - ctx.m_local()->m_flDuckAmount());
}
cmd->sidemove = Math::clamp(new_sidemove, -450.f, 450.f);
cmd->forwardmove = Math::clamp(new_forwardmove, -450.f, 450.f);
Engine::Movement::Instance()->m_oldsidemove = cmd->sidemove;
Engine::Movement::Instance()->m_oldforward = cmd->forwardmove;
Engine::Movement::Instance()->FixMove(cmd, Engine::Movement::Instance()->m_qRealAngles);
ctx.did_stop_before = true;
ctx.last_autostop_tick = cmd->command_number *csgo.m_client_state()->m_clockdrift_manager.m_nServerTick;
Engine::Prediction::Instance()->prev_cmd_command_num = 0;
Engine::Prediction::Instance()->Predict(cmd);
last_time_stopped = csgo.m_globals()->realtime;
ctx.do_autostop = false;
}
was_onground = (ctx.m_local()->m_fFlags() & FL_ONGROUND);
}
std::string hitbox_to_string(int h)
{
switch (h)
{
case 0:
return "head";
break;
case 1:
return "neck";
break;
case HITBOX_RIGHT_FOOT:
case HITBOX_RIGHT_CALF:
case HITBOX_RIGHT_THIGH:
return "right leg";
break;
case HITBOX_LEFT_FOOT:
case HITBOX_LEFT_CALF:
case HITBOX_LEFT_THIGH:
return "left leg";
break;
case HITBOX_RIGHT_HAND:
case HITBOX_RIGHT_UPPER_ARM:
case HITBOX_RIGHT_FOREARM:
return "right hand";
break;
case HITBOX_LEFT_HAND:
case HITBOX_LEFT_FOREARM:
case HITBOX_LEFT_UPPER_ARM:
return "left hand";
break;
case HITBOX_CHEST:
return "lower chest";
case HITBOX_UPPER_CHEST:
return "upper chest";
break;
default:
return "body";
break;
}
}
Vector get_bone(int bone, matrix3x4_t mx[])
{
return Vector(mx[bone][0][3], mx[bone][1][3], mx[bone][2][3]);
}
//bool c_aimbot::work(CUserCmd* cmd, bool* send_packet)
//{
// /*auto fill_players_list = [](void* _data) {
// lagcomp_mt* data = (lagcomp_mt*)_data;
//
// data->job_done = false;
//
//
//
// data->job_done = true;
// };*/
//
// best_player = nullptr;
// best_hitbox = Vector::Zero;
// best_hitboxid = -1;
// m_entities.clear();
// will_shoot_2nd_wit_r8 = false;
//
// if (!ctx.m_local() || ctx.m_local()->IsDead() || cmd->weaponselect != 0 || ctx.m_eye_position.IsZero()) return false;
//
// C_WeaponCSBaseGun* local_weapon = m_weapon();
//
// if (!local_weapon /*|| !ctx.pressed_keys[6]*/) return false;
//
// ctx.latest_weapon_data = local_weapon->GetCSWeaponData();
//
// const auto bodyaim = ctx.get_key_press(ctx.m_settings.aimbot_bodyaim_key);
//
// if (bodyaim)
// ctx.active_keybinds[5] = ctx.m_settings.aimbot_bodyaim_key.mode + 1;
//
// const auto dmg_override = ctx.get_key_press(ctx.m_settings.aimbot_min_damage_override);
//
// if (dmg_override)
// ctx.active_keybinds[6] = ctx.m_settings.aimbot_min_damage_override.mode + 1;
//
// /*auto IsGrenade = [](int item)
// {
// if (item == weapon_flashbang
// || item == weapon_hegrenade
// || item == weapon_smokegrenade
// || item == weapon_molotov
// || item == weapon_decoy
// || item == weapon_incgrenade
// || item == weapon_tagrenade)
// return true;
// else
// return false;
// };*/
//
// /*if ((Source::m_pGlobalVars->realtime - last_shoot_time) > 0.25f) {
// cheat::features::antiaimbot.flip_side = false;
//
// if (cheat::Cvars.anti_aim_desync_extend_limit_on_shot.GetValue())
// cheat::features::antiaimbot.extend = false;
// }*/
//
// //if (low_fps_ticks > 2) {
// // fps_dropped = true;
// // low_fps = ctx.fps;
// //}
//
// //if (fps_dropped)
// //{
// // const auto cur_fps_amt = ctx.fps / prefered_fps;
// // const auto low_fps_amt = low_fps / prefered_fps;
// //
// // fps_dropped = (cur_fps_amt - low_fps_amt) >= 0.5f || Engine::Prediction::Instance()->m_flFrameTime >= csgo.m_globals()->interval_per_tick;
// //}
//
// //ctx.boost_fps = fps_dropped;
//
// const auto is_zeus = (local_weapon->m_iItemDefinitionIndex() == WEAPON_TASER) || local_weapon->is_knife();
//
// if (!ctx.m_settings.aimbot_enabled || (!local_weapon->IsGun() || local_weapon->m_iClip1() <= 0) && !local_weapon->is_knife() || is_zeus && !ctx.m_settings.aimbot_allow_taser)
// return false;
//
// //if (local_weapon->m_iItemDefinitionIndex() == 64 && ctx.m_settings.aimbot_auto_revolver)
// //{
// // auto curtime = TICKS_TO_TIME(ctx.m_local()->m_nTickBase());
// //
// // if (local_weapon->m_flPostponeFireReadyTime() > curtime)
// // {
// // cmd->buttons |= IN_ATTACK;
// // }
// // // COCK EXTENDER
// // else if (local_weapon->m_flNextSecondaryAttack() > curtime)
// // {
// // cmd->buttons |= IN_ATTACK2;
// // }
// //}
//
// if (ctx.m_settings.aimbot_auto_revolver && !is_zeus)// && fabs(Engine::Prediction::Instance()->m_flFrameTime - csgo.m_globals()->interval_per_tick) > (csgo.m_globals()->interval_per_tick / 4))
// {
// /*if (local_weapon->m_iItemDefinitionIndex() == 64)
// {
// auto v7 = Source::m_pGlobalVars->curtime;
// if (r8cock_time <= (Source::m_pGlobalVars->frametime + v7))
// r8cock_time = v7 + 0.249f;
// else
// cmd->buttons |= IN_ATTACK;
// }
// else
// {
// r8cock_time = 0.0;
// }
//
// local_weapon->m_flPostponeFireReadyTime() = r8cock_time;*/
//
// if (local_weapon->m_iItemDefinitionIndex() == 64)
// {
// auto v33 = csgo.m_globals()->curtime;
// is_cocking = true;
//
// if (!ctx.pressed_keys[1] && !ctx.pressed_keys[2]) {
// cmd->buttons &= ~IN_ATTACK;
// cmd->buttons &= ~IN_ATTACK2;
// }
//
// if (local_weapon->can_cock())
// {
// if (r8cock_time <= v33)
// {
// if (local_weapon->m_flNextSecondaryAttack() <= v33)
// r8cock_time = v33 + 0.234375f;
// else {
// cmd->buttons |= IN_ATTACK2;
// //will_shoot_2nd_wit_r8 = true;
// }
// }
// else
// cmd->buttons |= IN_ATTACK;
//
// is_cocking = v33 > r8cock_time;
// }
// else
// {
// is_cocking = false;
// r8cock_time = v33 + 0.234375f;
// cmd->buttons &= ~IN_ATTACK;
// }
// }
// }
//
// //////////////////////////////////////////////////
// /*lagcomp_mt adata;
// Threading::QueueJobRef(fill_players_list, &adata);
// Threading::FinishQueue();*/
//
// int ppl = 0;
// //int players_with_damage = 0; int damageable_player = -1;
// //auto predicted_eyepos_bt = ctx.m_eye_position + Engine::Prediction::Instance()->GetVelocity() * csgo.m_globals()->interval_per_tick;
//
// //const auto prev_shot_ang = ctx.shot_angles.x;
// //ctx.shot_angles.clear();
// static bool baim = false;
//
// if (m_entities.empty())
// {
// static ConVar* sv_maxunlag = csgo.m_engine_cvars()->FindVar(sxor("sv_maxunlag"));
// for (auto idx = 1; idx < 64; idx++)
// {
// C_BasePlayer* entity = csgo.m_entity_list()->GetClientEntity(idx);
//
// if (!entity ||
// entity->IsDormant() ||
// !entity->IsPlayer() ||
// entity->m_iHealth() <= 0 ||
// entity->m_iTeamNum() == ctx.m_local()->m_iTeamNum() ||
// entity->m_bGunGameImmunity()
// ) continue;
//
// c_player_records* log = &feature::lagcomp->records[idx - 1];
// resolver_records* resolver_info = &feature::resolver->player_records[idx - 1];
//
// //log.head_position.clear();
// log->best_record = nullptr;
//
// if (!log->player || log->player != entity || log->records_count < 1)
// continue;
//
// log->restore_record.data_filled = false;
// log->restore_record.store(entity, true);
//
// //must_baim_player[idx - 1] = false;
//
// //int best_index = 0;
// float best_damage = 0.1f;
// float best_distance = 8196;
// /*float best_delta = 60.f;
// Vector last_hitbox_pos = Vector::Zero;*/
//
// int passed_records = 0;
//
// log->hitboxes_damage[HITBOX_HEAD] = 0;
// log->hitboxes_damage[HITBOX_BODY] = 0;
// log->hitboxes_damage[HITBOX_PELVIS] = 0;
// log->hitboxes_damage[HITBOX_UPPER_CHEST] = 0;
// log->hitboxes_damage[HITBOX_LEFT_FOOT] = 0;
// log->hitboxes_damage[HITBOX_RIGHT_FOOT] = 0;
//
// auto newest_record = (log->tick_records[(log->records_count - 1) & 63].simulation_time <= log->tick_records[(log->records_count) & 63].simulation_time && log->tick_records[(log->records_count) & 63].animated ? &log->tick_records[(log->records_count) & 63] : &log->tick_records[(log->records_count - 1) & 63]);
//
// /*resolve_info.aimbot_resolve_method = resolve_info.resolving_method;
//
// if (resolve_info.resolving_method <= 0 && ctx.shots_fired[idx] == 0 && fabs(entity->m_angEyeAngles().x) > 45.f)
// resolve_info.aimbot_resolve_method = 1;
//
// if (ctx.shots_fired[idx] > 0)
// {
// const auto shots = ((ctx.shots_fired[idx] - 1) % 3);
//
// switch (shots)
// {
// case 0:
// resolve_info.aimbot_resolve_method = (int(resolve_info.prev_resolving_method != 2) + 1);
// break;
// case 1:
// resolve_info.aimbot_resolve_method = resolve_info.prev_resolving_method;
// break;
// case 2:
// resolve_info.aimbot_resolve_method = 0;
// break;
// }
// }
// else {
// if (resolve_info.last_hurt_resolved >= 0)
// resolve_info.aimbot_resolve_method = resolve_info.last_hurt_resolved;
// }*/
//
// bool force_backtrack = false;
//
// if (newest_record->valid && !newest_record->dormant && newest_record->data_filled && newest_record->animated) {
// if (!feature::lagcomp->is_time_delta_too_large(newest_record)/* && !ctx.fakeducking*/) {
// log->best_record = newest_record;
// }
// else
// force_backtrack = true;
//
// if (!newest_record->shot_this_tick && newest_record->animated && !entity->IsBot())
// {
// auto was_viable_r = false;
// auto was_viable_l = false;
//
// newest_record->apply(entity, false);
// //const auto bonecount = entity->GetBoneCount();
// //entity->GetBoneAccessor().m_ReadableBones = log->tick_records[0]->bones_count;
// //ctx.force_hitbox_penetrate_accuracy = true;
// //ctx.force_low_quality_autowalling = true;
// memcpy(entity->m_CachedBoneData().Base(), newest_record->rightmatrixes, min(128, newest_record->bones_count) * sizeof(matrix3x4_t));
// //entity->GetBoneAccessor().m_ReadableBones = log->tick_records[0]->bones_count;