-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
71 lines (55 loc) · 2.12 KB
/
main.cpp
File metadata and controls
71 lines (55 loc) · 2.12 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
#include <windows.h>
#include <tlhelp32.h>
#include <iostream>
#include <string>
#include "memory.h"
// Main function
int main() {
std::string processName = "cs2.exe";
std::string moduleName = "client.dll";
DWORD processID = GetProcessID(processName);
std::cout << "Process ID: " << processID << std::endl;
if (!processID) {
std::cerr << "Process not found." << std::endl;
return 1;
}
uintptr_t baseAddress = GetModuleBaseAddress(processID, moduleName);
std::cout << "Module base address: " << "0x" << baseAddress << std::endl;
if (!baseAddress) {
std::cerr << "Failed to get module base address." << std::endl;
return 1;
}
uintptr_t dwLocalPlayerPawn = 0x1824A18; // first offset
uintptr_t m_iIDEntIndex = 0x13A8; // second offset
uintptr_t firstPointerAddress = baseAddress + dwLocalPlayerPawn;
uintptr_t actualAddress;
// Read the first pointer
if (!ReadMemory(processID, reinterpret_cast<LPCVOID>(firstPointerAddress), &actualAddress, sizeof(actualAddress))) {
std::cerr << "Failed to read first pointer." << std::endl;
return 1;
}
uintptr_t entityIDAddress = actualAddress + m_iIDEntIndex;
bool triggerbotEnabled = false;
std::cout << "Press LEFT ALT to toggle triggerbot on/off." << std::endl;
while (true) {
// Check if alt key is pressed
if (GetAsyncKeyState(VK_MENU) & 0x8000) {
triggerbotEnabled = !triggerbotEnabled;
std::cout << "Triggerbot " << (triggerbotEnabled ? "enabled" : "disabled") << std::endl;
Sleep(300); // Debounce to prevent multiple toggles from a single press
}
if (triggerbotEnabled) {
int entityID;
if (ReadMemory(processID, reinterpret_cast<LPCVOID>(entityIDAddress), &entityID, sizeof(entityID))) {
if (entityID >= 0) {
ClickMouse();
}
}
else {
std::cerr << "Failed to read entityID." << std::endl;
}
}
Sleep(10); // Delay to prevent CPU overload
}
return 0;
}