Hey, I've recently learned some basic programming at school and wanted to try making a small triggerbot for cs go. So I looked at a lot of videos as well as some online guides and examples.
I've stumbled across some error in my own code, it wont shoot. I'm not sure what's wrong since I'm really new to hacking and there's no code errors. I compile the code to exe, and run that as a admin while i'm in a bot server with -insecure (offline).
Code:
#include <iostream>
#include <time.h>
#include <string>
#include <Windows.h>
using namespace std;
const DWORD client = (DWORD)GetModuleHandle(TEXT("client.dll"));
const DWORD playerBase = 0xAA5834; // 0xAA5834 0x00AA5818
const DWORD entityBase = 0x04AC8014; // 0x04AC8014
const DWORD crosshairOffset = 0x0000AA70;
const DWORD attack = 0x2F08194;
const DWORD teamOffset = 0xF0;
const DWORD healthOffset = 0xFC;
const DWORD EntLoopDist = 0x10;
HWND hWnd = 0;
void trigger(HANDLE);
int main() {
HWND hWnd = FindWindow(NULL, TEXT("Counter-Strike: Global Offensive"));
DWORD proc_id;
GetWindowThreadProcessId(hWnd, &proc_id);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
if (hWnd == 0) {
cout << "Handle not found" << endl;
}
else {
cout << "Found" << endl;
}
while (true) {
cout << "GOGOGO" << endl;
trigger(hProc);
Sleep(50);
}
system("PAUSE");
return 0;
}
void trigger(HANDLE hProc) {
DWORD EnemyInCH, LocalPlayer;
int EnemyHealth, EnemyTeam, LocalTeam, CrossHairID;
ReadProcessMemory(hProc, (LPCVOID)(client + playerBase), &LocalPlayer, sizeof(DWORD), NULL);
ReadProcessMemory(hProc, (LPCVOID)(LocalPlayer + teamOffset), &LocalTeam, sizeof(int), NULL);
ReadProcessMemory(hProc, (LPCVOID)(LocalPlayer + crosshairOffset), &CrossHairID, sizeof(int), NULL);
ReadProcessMemory(hProc, (LPCVOID)(client + entityBase + ((CrossHairID - 1) * EntLoopDist)), &EnemyInCH, sizeof(DWORD), NULL);
ReadProcessMemory(hProc, (LPCVOID)(EnemyInCH + healthOffset), &EnemyHealth, sizeof(int), NULL);
ReadProcessMemory(hProc, (LPCVOID)(EnemyInCH + teamOffset), &EnemyTeam, sizeof(int), NULL);
if (EnemyTeam == EnemyInCH && EnemyHealth >0){
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
Sleep(100);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
Sleep(10);
}
}
Sorry if it's sloppy written or hard to read..
Thanks a lot for any help or advice.