-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAntiAntiAim.cpp
173 lines (148 loc) · 5.6 KB
/
AntiAntiAim.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
/*
Syn's AyyWare Framework 2015
*/
// Credits to Valve and Shad0w
#include "Interfaces.h"
#include "Menu.h"
// Shad0ws Yaw fix
// (FIX ME UP LATER)
void FixY(const CRecvProxyData *pData, void *pStruct, void *pOut)
{
static Vector vLast[65];
static bool bShotLastTime[65];
static bool bJitterFix[65];
float *flPitch = (float*)((DWORD)pOut - 4);
float flYaw = pData->m_Value.m_Float;
bool bHasAA;
bool bSpinbot;
if (Menu::Window.RageBotTab.AccuracyAngleFix.GetState())
{
bHasAA = ((*flPitch == 90.0f) || (*flPitch == 270.0f));
bSpinbot = false;
if (!bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()]
&& (fabsf(flYaw - vLast[((IClientEntity*)(pStruct))->GetIndex()].y) > 15.0f) && !bHasAA)
{
flYaw = vLast[((IClientEntity*)(pStruct))->GetIndex()].y;
bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = true;
}
else
{
if (bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()]
&& (fabsf(flYaw - vLast[((IClientEntity*)(pStruct))->GetIndex()].y) > 15.0f))
{
bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = true;
bSpinbot = true;
}
else
{
bShotLastTime[((IClientEntity*)(pStruct))->GetIndex()] = false;
}
}
vLast[((IClientEntity*)(pStruct))->GetIndex()].y = flYaw;
bool bTmp = bJitterFix[((IClientEntity*)(pStruct))->GetIndex()];
bJitterFix[((IClientEntity*)(pStruct))->GetIndex()] = (flYaw >= 180.0f && flYaw <= 360.0f);
if (bTmp && (flYaw >= 0.0f && flYaw <= 180.0f))
{
flYaw += 359.0f;
}
}
*(float*)(pOut) = flYaw;
}
// Simple fix for some Fake-Downs
void FixX(const CRecvProxyData* pData, void* pStruct, void* pOut)
{
float* ang = (float*)pOut;
*ang = pData->m_Value.m_Float;
if (!Menu::Window.RageBotTab.AccuracyAngleFix.GetState()) return;
if (pData->m_Value.m_Float > 180.0f)
*ang -= 360.0f;
else if (pData->m_Value.m_Float < -180.0f)
*ang += 360.0f;
}
RecvVarProxyFn oRecvnModelIndex;
void Hooked_RecvProxy_Viewmodel(CRecvProxyData *pData, void *pStruct, void *pOut)
{
// Get the knife view model id's
static int default_t = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_default_t.mdl");
static int default_ct = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_default_ct.mdl");
int iBayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
int iButterfly = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
int iFlip = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
int iGunGame = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gg.mdl");
int iGut = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
int iKarambit = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
int iM9Bayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
int iHuntsman = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");
int iFalchion = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
int iDagger = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_push.mdl");
// Get local player (just to stop replacing spectators knifes)
IClientEntity* pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
if (Menu::Window.MiscTab.KnifeEnable.GetState() && pLocal)
{
// If we are alive and holding a default knife(if we already have a knife don't worry about changing)
if (pLocal->IsAlive() && (pData->m_Value.m_Int == default_t || pData->m_Value.m_Int == default_ct))
{
// Set whatever knife we want
if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 0)
pData->m_Value.m_Int = iKarambit;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 1)
pData->m_Value.m_Int = iBayonet;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 2)
pData->m_Value.m_Int = iHuntsman;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 3)
pData->m_Value.m_Int = iGut;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 4)
pData->m_Value.m_Int = iFalchion;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 5)
pData->m_Value.m_Int = iDagger;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 6)
pData->m_Value.m_Int = iButterfly;
else if (Menu::Window.MiscTab.KnifeModel.GetIndex() == 7)
pData->m_Value.m_Int = iFlip;
}
}
// Carry on the to original proxy
oRecvnModelIndex(pData, pStruct, pOut);
}
void ApplyAAAHooks()
{
ClientClass *pClass = Interfaces::Client->GetAllClasses();
while (pClass)
{
const char *pszName = pClass->m_pRecvTable->m_pNetTableName;
if (!strcmp(pszName, "DT_CSPlayer"))
{
for (int i = 0; i < pClass->m_pRecvTable->m_nProps; i++)
{
RecvProp *pProp = &(pClass->m_pRecvTable->m_pProps[i]);
const char *name = pProp->m_pVarName;
// Pitch Fix
if (!strcmp(name, "m_angEyeAngles[0]"))
{
pProp->m_ProxyFn = FixX;
}
// Yaw Fix
if (!strcmp(name, "m_angEyeAngles[1]"))
{
//Utilities::Log("Yaw Fix Applied");
pProp->m_ProxyFn = FixY;
}
}
}
else if (!strcmp(pszName, "DT_BaseViewModel"))
{
for (int i = 0; i < pClass->m_pRecvTable->m_nProps; i++)
{
RecvProp *pProp = &(pClass->m_pRecvTable->m_pProps[i]);
const char *name = pProp->m_pVarName;
// Knives
if (!strcmp(name, "m_nModelIndex"))
{
oRecvnModelIndex = (RecvVarProxyFn)pProp->m_ProxyFn;
pProp->m_ProxyFn = Hooked_RecvProxy_Viewmodel;
}
}
}
pClass = pClass->m_pNext;
}
}