I'm having trouble with this. At the moment it does nothing. If anyone could help I would appreciate it.
Code:
#include <iostream>
#include <Windows.h>
#include "ProcMem.h" //Memory reading
using namespace std;
DWORD processID;
/* Offsets */
//Needs to be updated when CSS is updated
const DWORD playerBase = 0x53BFC8; // Player Data Structure // DWORD = 4 bytes long aka 32 bits
const DWORD entityBase = 0x5495B4; // Entity Base (list of players, which in this case includes you)
const DWORD crosshair = 0x14DC; // We can use this as a triggerbot. (14DC) (14D1)
// Does not change on updated, in other words
const DWORD team = 0x98; // Team 1 - Spec, 2 - T, 3 - CT
const DWORD health = 0x90; // Health
const DWORD entLoopDist = 0x10; // The distance between each player data structure
/* Offsets */
DWORD Client;
ProcMem mem;
int main()
{
HWND hwnd = FindWindowA(0, ("Counter-Strike Source")); //find game window
GetWindowThreadProcessId(hwnd, &processID); //Where we will store the process of the game
HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID); //What access is required. e.g. read/write. And where we're going to have that access
Sleep(200);
Client = mem.Module("client.dll");
SetConsoleTitle("Triggerbot");
Sleep(50);
for (;;) {
//our player
DWORD localPlayer = mem.Read<DWORD>(Client + playerBase);
//our team
int localTeam = mem.Read<int>(localPlayer + team);
//our crosshair
int crosshairID = mem.Read<int>(localPlayer + crosshair);
cout << crosshairID << endl; //this outputs 858993460
DWORD enemyInCH = mem.Read<DWORD>(Client + entityBase + ((crosshairID - 1) * entLoopDist));
int enemyHP = mem.Read<int>(enemyInCH + health);
int enemyTeam = mem.Read<int>(enemyInCH + team);
if (localTeam != enemyTeam && enemyHP > 0) {
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
Sleep(50);
}
}
return 0;
system("pause"); //pause window
}