-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathClient.cpp
More file actions
107 lines (92 loc) · 3.74 KB
/
Client.cpp
File metadata and controls
107 lines (92 loc) · 3.74 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
#include "SDK.h"
#include "Client.h"
#include "Util.h"
#include "Aimbot.h"
#include "Triggerbot.h"
#include "Misc.h"
#include "AntiAntiAim.h"
//============================================================================================
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.
bool bReturn = hook.GetMethod<bool(__thiscall*)(PVOID, float, CUserCmd*)>(gOffsets.iCreateMoveOffset)(ClientMode, input_sample_frametime, pCommand); //Call the original.
try
{
if (!pCommand->command_number)
return false;
CBaseEntity* pLocal = GetBaseEntity(me);
if (!pLocal)
return bReturn;
gMisc.Run(pLocal, pCommand);
gAim.Run(pLocal, pCommand);
gTrigger.Run(pLocal, pCommand);
}
catch(...)
{
Log::Fatal("Failed Hooked_CreateMove");
}
return false/*bReturn*/;
}
//============================================================================================
int __fastcall Hooked_KeyEvent(PVOID CHLClient, int edx, int eventcode, int keynum, const char *currentBinding)
{
if (eventcode == 1)
{
if (keynum == 72) //insert
{
gCheatMenu.bMenuActive = !gCheatMenu.bMenuActive;
}
if (gCheatMenu.bMenuActive)
{
if (keynum == 88 || keynum == 112) // Up
{
if (gCheatMenu.iMenuIndex > 0) gCheatMenu.iMenuIndex--;
else gCheatMenu.iMenuIndex = gCheatMenu.iMenuItems - 1;
return 0;
}
else if (keynum == 90 || keynum == 113) // Down
{
if (gCheatMenu.iMenuIndex < gCheatMenu.iMenuItems - 1) gCheatMenu.iMenuIndex++;
else gCheatMenu.iMenuIndex = 0;
return 0;
}
else if (keynum == 89 || keynum == 107) // Left
{
if (gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value)
{
gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value[0] -= gCheatMenu.pMenu[gCheatMenu.iMenuIndex].flStep;
if (gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value[0] < gCheatMenu.pMenu[gCheatMenu.iMenuIndex].flMin)
gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value[0] = gCheatMenu.pMenu[gCheatMenu.iMenuIndex].flMax;
}
return 0;
}
else if (keynum == 91 || keynum == 108) // Right
{
if (gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value)
{
gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value[0] += gCheatMenu.pMenu[gCheatMenu.iMenuIndex].flStep;
if (gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value[0] > gCheatMenu.pMenu[gCheatMenu.iMenuIndex].flMax)
gCheatMenu.pMenu[gCheatMenu.iMenuIndex].value[0] = gCheatMenu.pMenu[gCheatMenu.iMenuIndex].flMin;
}
return 0;
}
}
}
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 __fastcall Hooked_FrameStage(PVOID CHLClient, int edx, ClientFrameStage_t stage) {
VMTManager& hook = VMTManager::GetHook(CHLClient);
bool frame_modify = true;
switch (stage) {
case FRAME_NET_UPDATE_POSTDATAUPDATE_START:
gAntiAntiAim.PostDataUpdateStart(); // this is acting as a simple anti anti aim, do not expect too much out of this.
break;
default:
frame_modify = false;
break;
}
hook.GetMethod<void(__thiscall*)(PVOID, ClientFrameStage_t)>(gOffsets.iFrameStageOffset)(CHLClient, stage); // call the original but don't return, since this is a void.
}
//============================================================================================