-
Notifications
You must be signed in to change notification settings - Fork 6
/
CAimbot.cpp
1093 lines (844 loc) · 27.4 KB
/
CAimbot.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 "DllMain.h"
//optimizing code so we call setupbones only once
Vector GetBoneFromMatrix(matrix3x4_t *MatrixArray, int iBone)
{
return Vector(MatrixArray[iBone][0][3], MatrixArray[iBone][1][3], MatrixArray[iBone][2][3]);
}
void GetMaterialParameters(char sMaterial, float &fPenetrationPowerModifier, float &fDamageModifier)
{
switch(sMaterial)
{
case CHAR_TEX_METAL :
fPenetrationPowerModifier = 0.5;
fDamageModifier = 0.3;
break;
case CHAR_TEX_DIRT :
fPenetrationPowerModifier = 0.5;
fDamageModifier = 0.3;
break;
case CHAR_TEX_CONCRETE :
fPenetrationPowerModifier = 0.4;
fDamageModifier = 0.25;
break;
case CHAR_TEX_GRATE :
fPenetrationPowerModifier = 1.0;
fDamageModifier = 0.99;
break;
case CHAR_TEX_VENT :
fPenetrationPowerModifier = 0.5;
fDamageModifier = 0.45;
break;
case CHAR_TEX_TILE :
fPenetrationPowerModifier = 0.65;
fDamageModifier = 0.3;
break;
case CHAR_TEX_COMPUTER :
fPenetrationPowerModifier = 0.4;
fDamageModifier = 0.45;
break;
case CHAR_TEX_WOOD :
fPenetrationPowerModifier = 1.0;
fDamageModifier = 0.6;
break;
default :
fPenetrationPowerModifier = 1.0;
fDamageModifier = 0.5;
break;
}
}
typedef void ( *ClipTraceToPlayers_t )( const Vector&, const Vector&, unsigned int, ValveSDK::CTrace::ITraceFilter*, ValveSDK::CTrace::trace_t* );
bool bIsPointPenetrable(WeaponInfo_t wiWeaponInfo, Vector vStart, Vector vEnd)
{
ValveSDK::CTrace::trace_t trace;
ValveSDK::CTrace::ITraceFilter *pTraceFilter = (ValveSDK::CTrace::ITraceFilter*)&g_Aimbot.tfNoPlayers;
Vector vSource = vStart, vEnding, vDir = (vEnd - vStart), vClip;
vDir.NormalizeInPlace();
float fTmpLength, fSumDist, fPow;
int iPenetration = wiWeaponInfo.iPenetration;
float fCurrentDamage = wiWeaponInfo.iDamage;
float fPenetrationPower = wiWeaponInfo.fPenetrationPower;
static DWORD dwCliptracetoplayers = NULL;
if(dwCliptracetoplayers == NULL)
{
dwCliptracetoplayers = Base::Utils::PatternSearch(/*client.dll*/XorStr<0x2E,11,0xAF7248CE>("\x4D\x43\x59\x54\x5C\x47\x1A\x51\x5A\x5B"+0xAF7248CE).s,(PBYTE)"\x53\x8B\xDC\x83\xEC\x08\x83\xE4\xF0\x83\xC4\x04\x55\x8B\x6B\x04\x89\x6C\x24\x04\x8B\xEC\x81\xEC\x00\x00\x00\x00\x8B\x43\x18",/*xxxxxxxxxxxxxxxxxxxxxxxx????xxx*/XorStr<0x12,32,0xA1BF7B95>("\x6A\x6B\x6C\x6D\x6E\x6F\x60\x61\x62\x63\x64\x65\x66\x67\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F\x50\x51\x15\x14\x13\x12\x56\x57\x48"+0xA1BF7B95).s,NULL,NULL);
#ifdef DEBUGMODE
char szAddress[256];
sprintf(szAddress,"ClipTraceToPlayers: 0x%x",dwCliptracetoplayers);
Base::Debug::LOG(szAddress);
#endif
}
static ClipTraceToPlayers_t ClipTraceToPlayersCall = (ClipTraceToPlayers_t)dwCliptracetoplayers;
float fRange = Vector(vEnd - vStart).Length();
while(fCurrentDamage > 0.0f)
{
ValveSDK::CTrace::Ray_t ray;
ray.Init(vSource,vEnd);
g_Valve.pEngineTrace->TraceRay(ray,0x4600400B,pTraceFilter,&trace);
vClip = (vDir * 40.0f) + vEnd;
ClipTraceToPlayersCall(vSource,vClip,0x4600400B,pTraceFilter,&trace);
if(trace.fraction == 1.0f)
return true;
ValveSDK::surfacedata_t *pSurfaceData = g_Valve.pPhysics->GetSurfaceData(trace.surface.surfaceProps);
bool bGrate = (trace.contents & 0x8);
fTmpLength = (fSumDist + ((fRange - fSumDist) * trace.fraction));
fPow = (pow(wiWeaponInfo.fRangeModifier,(fTmpLength * 0.002f)));
fCurrentDamage *= fPow;
if(fTmpLength > wiWeaponInfo.fPenetrationDistance)
iPenetration = ((iPenetration <= 0) ? iPenetration : 0);
if(iPenetration < 0 || (iPenetration == 0 && !bGrate))
break;
float fPenetrationPowerModifier;
float fDamageModifier;
unsigned short iMaterial = pSurfaceData->game.material;
char sMaterial = (char)iMaterial;
GetMaterialParameters(sMaterial,fPenetrationPowerModifier,fDamageModifier);
if ( bGrate )
{
fPenetrationPowerModifier = 1.0f;
fDamageModifier = 0.99f;
}
Vector vEndPos2;
float multiplier = 24;
for( ; ; multiplier += 24)
{
vEndPos2 = (trace.endpos + (vDir * multiplier));
if(!(g_Valve.pEngineTrace->GetPointContents( vEndPos2 ) & 0x200400B))
break;
if(multiplier > 128)
return false;
}
ValveSDK::CTrace::trace_t trace2;
ray.Init(vEndPos2,trace.endpos);
g_Valve.pEngineTrace->TraceRay(ray,0x4600400B,0,&trace2);
if((trace2.m_pEnt != trace.m_pEnt) && trace2.m_pEnt)
{
ValveSDK::CTrace::CSimpleTraceFilter pTraceTwoFilter(trace2.m_pEnt);
ray.Init(vEndPos2,trace.endpos);
g_Valve.pEngineTrace->TraceRay(ray,0x4600400B,(ValveSDK::CTrace::ITraceFilter*)&pTraceTwoFilter,&trace2);
}
float fNewTempLength = Vector(trace2.endpos - trace.endpos).Length();
if(g_Valve.pPhysics->GetSurfaceData(trace2.surface.surfaceProps)->game.material == iMaterial && (iMaterial == 87 || iMaterial == 77))
fPenetrationPowerModifier += fPenetrationPowerModifier;
if(fNewTempLength > (fPenetrationPower * fPenetrationPowerModifier))
break;
fPenetrationPower -= (fNewTempLength / fPenetrationPowerModifier);
vSource = trace2.endpos;
fCurrentDamage *= fDamageModifier;
fSumDist = fTmpLength + fNewTempLength;
--iPenetration;
}
return false;
}
bool CAimbot::MultiPoints(CBaseEntity* pPlayer, Vector &vPos, int iHitBox)
{
Vector vMax;
Vector vMin;
matrix3x4_t matrix[128];
if (!pPlayer->SetupBones(matrix, 128, 0x00000100, 0.0f))
return false;
studiohdr_t* hdr = g_Valve.pModel->GetStudiomodel(pPlayer->GetModel());
if(!hdr)
return false;
mstudiobbox_t* hitbox = hdr->pHitboxSet(0)->pHitbox(iHitBox);
if (!hitbox)
return false;
g_Math.VectorTransform(hitbox->bbmin, matrix[hitbox->bone], vMin);
g_Math.VectorTransform(hitbox->bbmax, matrix[hitbox->bone], vMax);
//main spot
vPos = (vMin + vMax) * 0.5;
if(pPlayer->IsUsingAntiAim())
vPos.z += 4.2f;
else
vPos.z += (float)g_CVARS.CvarList[AimHeight];
if(!g_CVARS.CvarList[Autowall] && IsVisible(vEyePos,vPos,0x46004003,(ValveSDK::CTrace::ITraceFilter*)&g_Aimbot.tfNoPlayers))
return true;
else if(g_CVARS.CvarList[Autowall] && bIsPointPenetrable(wiWeaponInfo,vEyePos,vPos))
return true;
else if(g_CVARS.CvarList[Hitscans])
{
for(int i = 0; i < 50; i++)
{
//dirty bones that dont really work well on all maps
//if(i == 20 || i == 19 || i == 17 || i == 23)
// continue;
vPoints[i] = GetBoneFromMatrix(matrix,i);
if(!g_CVARS.CvarList[HitscanAutowall] && IsVisible(vEyePos,vPoints[i],0x46004003,(ValveSDK::CTrace::ITraceFilter*)&g_Aimbot.tfNoPlayers))
{
vPos = vPoints[i];
return true;//who cares which point is better??? lets just aim at first visible one
}
else if(g_CVARS.CvarList[HitscanAutowall] && bIsPointPenetrable(wiWeaponInfo,vEyePos,vPoints[i]))
{
vPos = vPoints[i];
return true;
}
}
}
return false;
}
bool GetHiboxPosition(CBaseEntity* pPlayer, Vector &vPos, int iHitBox)
{
Vector vMax;
Vector vMin;
matrix3x4_t matrix[128];
if (!pPlayer->SetupBones(matrix, 128, 0x00000100, 0.0f))
return false;
studiohdr_t* hdr = g_Valve.pModel->GetStudiomodel(pPlayer->GetModel());
if(!hdr)
return false;
mstudiobbox_t* hitbox = hdr->pHitboxSet(0)->pHitbox(iHitBox);
if (!hitbox)
return false;
g_Math.VectorTransform(hitbox->bbmin, matrix[hitbox->bone], vMin);
g_Math.VectorTransform(hitbox->bbmax, matrix[hitbox->bone], vMax);
vPos = (vMin + vMax) * 0.5;
return true;
}
void CalcAngle(Vector &vSource, Vector &vDestination, Vector &qAngle)
{
Vector vDelta = vSource - vDestination;
float fHyp = (vDelta.x * vDelta.x) + (vDelta.y * vDelta.y);
float fRoot;
__asm
{
sqrtss xmm0, fHyp
movss fRoot, xmm0
}
qAngle.x = RAD2DEG(atan(vDelta.z / fRoot));
qAngle.y = RAD2DEG(atan(vDelta.y / vDelta.x));
if(vDelta.x >= 0.0f)
qAngle.y += 180.0f;
qAngle.x = g_NoSpread.AngleNormalize(qAngle.x);
qAngle.y = g_NoSpread.AngleNormalize(qAngle.y);
}
float GetFov(Vector vLocalOrigin, Vector vPosition, Vector vForward)
{
Vector vLocal;
VectorSubtract(vPosition, vLocalOrigin, vLocal);
vLocal.NormalizeInPlace();
float fValue = vForward.Dot(vLocal);
//np for kolo's math skills
if(fValue < -1.0f)
fValue = -1.0f;
if(fValue > 1.0f)
fValue = 1.0f;
return RAD2DEG(acos(fValue));
}
bool CAimbot::IsVisible(Vector vStart, Vector vEnd, unsigned int nMask, ValveSDK::CTrace::ITraceFilter *pTraceFilter)
{
ValveSDK::CTrace::Ray_t ray;
ValveSDK::CTrace::trace_t tr;
ray.Init(vStart,vEnd);
g_Valve.pEngineTrace->TraceRay(ray,nMask,pTraceFilter,&tr);
return (tr.fraction == 1.0f);
}
void CAimbot::FixMovement(ValveSDK::CInput::CUserCmd* c, Vector &qOld, int iPositive)
{
Vector vMove(c->forwardmove, c->sidemove, c->upmove);
float fSpeed = sqrt(vMove.x * vMove.x + vMove.y * vMove.y);
static Vector qMove;
g_NoSpread.vectorAngles(vMove,qMove);
float fYaw = DEG2RAD(c->viewangles.y - qOld.y + qMove.y);
c->forwardmove = cos(fYaw) * fSpeed * iPositive;
c->sidemove = sin(fYaw) * fSpeed;
}
void GetWeaponInfo(ValveSDK::CBaseCombatWeapon *pWeapon, WeaponInfo_t &wiInfo, int iWeaponID, bool bSilencer)
{
switch(iWeaponID)
{
case WEAPON_AK47:
{
wiInfo.iBulletType = 2;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 36;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.98f;
break;
}
case WEAPON_AUG:
{
wiInfo.iBulletType = 2;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 32;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.96f;
break;
}
case WEAPON_AWP:
{
wiInfo.iBulletType = 5;
wiInfo.iPenetration = 3;
wiInfo.iDamage = 115;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.99f;
break;
}
case WEAPON_DEAGLE:
{
wiInfo.iBulletType = 1;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 54;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.81f;
break;
}
case WEAPON_ELITES:
{
wiInfo.iBulletType = 6;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 45;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.75f;
break;
}
case WEAPON_FAMAS:
{
wiInfo.iBulletType = 3;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 30;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.96f;
break;
}
case WEAPON_FIVESEVEN:
{
wiInfo.iBulletType = 10;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 25;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.885f;
break;
}
case WEAPON_G3SG1:
{
wiInfo.iBulletType = 2;
wiInfo.iPenetration = 3;
wiInfo.iDamage = 80;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.98f;
break;
}
case WEAPON_GALIL:
{
wiInfo.iBulletType = 3;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 30;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.98f;
break;
}
case WEAPON_GLOCK:
{
wiInfo.iBulletType = 6;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 25;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.75f;
break;
}
case WEAPON_M249:
{
wiInfo.iBulletType = 4;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 32;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.97f;
break;
}
case WEAPON_M4A1:
{
wiInfo.iBulletType = 3;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 33;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = (bSilencer ? 0.95f : 0.97f);
break;
}
case WEAPON_MAC10:
{
wiInfo.iBulletType = 8;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 29;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.82f;
break;
}
case WEAPON_MP5:
{
wiInfo.iBulletType = 6;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 26;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.84f;
break;
}
case WEAPON_P228:
{
wiInfo.iBulletType = 9;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 40;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.8f;
break;
}
case WEAPON_P90:
{
wiInfo.iBulletType = 10;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 26;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.84f;
break;
}
case WEAPON_SCOUT:
{
wiInfo.iBulletType = 2;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 75;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.98f;
break;
}
case WEAPON_SG550:
{
wiInfo.iBulletType = 3;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 70;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.98f;
break;
}
case WEAPON_SG552:
{
wiInfo.iBulletType = 3;
wiInfo.iPenetration = 2;
wiInfo.iDamage = 33;
wiInfo.fMaxRange = 8192.0f;
wiInfo.fRangeModifier = 0.955f;
break;
}
case WEAPON_TMP:
{
wiInfo.iBulletType = 6;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 26;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.84f;
break;
}
case WEAPON_UMP:
{
wiInfo.iBulletType = 8;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 30;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.82f;
break;
}
case WEAPON_USP:
{
wiInfo.iBulletType = 8;
wiInfo.iPenetration = 1;
wiInfo.fMaxRange = 4096.0f;
wiInfo.fRangeModifier = 0.79f;
wiInfo.iDamage = (bSilencer ? 30 : 34);
break;
}
case WEAPON_XM1014:
{
wiInfo.iBulletType = 7;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 22;
wiInfo.fRangeModifier = 0.7f;
wiInfo.fMaxRange = 3000.0f;
break;
}
case WEAPON_M3:
{
wiInfo.iBulletType = 7;
wiInfo.iPenetration = 1;
wiInfo.iDamage = 26;
wiInfo.fRangeModifier = 0.7f;
wiInfo.fMaxRange = 3000.0f;
break;
}
default:
{
break;
}
}
static DWORD dwBulletParams = NULL;
if(dwBulletParams == NULL)
{
dwBulletParams = Base::Utils::PatternSearch(/*client.dll*/XorStr<0x04,11,0x9335C284>("\x67\x69\x6F\x62\x66\x7D\x24\x6F\x60\x61"+0x9335C284).s,(PBYTE)"\x55\x8B\xEC\x56\x8B\x75\x08\x68\x00\x00\x00\x00\x56\xE8\x00\x00\x00\x00\x83\xC4\x08\x84\xC0",/*xxxxxxxx????xx????xxxxx*/XorStr<0x44,24,0x99359960>("\x3C\x3D\x3E\x3F\x30\x31\x32\x33\x73\x72\x71\x70\x28\x29\x6D\x6C\x6B\x6A\x2E\x2F\x20\x21\x22"+0x99359960).s,NULL,NULL);
#ifdef DEBUGMODE
char szAddy[256];
sprintf(szAddy,"GetBulletTypeParameters: 0x%x",dwBulletParams);
Base::Debug::LOG(szAddy);
#endif
}
float fPenDist;
float fPenPow;
int iBulletTup = wiInfo.iBulletType;
__asm
{
LEA ECX, fPenDist
PUSH ECX
LEA EDX, fPenPow
PUSH EDX
PUSH iBulletTup
CALL dwBulletParams
}
wiInfo.fPenetrationDistance = fPenDist;
wiInfo.fPenetrationPower = fPenPow;
}
void CAimbot::Main(ValveSDK::CInput::CUserCmd* pUserCmd, CBaseEntity* pLocal, ValveSDK::CBaseCombatWeapon *pWeapon)
{
int iMyTeam = pLocal->GetTeamNum();
//optimizing this crap
if(g_CVARS.CvarList[Autowall] || g_CVARS.CvarList[HitscanAutowall])
{
static int iOldWeaponID;
static bool bOldSilenced;
int iWeaponID = pWeapon->GetWeaponID();
bool bSilenced = pWeapon->IsSilencerOn();
if(iWeaponID != iOldWeaponID || bSilenced != bOldSilenced)
GetWeaponInfo(pWeapon,wiWeaponInfo,iWeaponID,bSilenced);
iOldWeaponID = iWeaponID;
bOldSilenced = bSilenced;
}
vEyePos = pLocal->GetEyePosition();
static Vector vClientViewAngles;
g_Valve.pEngine->GetViewAngles(vClientViewAngles);
static Vector vAngle;
g_NoSpread.angleVectors(vClientViewAngles,vAngle);
Reset();
for (INT ax = 1; ax <= g_Valve.pEngine->GetMaxClients(); ax++)
{
CBaseEntity* pBaseEntity = g_Valve.pEntList->GetClientEntity(ax);
if (!pBaseEntity
|| pBaseEntity == pLocal
|| !pBaseEntity->isValidPlayer()
|| fWhiteList[ax]
|| (!g_CVARS.CvarList[AimTeam] && pBaseEntity->GetTeamNum() == iMyTeam)
|| (g_CVARS.CvarList[AntiDM] && pBaseEntity->IsSpawnProtectedPlayer())
|| !MultiPoints(pBaseEntity,vTarget,(fSpecialAimspot[ax] != -1 ? fSpecialAimspot[ax] : g_CVARS.CvarList[AimSpot])))
continue;
float fCurrFOV = GetFov(vEyePos,vTarget,vAngle);
if(fCurrFOV > g_CVARS.CvarList[AimFOV]) //aimfov
continue;
if(g_CVARS.CvarList[TargetSelection] == 1)//targetselection
fCurrFOV = (Vector(vTarget - vEyePos).Length());
if(fBestTarget < fCurrFOV)
continue;
fBestTarget = fCurrFOV;
vFinal = vTarget;
//this is our target which is closest to crosshair
iTarget = ax;
}
if(HasTarget())
{
CalcAngle(vEyePos,vFinal,pUserCmd->viewangles);
if(g_CVARS.CvarList[SmoothAim] > 0)
{
vClientViewAngles.x = g_NoSpread.AngleNormalize(vClientViewAngles.x);
vClientViewAngles.y = g_NoSpread.AngleNormalize(vClientViewAngles.y);
Vector qDelta = pUserCmd->viewangles - vClientViewAngles;
qDelta.x = g_NoSpread.AngleNormalize(qDelta.x);
qDelta.y = g_NoSpread.AngleNormalize(qDelta.y);
pUserCmd->viewangles.x = vClientViewAngles.x + qDelta.x / (float)g_CVARS.CvarList[SmoothAim];
pUserCmd->viewangles.y = vClientViewAngles.y + qDelta.y / (float)g_CVARS.CvarList[SmoothAim];
pUserCmd->viewangles.x = g_NoSpread.AngleNormalize(pUserCmd->viewangles.x);
pUserCmd->viewangles.y = g_NoSpread.AngleNormalize(pUserCmd->viewangles.y);
}
if(!g_CVARS.CvarList[SilentAim])
g_Valve.pEngine->SetViewAngles(pUserCmd->viewangles);
if(g_CVARS.CvarList[Autoshoot])
pUserCmd->buttons |= IN_ATTACK;
}
}
//valve sdk.. i think this is outdated for csgo but cba to recheck hehe
Vector head_hull_mins( -16, -16, -18 );
Vector head_hull_maxs( 16, 16, 18 );
#define MASK_SOLID (0x1|0x4000|0x2|0x2000000|0x8)
bool CAimbot::Main_Knifebot(CBaseEntity* pLocal, ValveSDK::CBaseCombatWeapon *pWeapon)
{
float fRange = ((g_CVARS.CvarList[Knifebot] == 2) ? 48 : 32);
int iWeaponID = pWeapon->GetWeaponID();
if(iWeaponID != WEAPON_KNIFE)//knife
return false;
Vector qEyeAngles = pLocal->GetEyeAngles();
static Vector vForward;
g_NoSpread.angleVectors(qEyeAngles,vForward);
Vector vSource = pLocal->GetEyePosition();
Vector vEnd = vSource + (vForward * fRange);
ValveSDK::CTrace::trace_t tr;
ValveSDK::CTrace::Ray_t ray;
ValveSDK::CTrace::CSimpleTraceFilter pTraceFilter(pLocal);
ray.Init(vSource,vEnd);
g_Valve.pEngineTrace->TraceRay(ray,MASK_SOLID,(ValveSDK::CTrace::ITraceFilter*)&pTraceFilter,&tr);
if(tr.fraction >= 1.0f)
{
ValveSDK::CTrace::Ray_t ray2;
ray2.Init(vSource,vEnd,head_hull_mins,head_hull_maxs);
g_Valve.pEngineTrace->TraceRay(ray2,MASK_SOLID,(ValveSDK::CTrace::ITraceFilter*)&pTraceFilter,&tr);
if(tr.fraction < 1.0f)
vEnd = tr.endpos;
}
if(tr.fraction >= 1.0f
|| !tr.m_pEnt
|| !tr.m_pEnt->IsPlayer()
|| fWhiteList[tr.m_pEnt->GetIndex()]
|| (tr.surface.flags & 0x0004)
|| (!g_CVARS.CvarList[AimTeam] && tr.m_pEnt->GetTeamNum() == pLocal->GetTeamNum())
|| (g_CVARS.CvarList[AntiDM] && tr.m_pEnt->IsSpawnProtectedPlayer()))
return false;
int iHealth = tr.m_pEnt->GetHealth();
float fDot;
if(g_CVARS.CvarList[BackstabOnly] || g_CVARS.CvarList[Knifebot] == 2)
{
Vector vTragetForward;
Vector qEntAngles = tr.m_pEnt->GetEyeAngles();
g_NoSpread.angleVectors(qEntAngles,vTragetForward);
Vector vTo = Vector(tr.m_pEnt->GetAbsOrigin() - pLocal->GetNetworkedOrigin());
//vector2d quick implementation
float vLOS[2];
vLOS[0] = vTo.x;
vLOS[1] = vTo.y;
float fLen = vTo.Length2D();
if (fLen != 0.0f)
{
vLOS[0] /= fLen;
vLOS[1] /= fLen;
}
else
vLOS[0] = vLOS[1] = 0.0f;
fDot = (vLOS[0] * vTragetForward.x) + (vLOS[1] * vTragetForward.y);
if(g_CVARS.CvarList[Knifebot] == 2)
{
float fNextPrimary = pWeapon->GetNextPrimaryAttack();
float fCurTime = pLocal->GetTickBase() * g_Valve.pGlobalVars->interval_per_tick;
bool bFirstSwing = ((fNextPrimary + 0.5f) < fCurTime);
if(!bFirstSwing && iHealth >= 21 && !(fDot > 0.475f))
return false;
}
int iCheck = ((g_CVARS.CvarList[Knifebot] == 2) ? 34 : 55);
//Triple the damage if we are stabbing them in the back.
if(g_CVARS.CvarList[BackstabOnly] && iHealth >= iCheck)
{
if (!(fDot > 0.475f))
return false;
else
return true;
}
}
return true;
}
void CAimbot::Main_RCS(ValveSDK::CInput::CUserCmd* pUserCmd, CBaseEntity* pLocal, ValveSDK::CBaseCombatWeapon *pWeapon)
{
int iWpnID = pWeapon->GetWeaponID();
//we only want rifles and dualies are fine as well ehi ehi
bool bIgnoreWeapon = (iWpnID != WEAPON_XM1014 && iWpnID != WEAPON_AWP && iWpnID != WEAPON_DEAGLE && iWpnID != WEAPON_USP
&& iWpnID != WEAPON_FIVESEVEN && iWpnID != WEAPON_GLOCK && iWpnID != WEAPON_P228 && iWpnID != WEAPON_SCOUT && iWpnID != WEAPON_SG550
&& iWpnID != WEAPON_G3SG1);
if(!bIgnoreWeapon)
return;
int iMyTeam = pLocal->GetTeamNum();
Vector vEyePosition = pLocal->GetEyePosition();
static Vector vClientViewAngles;
g_Valve.pEngine->GetViewAngles(vClientViewAngles);
static Vector vAngle;
g_NoSpread.angleVectors(vClientViewAngles,vAngle);
ResetRCS();
for (INT ax = 1; ax <= g_Valve.pEngine->GetMaxClients(); ax++)
{
CBaseEntity* pBaseEntity = g_Valve.pEntList->GetClientEntity(ax);
if (!pBaseEntity
|| !pBaseEntity->isValidPlayer()
|| pBaseEntity == pLocal
|| (!g_CVARS.CvarList[RCSAimTeam] && pBaseEntity->GetTeamNum() == iMyTeam)
|| !GetHiboxPosition(pBaseEntity,vRCSTarget,g_CVARS.CvarList[RCSSpot])
|| !IsVisible(vEyePosition,vRCSTarget,0x46004003,(ValveSDK::CTrace::ITraceFilter*)&tfNoPlayers))
continue;
float fCurrFOV = GetFov(vEyePosition,vRCSTarget,vAngle);
if(fBestRCSTarget < fCurrFOV)
continue;
fBestRCSTarget = fCurrFOV;
vRCSFinal = vRCSTarget;
//this is our target which is closest to crosshair
iRCSTarget = ax;
}
if(HasTargetRCS())
{
float fLen = Vector(vRCSFinal - vEyePosition).Length();
Vector qAngle;
CalcAngle(vEyePosition,vRCSFinal,qAngle);
if(g_CVARS.CvarList[SCS])
{
float fSpeed = pLocal->GetVelocity().Length();
if(fSpeed >= 0.0f && fSpeed < 1.0f)
g_NoSpread.GetSpreadFix(pWeapon,pUserCmd->random_seed,qAngle);
}
Vector qPunchangle = pLocal->GetPunchAngle();
//again dont apply to fkn z fraction
qAngle.x -= qPunchangle.x * 2;
qAngle.y -= qPunchangle.y * 2;
qAngle.x = g_NoSpread.AngleNormalize(qAngle.x);
qAngle.y = g_NoSpread.AngleNormalize(qAngle.y);
static Vector vForward;
g_NoSpread.angleVectors(qAngle,vForward);
vForward = (vForward * fLen) + vEyePosition;
if(GetFov(vEyePosition,vForward,vAngle) <= g_CVARS.CvarList[RCSFOV])
{
pUserCmd->viewangles = qAngle;
if(g_CVARS.CvarList[RCSSmooth] > 0)
{
vClientViewAngles.x = g_NoSpread.AngleNormalize(vClientViewAngles.x);
vClientViewAngles.y = g_NoSpread.AngleNormalize(vClientViewAngles.y);
Vector qDelta = pUserCmd->viewangles - vClientViewAngles;
qDelta.x = g_NoSpread.AngleNormalize(qDelta.x);
qDelta.y = g_NoSpread.AngleNormalize(qDelta.y);
pUserCmd->viewangles.x = vClientViewAngles.x + qDelta.x / (float)g_CVARS.CvarList[RCSSmooth];
pUserCmd->viewangles.y = vClientViewAngles.y + qDelta.y / (float)g_CVARS.CvarList[RCSSmooth];
pUserCmd->viewangles.x = g_NoSpread.AngleNormalize(pUserCmd->viewangles.x);
pUserCmd->viewangles.y = g_NoSpread.AngleNormalize(pUserCmd->viewangles.y);
}
pUserCmd->viewangles.z = 0.0f;
g_Valve.pEngine->SetViewAngles(pUserCmd->viewangles);
}
}
}
bool CAimbot::Main_Triggerbot(Vector vSource, Vector qCurAngle, Vector vForward, Vector vRight, Vector vUp, float fMaxDistance, int iLocalTeamNumber,ValveSDK::CBaseCombatWeapon *pWeapon, CBaseEntity *pLocal, int iSeed)
{
static bool bBurst;
bool bRet = false;
ValveSDK::CTrace::trace_t tr;
ValveSDK::CTrace::Ray_t ray;
if(g_CVARS.CvarList[PTrigger])
{
//*NOSPREAD PART*
g_NoSpread.RandomSeed((iSeed & 255) + 1);
float flA = g_NoSpread.RandomFloat(0.0f, 6.283185f);
float flB = g_NoSpread.RandomFloat(0.0f, pWeapon->GetSpread());
float flC = g_NoSpread.RandomFloat(0.0f, 6.283185f);
float flD = g_NoSpread.RandomFloat(0.0f, pWeapon->GetCone());
Vector vSpread;
vSpread.x = (cos(flA) * flB) + (cos(flC) * flD);
vSpread.y = (sin(flA) * flB) + (sin(flC) * flD);
vForward.x = vForward.x + vSpread.x * vRight.x + vSpread.y * vUp.x;
vForward.y = vForward.y + vSpread.x * vRight.y + vSpread.y * vUp.y;
vForward.z = vForward.z + vSpread.x * vRight.z + vSpread.y * vUp.z;
vForward.NormalizeInPlace();
g_NoSpread.vectorAngles(vForward,qCurAngle);
qCurAngle.x = g_NoSpread.AngleNormalize(qCurAngle.x);
qCurAngle.y = g_NoSpread.AngleNormalize(qCurAngle.y);
//*NORECOIL PART*
qCurAngle += pLocal->GetPunchAngle() * 2;
}
Vector vEnd;
g_NoSpread.angleVectors(qCurAngle,vEnd);
vEnd = vSource + (vEnd * fMaxDistance);
//g_Valve.TraceLine(vSource,vEnd,MASK_SHOT,pLocal,0,&trace);
ValveSDK::CTrace::CSimpleTraceFilter tfSimple(pLocal);
ray.Init(vSource,vEnd);
g_Valve.pEngineTrace->TraceRay(ray,0x46004003,(ValveSDK::CTrace::ITraceFilter*)&tfSimple,&tr);
bool bNowBurst = false;
static DWORD fTimer = GetTickCount();
if(tr.m_pEnt && tr.m_pEnt->IsPlayer())
{
//kolonote:
//css fix for head triggering (bbox_maxs z component is too small)
//credits: me, wav
//int iTeam = g_Valve.pClient->GetPlayerTeamNumber(trace.m_pEnt);
//int MiTeam = g_Valve.pClient->GetPlayerTeamNumber(pLocal);
if( !fWhiteList[tr.m_pEnt->GetIndex()]
&& ((!g_CVARS.CvarList[TriggerAll] && tr.m_pEnt->GetTeamNum() != iLocalTeamNumber) || g_CVARS.CvarList[TriggerAll])
&& ((g_CVARS.CvarList[TriggerHead] && tr.hitgroup == 1) || !g_CVARS.CvarList[TriggerHead])
&& ((g_CVARS.CvarList[IgnoreLegsAndArms] && tr.hitgroup != 4 && tr.hitgroup != 5 && tr.hitgroup != 6 && tr.hitgroup != 7) || !g_CVARS.CvarList[IgnoreLegsAndArms])
&& ((g_CVARS.CvarList[AntiDM] && !tr.m_pEnt->IsSpawnProtectedPlayer()) || !g_CVARS.CvarList[AntiDM]) )
{
bRet = true;
fTimer = 0;
bBurst = true;
bNowBurst = true;
}
}
if(!bNowBurst && bBurst)
{
fTimer = GetTickCount() + (int)g_NoSpread.RandomFloat(200.0f,350.0f);
bBurst = false;
}
if(g_CVARS.CvarList[TriggerBurst] && fTimer > GetTickCount())
bRet = true;
return bRet;
}