This repository was archived by the owner on Jan 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathClient.cpp
More file actions
306 lines (246 loc) · 8.81 KB
/
Client.cpp
File metadata and controls
306 lines (246 loc) · 8.81 KB
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
#include "SDK.h"
#include "Client.h"
#include "Util.h"
#include "Aimbot.h"
#include "Triggerbot.h"
#include "HvH.h"
#include "ESP.h"
#include "Misc.h"
#include "Backtrack.h"
#include "AutoAirblast.h"
#include "SFreezing.h"
#include "Sticky.h"
#include "CMat.h"
#include "CDrawManager.h"
#include <intrin.h>
CGlobalzz g;
Vector qLASTTICK;
bool Key(INT vKey)
{
if (GetAsyncKeyState(vKey) & 1)
return true;
return false;
}
int WarpCharge = 0;
bool IsDTing = false;
//============================================================================================
bool __fastcall Hooked_CreateMove(PVOID ClientMode, int edx, float input_sample_frametime, CUserCmd* pCommand)
{
VMTManager& hook = VMTManager::GetHook(ClientMode); //Get a pointer to the instance of your VMTManager with the function GetHook.
try
{
g.silenttime = false;
g.original_cmd = *pCommand;
if (!pCommand->command_number)
return false;
CBaseEntity* pLocal = GetBaseEntity(me);
if (!pLocal)
{
WarpCharge = 0;
return hook.GetMethod<bool(__thiscall*)(PVOID, float, CUserCmd*)>(gOffsets.iCreateMoveOffset)(ClientMode, input_sample_frametime, pCommand);
}
g.local = reinterpret_cast<CBaseEntity*>(gInts.EntList->GetClientEntity(gInts.Engine->GetLocalPlayer()));
if (!g.local->IsAlive() || g.local->IsDormant() || !gInts.Engine->IsInGame() || !gInts.Engine->IsConnected() || gInts.Engine->IsDrawingLoadingImage()) WarpCharge = 0;
uintptr_t _bp; __asm mov _bp, ebp;
g.sendpacket = (bool*)(***(uintptr_t***)_bp - 1);
g.isfiring = (pCommand->buttons & IN_ATTACK);
if (pLocal->IsAlive())
{
auto netchan = gInts.Engine->GetNetChannelInfo();
if ((gMisc.flag.value && netchan->m_nChokedPackets < (int)gMisc.flagamount.value) || IsDTing && gMisc.CanShoot() && g.isfiring)
*g.sendpacket = false;
else
*g.sendpacket = true;
}
gMisc.Run(pLocal, pCommand);
hook.GetMethod<bool(__thiscall*)(PVOID, float, CUserCmd*)>(gOffsets.iCreateMoveOffset)(ClientMode, input_sample_frametime, pCommand);
Vector oAngles = pCommand->viewangles, Angles = pCommand->viewangles;
float oForwrad = pCommand->forwardmove, oSideMove = pCommand->sidemove;
gAim.Run(pLocal, pCommand);
gHvH.Run(pLocal, pCommand);
gTrigger.Run(pLocal, pCommand);
gSequenceFreezing.Run(pLocal, pCommand);
if (GAME_TF2)
{
gBlast.Run(pLocal, pCommand);
gSticky.Run(pLocal, pCommand);
}
backtrack::do_backtrack();
static bool WasSet = false;
if (pLocal->GetActiveWeapon())
{
if (gCvars.aimbot_silent && gAim.IsProjectileWeapon(pLocal, pLocal->GetActiveWeapon()))
{
if (g.silenttime) {
*g.sendpacket = false;
WasSet = true;
}
else
{
if (WasSet)
{
*g.sendpacket = true;
pCommand->viewangles = oAngles;
pCommand->sidemove = oSideMove;
pCommand->forwardmove = oForwrad;
WasSet = false;
}
}
}
}
}
catch (...)
{
Log::Fatal("Failed Hooked_CreateMove");
}
qLASTTICK = pCommand->viewangles;
return false/*bReturn*/;
}
void __fastcall FrameStageNotifyThink(PVOID CHLClient, void *_this, ClientFrameStage_t Stage)
{
gESP.FrameStageNotify(Stage);
if (Stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
{
if (GAME_TF2)
{
for (auto i = 1; i <= gInts.Engine->GetMaxClients(); i++)
{
CBaseEntity *entity = nullptr;
player_info_t temp;
if (!(entity = gInts.EntList->GetClientEntity(i)))
continue;
if (entity->IsDormant())
continue;
if (!gInts.Engine->GetPlayerInfo(i, &temp))
continue;
if (!entity->GetLifeState() == LIFE_ALIVE)
continue;
Vector vX = entity->GetAngles();
Vector vY = entity->GetAnglesHTC();
auto *WritePitch = reinterpret_cast<float*>(reinterpret_cast<DWORD>(entity) + gNetVars.get_offset("DT_TFPlayer", "tfnonlocaldata", "m_angEyeAngles[0]"));
auto *WriteYaw = reinterpret_cast<float*>(reinterpret_cast<DWORD>(entity) + gNetVars.get_offset("DT_TFPlayer", "tfnonlocaldata", "m_angEyeAngles[1]"));
bool resolver = false;
if (Util->IsKeyPressedMisc(gCvars.aimbot_resolver_key))
{
resolver = !resolver;
}
if (gCvars.aimbot_resolver && resolver)
{
if (vX.x == -89.0f)
{
*WritePitch = 90.0f;
}
if (vX.x == 89.0f)
{
*WritePitch = -90.0f;
}
}
}
}
}
if (gInts.Engine->IsInGame() && Stage == FRAME_RENDER_START)
{
CBaseEntity *oEntity = gInts.EntList->GetClientEntity(gInts.Engine->GetLocalPlayer());
int *Fov;
int OldFov;
int m_flFOVRate = 0xE5C;// Broken: nv.get_offset("DT_BasePlayer", "localdata", "m_flFOVRate");
int &fovPtr = *(int*)(oEntity + gNetVars.get_offset("DT_BasePlayer", "m_iFOV")), defaultFov = *(int*)(oEntity + gNetVars.get_offset("DT_BasePlayer", "m_iDefaultFOV"));
if (gESP.nozoom.value) //Thanks cademtz/Hold on! for this code, works amazingly aside from the inivisible sniper rifle xd
{
fovPtr = defaultFov;
*(float*)(oEntity + m_flFOVRate) = 0;
}
if (gESP.thirdperson.value) //shows antiaims just fine
{
CBaseEntity *oEntity = gInts.EntList->GetClientEntity(gInts.Engine->GetLocalPlayer());
auto *m_angEyeAngles = reinterpret_cast<float*>(reinterpret_cast<DWORD>(oEntity) + gNetVars.get_offset("DT_BasePlayer", "pl", "deadflag") + 8);
auto *HTC = reinterpret_cast<float*>(reinterpret_cast<DWORD>(oEntity) + gNetVars.get_offset("DT_BasePlayer", "pl", "deadflag") + 4);
*HTC = qLASTTICK.x;
*m_angEyeAngles = qLASTTICK.y;
ConVar* sv_cheats = gInts.cvar->FindVar("sv_cheats");
if (sv_cheats->GetInt() == 0) sv_cheats->SetValue(1);
ConVar* pThirdCamYaw = gInts.cvar->FindVar("cam_idealyaw");
gInts.Engine->ClientCmd_Unrestricted("thirdperson");
pThirdCamYaw->SetValue(0);
}
else if (!gESP.thirdperson.value)
{
gInts.Engine->ClientCmd_Unrestricted("firstperson");
}
}
VMTManager &HTCCNKBRKYLC = VMTManager::GetHook(CHLClient);
return HTCCNKBRKYLC.GetMethod<void(__fastcall *)(PVOID, void *, ClientFrameStage_t)>(35)(CHLClient, _this, Stage);
}
void __stdcall Hooked_DrawModelExecute(const DrawModelState_t &state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld)
{
VMTManager& hook = VMTManager::GetHook(gInts.ModelRender);
const char* pszModelName = gInts.ModelInfo->GetModelName((DWORD*)pInfo.pModel);
auto CallOriginal = hook.GetMethod<DrawModelExecuteFn>(19);
try
{
if (pInfo.pModel)
gESP.DrawModelExecute(state, pInfo, pCustomBoneToWorld, CallOriginal);
if (gESP.hands_enabled.value == 1 && strstr(pszModelName, "arms"))
return;
}
catch (...)
{
MessageBox(NULL, "Failed Hooked_DrawModelExecute()", "Error", MB_OK);
return CallOriginal(gInts.ModelRender, state, pInfo, pCustomBoneToWorld);
}
CallOriginal(gInts.ModelRender, state, pInfo, pCustomBoneToWorld);
gMat.ResetMaterial();
}
//============================================================================================
typedef void(__thiscall* FrameStageNotify)(void *, ClientFrameStage_t);
int __fastcall Hooked_KeyEvent(PVOID CHLClient, int edx, int eventcode, int keynum, const char *currentBinding)
{
VMTManager &hook = VMTManager::GetHook(CHLClient); // Get a pointer to the instance of your VMTManager with the function GetHook.
return hook.GetMethod<int(__thiscall *)(PVOID, int, int, const char *)>(gOffsets.iKeyEventOffset)(CHLClient, eventcode, keynum, currentBinding); // Call the original.
}
void FastStop()
{
// Get velocity
Vector vel = g.local->GetVelocity();
static auto sv_friction = gInts.cvar->FindVar("sv_friction");
static auto sv_stopspeed = gInts.cvar->FindVar("sv_stopspeed");
auto speed = vel.Length2D();
auto friction = sv_friction->GetFloat();
auto control = (speed < sv_stopspeed->GetFloat()) ? sv_stopspeed->GetFloat() : speed;
auto drop = control * friction * gInts.globals->interval_per_tick;
if (speed > drop - 1.0f)
{
Vector velocity = vel;
Vector direction;
VectorAngles(vel, direction);
float speed = velocity.Length();
direction.y = g.cmd->viewangles.y - direction.y;
Vector forward;
VectorAngles(direction, forward);
Vector negated_direction = forward * -speed;
g.cmd->forwardmove = negated_direction.x;
g.cmd->sidemove = negated_direction.y;
}
else
{
g.cmd->forwardmove = g.cmd->sidemove = 0.0f;
}
}
DetourHook CL_Move_Detour;
void Hooked_CL_Move(float accumulated_extra_samples, bool bFinalTick) {
auto Original = (CL_Move_t)CL_Move_Detour.GetOriginalFunc();
if ((gMisc.doubletap.value && (GetAsyncKeyState(VK_LBUTTON) || Util->IsKeyPressedMisc(gAim.key.value) && gAim.Autoshoot.value)) || (gMisc.warp.value && Util->IsKeyPressedMisc(gMisc.warp_key.value))) {
for (int i = 0; i < WarpCharge; i++)
{
IsDTing = true;
Original(accumulated_extra_samples, bFinalTick);
WarpCharge--;
}
}
else IsDTing = false;
if (Util->IsKeyPressedMisc(gMisc.warp_charge_key.value) && WarpCharge < gMisc.warp_value.value)
WarpCharge++;
else
Original(accumulated_extra_samples, bFinalTick);
CL_Move_Detour.RestorePatch();
}