What's wrong?

Posts 1–10 of 10 · Page 1 of 1
What's wrong?
Hey guys! I'm a n00b and new to game hacking in general. I've been analyzing source code and came across a trigger bot tutorial. I updated the offsets and feel like everything should be working. However, it is not. Can you guys take a look and tell me what is wrong?
Code:
#include <Windows.h>
#include <TlHelp32.h>
#include <string>
#include <iostream>

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

DWORD EntityList = 0x04A98174;
DWORD LocalPlayer = 0x00A7D4CC;
DWORD LifeState = 0x0000025B;
DWORD Team = 0x000000F0;
DWORD CrossHairId = 0x0000A954;
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);
		}
	}

}
Without looking at the code, the CrossHairID offset is wrong, its 0xA950.
Quote Originally Posted by WasserEsser View Post
Without looking at the code, the CrossHairID offset is wrong, its 0xA950.
Thank you so much my frined. That fixed it. I've been using the Y3t1y3t's Dumper from UC. Is there a better one you recommend or should I just start searching for offsets myself?
Quote Originally Posted by CLOOK View Post
Thank you so much my frined. That fixed it. I've been using the Y3t1y3t's Dumper from UC. Is there a better one you recommend or should I just start searching for offsets myself?
Add a pattern scanner so you don't have to update the offsets everytime the game updates.. Or learn to code internals.
Quote Originally Posted by VaginaSlayer View Post
Add a pattern scanner so you don't have to update the offsets everytime the game updates.. Or learn to code internals.
Are there some good resources for internal coding? If so can you help me out. I've found some stuff on here and uc but its kind of random and unclear.
Quote Originally Posted by CLOOK View Post
Are there some good resources for internal coding? If so can you help me out. I've found some stuff on here and uc but its kind of random and unclear.
You can find internal bases, and videos to help you get started with this sort of thing.
Quote Originally Posted by 4nuoFZf9aE View Post


You can find internal bases, and videos to help you get started with this sort of thing.
Is there anything you can show me? I've been looking, but all I see is fully built internal cheats. As for the videos, I couldn't find any. Sorry if I sound annoying, but I really want to learn.
Quote Originally Posted by CLOOK View Post
Is there anything you can show me? I've been looking, but all I see is fully built internal cheats. As for the videos, I couldn't find any. Sorry if I sound annoying, but I really want to learn.
A lot of guides and sources on other third party sites just google around.
If you can code externals you have no issue coding internals...
If you are having issues with both try to get more familiar with C++ first.
Quote Originally Posted by VaginaSlayer View Post
If you can code externals you have no issue coding internals...
If you are having issues with both try to get more familiar with C++ first.
They can be quite different, but basic knowledge of C++ should help him with both you are right.
Posts 1–10 of 10 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us