Why is this trigger bot not working?

Posts 113 of 13 · Page 1 of 1
Why is this trigger bot not working?
I followed a tutorial online (yes ik this is probably detected) on a triggerbot. Me having 4 years of java experience, coming to C++ is a new thing. Though watching his video actually taught me a bit about memory reading. The trigger bot atm is not working, I'm guessing my offsets are wrong but I've used dumpers and they seem correct. Can someone please tell me what's wrong?

Code:
#include <Windows.h>
#include <TlHelp32.h>
#include <string>
#include <iostream>

#define TRIGGER_KEY 0x56
#define var template<typename T> T

DWORD EntityList = 0x04A3BB64;
DWORD LocalPlayer = 0x00A9948C;
DWORD LifeState = 0x025B;
DWORD Team = 0x00F0;
DWORD CrossHairId = 0x00008CF4;
DWORD EntitySize = 0x10;

//new "datatype"
struct Module
{
	DWORD dwBase;
	DWORD dwSize;
};

//debugger class
class Debugger
{
private:
	HANDLE __process;
	DWORD __pId;
public:
	bool Attach(char* ProcessName)
	{
		HANDLE PHANDLE = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
		PROCESSENTRY32 CSENTRY;
		CSENTRY.dwFlags = sizeof(CSENTRY);
		do {
			if (!strcmp(CSENTRY.szExeFile, ProcessName)) {
				__pId = CSENTRY.th32ProcessID; //sets process' id
				CloseHandle(PHANDLE); //closes the opent handle
				__process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, __pId); //opens process for read/write
				return true; // operation was successful
			}
		} while (Process32Next(PHANDLE, &CSENTRY));
		return false; // operation failed (process was not found)
	}

	Module GetModule(char* ModuleName)
	{
		//same as in attach function, except for a dll in memory...
		HANDLE module = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, __pId);
		MODULEENTRY32 ModEntry;
		ModEntry.dwSize = sizeof(ModEntry);
		do {
			if (!strcmp(ModEntry.szModule, (char*)ModuleName)) {
				CloseHandle(module);
				return{ (DWORD)ModEntry.hModule, ModEntry.modBaseSize };
			}
		} while (Module32Next(module, &ModEntry));
		return{ (DWORD)NULL, (DWORD)NULL };
	}

	template <typename T> T read(DWORD Addr)
	{
		T __read;
		ReadProcessMemory(__process, (void*)Addr, &__read, sizeof(T), NULL);
		return __read;
	}
};

Debugger debugger;
DWORD dwClient, dwEngine;

class Entity
{
public:
	static DWORD GetBaseEntity(int PlayerNumber)
	{
		return debugger.read<DWORD>(dwClient + EntityList + (EntitySize * PlayerNumber));
	}
	static bool PlayerIsDead(int PlayerNumber)
	{
		DWORD BaseEntity = GetBaseEntity(PlayerNumber);
		if (BaseEntity) {
			return debugger.read<bool>(BaseEntity + LifeState);
		}
	}

	static int GetTeam(int PlayerNumber)
	{
		DWORD BaseEntity = GetBaseEntity(PlayerNumber);
		if (BaseEntity) {
			return debugger.read<int>(BaseEntity + Team);
		}
	}
};

class Game
{
public:
	static void GetPlayerBase(DWORD* retAddr)
	{
		(DWORD)*retAddr = debugger.read<DWORD>(dwClient + LocalPlayer);
	}
	static int GetTeam() //retrieves current team (ct/t)
	{
		DWORD PlayerBase;
		GetPlayerBase(&PlayerBase);
		if (PlayerBase)
			return debugger.read<int>(PlayerBase + Team);
	}
	static void GetCrosshairId(int* retAddr)
	{
		DWORD PlayerBase;
		GetPlayerBase(&PlayerBase);
		if (PlayerBase)
			(int)*retAddr = debugger.read<int>(PlayerBase + CrossHairId) - 1;
	}
};

void Click()
{
	mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
	Sleep(1);
	mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}

DWORD WINAPI TriggerThread(LPVOID PARAMS)
{
	while (1)
	{
		Sleep(1);
		if (GetAsyncKeyState(TRIGGER_KEY) < 0 && TRIGGER_KEY != 1)  //if the V key is down....
		{
			int PlayerNumber = NULL;
			Game::GetCrosshairId(&PlayerNumber); //get the current player number
			if (PlayerNumber < 64 && PlayerNumber >= 0 && Entity::GetTeam(PlayerNumber) != Game::GetTeam() && Entity::PlayerIsDead(PlayerNumber) == false)
			{
				Click(); //click
			}
		}
	}
	return 0;
}

int main()
{
	Module Client, Engine;
	//try to attach to csgo
	while (!debugger.Attach("csgo.exe")) {
		std::cout << ".";
		Sleep(500);
	}
	//client.dll & engine.dll are the 2 modules where our data about players exist.
	Client = debugger.GetModule("client.dll"); //get executable module client.dll
	dwClient = Client.dwBase;
	Engine = debugger.GetModule("engine.dll"); //get executable module engine.dll
	dwEngine = Engine.dwBase;
	CreateThread(0, 0, &TriggerThread, 0, 0, 0); //create a thread for the trigger loop
	std::cout << "Trigger thread is running...";

	while (1)
	{
		if (GetAsyncKeyState(VK_F4)) {
			exit(0);
		}
	}

}
Anyone? Still can't seem to figure out the offset problems.
Quote Originally Posted by Darky00 View Post
I followed a tutorial online (yes ik this is probably detected) on a triggerbot. Me having 4 years of java experience, coming to C++ is a new thing. Though watching his video actually taught me a bit about memory reading. The trigger bot atm is not working, I'm guessing my offsets are wrong but I've used dumpers and they seem correct. Can someone please tell me what's wrong?

Code:
#include <Windows.h>
#include <TlHelp32.h>
#include <string>
#include <iostream>

#define TRIGGER_KEY 0x56
#define var template<typename T> T

DWORD EntityList = 0x04A3BB64;
DWORD LocalPlayer = 0x00A9948C;
DWORD LifeState = 0x025B;
DWORD Team = 0x00F0;
DWORD CrossHairId = 0x00008CF4;
DWORD EntitySize = 0x10;

//new "datatype"
struct Module
{
	DWORD dwBase;
	DWORD dwSize;
};

//debugger class
class Debugger
{
private:
	HANDLE __process;
	DWORD __pId;
public:
	bool Attach(char* ProcessName)
	{
		HANDLE PHANDLE = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
		PROCESSENTRY32 CSENTRY;
		CSENTRY.dwFlags = sizeof(CSENTRY);
		do {
			if (!strcmp(CSENTRY.szExeFile, ProcessName)) {
				__pId = CSENTRY.th32ProcessID; //sets process' id
				CloseHandle(PHANDLE); //closes the opent handle
				__process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, __pId); //opens process for read/write
				return true; // operation was successful
			}
		} while (Process32Next(PHANDLE, &CSENTRY));
		return false; // operation failed (process was not found)
	}

	Module GetModule(char* ModuleName)
	{
		//same as in attach function, except for a dll in memory...
		HANDLE module = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, __pId);
		MODULEENTRY32 ModEntry;
		ModEntry.dwSize = sizeof(ModEntry);
		do {
			if (!strcmp(ModEntry.szModule, (char*)ModuleName)) {
				CloseHandle(module);
				return{ (DWORD)ModEntry.hModule, ModEntry.modBaseSize };
			}
		} while (Module32Next(module, &ModEntry));
		return{ (DWORD)NULL, (DWORD)NULL };
	}

	template <typename T> T read(DWORD Addr)
	{
		T __read;
		ReadProcessMemory(__process, (void*)Addr, &__read, sizeof(T), NULL);
		return __read;
	}
};

Debugger debugger;
DWORD dwClient, dwEngine;

class Entity
{
public:
	static DWORD GetBaseEntity(int PlayerNumber)
	{
		return debugger.read<DWORD>(dwClient + EntityList + (EntitySize * PlayerNumber));
	}
	static bool PlayerIsDead(int PlayerNumber)
	{
		DWORD BaseEntity = GetBaseEntity(PlayerNumber);
		if (BaseEntity) {
			return debugger.read<bool>(BaseEntity + LifeState);
		}
	}

	static int GetTeam(int PlayerNumber)
	{
		DWORD BaseEntity = GetBaseEntity(PlayerNumber);
		if (BaseEntity) {
			return debugger.read<int>(BaseEntity + Team);
		}
	}
};

class Game
{
public:
	static void GetPlayerBase(DWORD* retAddr)
	{
		(DWORD)*retAddr = debugger.read<DWORD>(dwClient + LocalPlayer);
	}
	static int GetTeam() //retrieves current team (ct/t)
	{
		DWORD PlayerBase;
		GetPlayerBase(&PlayerBase);
		if (PlayerBase)
			return debugger.read<int>(PlayerBase + Team);
	}
	static void GetCrosshairId(int* retAddr)
	{
		DWORD PlayerBase;
		GetPlayerBase(&PlayerBase);
		if (PlayerBase)
			(int)*retAddr = debugger.read<int>(PlayerBase + CrossHairId) - 1;
	}
};

void Click()
{
	mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
	Sleep(1);
	mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}

DWORD WINAPI TriggerThread(LPVOID PARAMS)
{
	while (1)
	{
		Sleep(1);
		if (GetAsyncKeyState(TRIGGER_KEY) < 0 && TRIGGER_KEY != 1)  //if the V key is down....
		{
			int PlayerNumber = NULL;
			Game::GetCrosshairId(&PlayerNumber); //get the current player number
			if (PlayerNumber < 64 && PlayerNumber >= 0 && Entity::GetTeam(PlayerNumber) != Game::GetTeam() && Entity::PlayerIsDead(PlayerNumber) == false)
			{
				Click(); //click
			}
		}
	}
	return 0;
}

int main()
{
	Module Client, Engine;
	//try to attach to csgo
	while (!debugger.Attach("csgo.exe")) {
		std::cout << ".";
		Sleep(500);
	}
	//client.dll & engine.dll are the 2 modules where our data about players exist.
	Client = debugger.GetModule("client.dll"); //get executable module client.dll
	dwClient = Client.dwBase;
	Engine = debugger.GetModule("engine.dll"); //get executable module engine.dll
	dwEngine = Engine.dwBase;
	CreateThread(0, 0, &TriggerThread, 0, 0, 0); //create a thread for the trigger loop
	std::cout << "Trigger thread is running...";

	while (1)
	{
		if (GetAsyncKeyState(VK_F4)) {
			exit(0);
		}
	}

}
Change offsets to

DWORD EntityList = 0x4A3BB64;
DWORD LocalPlayer = 0xA9948C;
DWORD LifeState = 0x25B;
DWORD Team = 0xF0;
DWORD CrossHairId = 0x8CF4;
DWORD EntitySize = 0x10;

Gl, if you had 4 years java experience you would of known this. So you are probably just trying to copypaste anyways, w/e idc enjoy your triggerbot
Quote Originally Posted by hurenzohnkiller View Post
Change offsets to

DWORD EntityList = 0x4A3BB64;
DWORD LocalPlayer = 0xA9948C;
DWORD LifeState = 0x25B;
DWORD Team = 0xF0;
DWORD CrossHairId = 0x8CF4;
DWORD EntitySize = 0x10;

Gl, if you had 4 years java experience you would of known this. So you are probably just trying to copypaste anyways, w/e idc enjoy your triggerbot
well thanks but I do have 4 years of experience, what would java experience have to do with any memory hacking in c++?
Quote Originally Posted by hurenzohnkiller View Post
Change offsets to

DWORD EntityList = 0x4A3BB64;
DWORD LocalPlayer = 0xA9948C;
DWORD LifeState = 0x25B;
DWORD Team = 0xF0;
DWORD CrossHairId = 0x8CF4;
DWORD EntitySize = 0x10;

Gl, if you had 4 years java experience you would of known this. So you are probably just trying to copypaste anyways, w/e idc enjoy your triggerbot
That's the first thing that came to my mind.
Quote Originally Posted by hurenzohnkiller View Post
Change offsets to

DWORD EntityList = 0x4A3BB64;
DWORD LocalPlayer = 0xA9948C;
DWORD LifeState = 0x25B;
DWORD Team = 0xF0;
DWORD CrossHairId = 0x8CF4;
DWORD EntitySize = 0x10;

Gl, if you had 4 years java experience you would of known this. So you are probably just trying to copypaste anyways, w/e idc enjoy your triggerbot
wtf mate

You really think theres a difference between 0x00F0 and 0xF0? Thats like saying 000001 is less than 1.
Quote Originally Posted by gtaplayer2 View Post
wtf mate

You really think theres a difference between 0x00F0 and 0xF0? Thats like saying 000001 is less than 1.
it is because you have to remove all 0's that is there until some else number/letter comes..
lol, forexample if it is
0x00876CF
then it sohuld be 0x8766CF otherwise it won't work so i just removed all 0's on his offsets.
stop acting like a coder when you don't know what you are speaking about
Quote Originally Posted by hurenzohnkiller View Post
it is because you have to remove all 0's that is there until some else number/letter comes..
lol, forexample if it is
0x00876CF
then it sohuld be 0x8766CF otherwise it won't work so i just removed all 0's on his offsets.
stop acting like a coder when you don't know what you are speaking about
are you joking ? he is probably the best coder on this forum and he is obviously right.
Quote Originally Posted by hurenzohnkiller View Post
it is because you have to remove all 0's that is there until some else number/letter comes..
lol, forexample if it is
0x00876CF
then it sohuld be 0x8766CF otherwise it won't work so i just removed all 0's on his offsets.
stop acting like a coder when you don't know what you are speaking about

I got my wallpaper for a week LOL AHHAHAHAHHAHAH

M8, stop paying your internet plz...
So a banana with 3 black dots != from a banana with 2 black dots, so the final product result in banana != banana, that equal's apple^orange
Fine!
Great Job!
Quote Originally Posted by hurenzohnkiller View Post
it is because you have to remove all 0's that is there until some else number/letter comes..
lol, forexample if it is
0x00876CF
then it sohuld be 0x8766CF otherwise it won't work so i just removed all 0's on his offsets.
stop acting like a coder when you don't know what you are speaking about
I can assure you he has more knowledge than you do.
YOU are the one who is asking for copy paste ready code every single week on UC & MPGH.

YOU obviously don't know anything about what you are talking about. @gtaplayer2 even gave you the logic example.

Why do you respond to this if you have no clue about it?
Quote Originally Posted by Darky00 View Post
well thanks but I do have 4 years of experience, what would java experience have to do with any memory hacking in c++?
Well just to don't let you alone, try changing EntityList, LocalPlayer and Crosshair ID, they changed...

void Click()
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(1);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}

Change that sleep for a little bit more i think...

if (GetAsyncKeyState(TRIGGER_KEY) < 0 && TRIGGER_KEY != 1) //if the V key is down....
to
if (GetAsyncKeyState(TRIGGER_KEY) & 0x8000)

and debug it using simple cout << "aaa"; to see where it stop's and tell us

Not sure, i dont even read the full code, just part of it, so, try doing this first and debuging it
My offsets were just wrong, thanks for the help though guys.
Quote Originally Posted by hurenzohnkiller View Post
What the fuck did i say? god you are all retards.
Of course we are retards, because you are blaming @gtaplayer2 for a completely right statement, telling him to gtfo because he should learn how to code.

He even literally told you the logic example.

001 is the same as 1. And you are telling him to gtfo because you are claiming you can code when you almost weekly ask for copy paste ready code? /lmao

Yea, because we defended him telling you that you are wrong means that WE are retarded.

God im outta here.
Posts 113 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?