This repository was archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathMain.cpp
85 lines (78 loc) · 2.4 KB
/
Main.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
#include <iostream>
#include <string>
#include <unistd.h>
#include <vector>
#include <chrono>
#include <thread>
#include "Utils.cpp"
#include "Offsets.cpp"
#include "Level.cpp"
#include "LocalPlayer.cpp"
#include "Player.cpp"
#include "Sense.cpp"
#include "NoRecoil.cpp"
#include "Aimbot.cpp"
#include "X11Utils.cpp"
#include "ConfigLoader.cpp"
int main(int argc, char *argv[])
{
ConfigLoader *configLoader = new ConfigLoader();
if (getuid())
{
printf("MUST RUN AS ROOT!\n");
return -1;
}
if (mem::GetPID() == 0)
{
printf("GAME NOT FOUND. EXITING!\n");
return -1;
}
Level *level = new Level();
LocalPlayer *localPlayer = new LocalPlayer();
X11Utils *x11Utils = new X11Utils();
std::vector<Player *> *players = new std::vector<Player *>;
for (int i = 0; i < 60; i++)
{
players->push_back(new Player(i));
}
Sense *sense = new Sense(configLoader, level, localPlayer, players, x11Utils);
NoRecoil *noRecoil = new NoRecoil(configLoader, level, localPlayer, players, x11Utils);
Aimbot *aimbot = new Aimbot(configLoader, level, localPlayer, players, x11Utils);
// Main loop
printf("MYAPEX STARTING MAIN LOOP\n");
int counter = 0;
while (1)
{
try
{
if (counter % 200 == 0)
configLoader->reloadFile(); // will attempt to reload config if there have been any updates to it
// resolve pointers
localPlayer->markForPointerResolution();
for (int i = 0; i < players->size(); i++)
{
Player *player = players->at(i);
player->markForPointerResolution();
}
// run features
if (configLoader->isAimbotOn())
aimbot->update();
if (configLoader->isNorecoilOn())
noRecoil->update();
if (configLoader->isSenseOn())
sense->update();
// all ran fine
if (counter % 1000 == 0)
printf("UPDATE[%d] OK. \n", counter);
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
catch (...)
{
printf("UPDATE[%d] ERROR (LOADING SCREEN?). SLEEPING FOR 10 SECONDS\n", counter);
std::this_thread::sleep_for(std::chrono::seconds(10));
}
counter++;
if (counter > 1000)
counter = 0;
}
}