-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
197 lines (160 loc) · 4.33 KB
/
main.cpp
File metadata and controls
197 lines (160 loc) · 4.33 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
#include <iostream>
#include <thread>
#include <map>
#include "GlobalVars.hpp"
#include "MenuServer.hpp"
#include "Defines.hpp"
#include "Memory.hpp"
#include "Modules.hpp"
#include "Client.hpp"
#include "Engine.hpp"
#include "bsb-parser/bsp_parser.hpp"
#include "Settings.hpp"
#include "Offsets.hpp"
#include "Visuals.hpp"
#include "AimBot.hpp"
#include "TriggerBot.hpp"
#include "Skinchanger.hpp"
#include "Misc.hpp"
#include "Helpers.hpp"
using namespace std;
#pragma region Global Vars
MenuServer menuServer;
Memory mem;
PModule clientDll;
PModule engineDll;
Client client;
Engine engine;
rn::bsp_parser bsp_parser;
map<ItemDefinitionIndex, int> modelIndexes;
#pragma endregion
bool isWorking = true;
Visuals visuals;
AimBot aimBot;
TriggerBot triggetBot;
Skinchanger skinchanger;
Misc misc;
int main() {
try
{
cout << "[Main]: Waiting for process '" << GAME_NAME << "'." << endl;
while (!mem.Attach(GAME_NAME, PROCESS_ALL_ACCESS)) {
Sleep(100);
}
cout << "[Main]: Attached in process '" << GAME_NAME << "'." << endl;
clientDll = mem.GetModule(CLIENT_DLL_NAME);
while (!clientDll.dwBase || !clientDll.dwSize) {
Sleep(100);
clientDll = mem.GetModule(CLIENT_DLL_NAME);
}
cout << "[Main]: Module '" << CLIENT_DLL_NAME << "' loaded. DwBase: " << clientDll.dwBase << endl;
engineDll = mem.GetModule(ENGINE_DLL_NAME);
while (!engineDll.dwBase || !engineDll.dwSize) {
Sleep(100);
engineDll = mem.GetModule(ENGINE_DLL_NAME);
}
cout << "[Main]: Module '" << ENGINE_DLL_NAME << "' loaded. DwBase: " << engineDll.dwBase << endl;
Offsets::get();
Settings::getFromFile("default.json");
thread thMenuData([]() {
int lastActiveWeaponIDI = -1;
TeamNum lastTeam = NO_TEAM;
while (isWorking) {
if (
engine.clientState->state() != INGAME ||
client.localPlayer->m_iHealth() <= 0 ||
client.localPlayer->m_iTeamNum() < TERRORIST
) {
continue;
}
int activeWeaponID = client.localPlayer->m_hActiveWeapon() & 0xfff;
BaseCombatWeapon activeWeapon = BaseCombatWeapon(client.entityList->getByID(activeWeaponID - 1));
auto activeWeaponIDI = (int)activeWeapon.m_iItemDefinitionIndex();
if (activeWeaponIDI != INVALID_ITEM_DI && activeWeaponIDI != lastActiveWeaponIDI) {
lastActiveWeaponIDI = activeWeaponIDI;
menuServer.getActiveWeapon(activeWeaponIDI);
}
auto team = client.localPlayer->m_iTeamNum();
if (lastTeam != team) {
lastTeam = team;
menuServer.getTeam(team);
}
}
Sleep(1);
});
thread thMenuServer([]() {
menuServer.start();
});
thread thMenuOpen([]() { while (isWorking) {
if (GetAsyncKeyState(VK_INSERT)) {
Helpers::toggleSteamOverlay();
Sleep(1000);
}
}});
thread thVisuals([]() { while (isWorking) {
visuals.loop();
Sleep(1);
}});
thread thAimBot([]() { while (isWorking) {
aimBot.loop();
Sleep(1);
}});
thread thTriggerBot([]() { while (isWorking) {
triggetBot.loop();
Sleep(1);
}});
thread thSkinchanger([]() { while (isWorking) {
skinchanger.loop();
//Sleep(1);
}});
thread thMiscRadarHack([]() { while (isWorking) {
misc.radarHack();
Sleep(1);
}});
thread thMiscBhop([]() { while (isWorking) {
misc.bhop();
Sleep(1);
}});
thread thMiscAutoPistols([]() { while (isWorking) {
misc.autoPistols();
Sleep(1);
}});
thread thMiscAutoAccept([]() { while (isWorking) {
misc.autoAccept();
Sleep(1);
}});
thread thMap([]() {
auto lastClientState = 0;
while (isWorking) {
auto state = engine.clientState->state();
if (state == INGAME && lastClientState != state) {
while (client.localPlayer->m_iTeamNum() != TERRORIST && client.localPlayer->m_iTeamNum() != COUNTER_TERRORIST) {
Sleep(100);
}
//for bsp parser
auto gameDir = engine.dwGameDir().data();
auto mapDir = engine.clientState->mapDirectory().data();
bsp_parser.load_map(gameDir, mapDir);
//for skinchanger
Helpers::updateModelIndexes();
}
lastClientState = state;
}
});
thMenuServer.detach();
thMenuData.join();
thMenuOpen.join();
thVisuals.join();
thAimBot.join();
thTriggerBot.join();
thSkinchanger.join();
thMiscRadarHack.join();
thMiscBhop.join();
thMiscAutoPistols.join();
thMap.join();
}
catch (const exception& err){
cout << "[Main]: Catch. Error: '" << err.what() << endl;
}
return 0;
}