-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
86 lines (65 loc) · 2.76 KB
/
main.cpp
File metadata and controls
86 lines (65 loc) · 2.76 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
#include <iostream>
#include <windows.h>
#include <sstream>
void maxHealth(HANDLE hProcess, int* base_ptr);
void maxBullets(HANDLE hProcess, int* base_ptr);
void maxReload(HANDLE hProcess, int* base_ptr);
namespace offsets {
int healthAddress = 0xEC;
int rifleBulletsAddress = 0x140;
int bagAddress = 0x11C;
}
int main(int argc, char* argv[]) {
const intptr_t BASE_ADDRESS = 0x057E0A8; // ac_client.exe
int* base_ptr = 0;
HWND gameWindow = FindWindow(NULL, L"AssaultCube");
DWORD windowProcess;
GetWindowThreadProcessId(gameWindow, &windowProcess);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, windowProcess);
ReadProcessMemory(hProcess, (LPCVOID)BASE_ADDRESS, &base_ptr, sizeof(int*), NULL);
std::cout << "--------------------------------------" << std::endl;
std::cout << "[TAB] - Maximize Life\n"
<< "[F1] - Maximize Primary Ammo\n"
<< "[F2] - Maximize Primary Reload Ammo\n";
std::cout << "--------------------------------------" << std::endl;
while (true) {
if (GetAsyncKeyState(VK_TAB)) {
maxHealth(hProcess, base_ptr);
}
else if (GetAsyncKeyState(VK_F1)) {
maxBullets(hProcess, base_ptr);
}
else if (GetAsyncKeyState(VK_F2)) {
maxReload(hProcess, base_ptr);
}
}
CloseHandle(hProcess);
return 0;
}
void maxHealth(HANDLE hProcess, int* base_ptr) {
int* target_ptr = reinterpret_cast<int*>((intptr_t)base_ptr + ::offsets::healthAddress);
int target_value = 0;
int maxHealth = 9999;
// Ler o valor no endereço alvo
ReadProcessMemory(hProcess, target_ptr, &target_value, sizeof(int), NULL);
// Alterar o valor no endereço alvo
WriteProcessMemory(hProcess, target_ptr, &maxHealth, sizeof(int), NULL);
}
void maxBullets(HANDLE hProcess, int* base_ptr) {
int* target_ptr = reinterpret_cast<int*>((intptr_t)base_ptr + ::offsets::rifleBulletsAddress);
int target_value = 0;
int maxBullets = 9999;
// Ler o valor no endereço alvo
ReadProcessMemory(hProcess, target_ptr, &target_value, sizeof(int), NULL);
// Alterar o valor no endereço alvo
WriteProcessMemory(hProcess, target_ptr, &maxBullets, sizeof(int), NULL);
}
void maxReload(HANDLE hProcess, int* base_ptr) {
int* target_ptr = reinterpret_cast<int*>((intptr_t)base_ptr + ::offsets::bagAddress);
int target_value = 0;
int maxReload = 9999;
// Ler o valor no endereço alvo
ReadProcessMemory(hProcess, target_ptr, &target_value, sizeof(int), NULL);
// Alterar o valor no endereço alvo
WriteProcessMemory(hProcess, target_ptr, &maxBullets, sizeof(int), NULL);
}