PostSolvedEasy Triggerbot help!

Posts 1–4 of 4 · Page 1 of 1
Easy Triggerbot help!
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.
i didn't look at other part of your code, but your "if" was totally wrong. i fixed it.
Code:
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 (LocalTeam != EnemyTeam && EnemyHealth  > 0)
		{ 
		mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
		Sleep(100);
		mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
		Sleep(10);
		}

}
you can use command "printf" to check is everything fine. like:
Code:
		if (LocalTeam != EnemyTeam && EnemyHealth  > 0)
		{ 
		printf("Shoot");
		mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
		Sleep(100);
		mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
		Sleep(10);

		}
Been over a week since last bump/update. Assuming solved.

//closed.
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us