❓ Code review - External Trigger Bot

Posts 1–15 of 17 · Page 1 of 2
❓ Code review - External Trigger Bot
Ok so this is the second time I Post this, this time it should be on the right forum and nothing breaking the rules basicly like last time I wanted to know if I could message someone to review my code wich is C++ and my first actual working cheat and give some advice and tell me if it would get insta VAC ban or undetected. I dont think I can send PM's until I reach a certain ammount of posts but if Im wrong tell me how to PM and I can send u code.
Thx

Code:
#include <windows.h>
#include <tlhelp32.h>
#include <iostream>

DWORD LBASE = 0xA6E444; // Local Player Base
DWORD Cross = 0xA940; //Crosshair ID
DWORD TEAM = 0xF0; //Team Offset 2 - Terrorist 3 - Counter Terrorist

DWORD EntBase = 0x4A5C9C4; //Player List
DWORD Coff; // Client Offset
DWORD ID; //Game ProcessID
HANDLE ph; // Game Handle

DWORD GetProc(char * name); //Get ProcID
DWORD GetDLL(char * name);//Get Client 

const DWORD ProcSize = sizeof(PROCESSENTRY32);
const DWORD ModSize = sizeof(MODULEENTRY32);

struct User {
	DWORD Base;
	DWORD Player;
	DWORD ID;
	DWORD Team;
	DWORD MyTeam;
	DWORD Enemy[32];
	DWORD Temp = 0;

	void Once()
	{
		ReadProcessMemory(ph, (PBYTE *)(Coff + LBASE), &Base, sizeof(DWORD), NULL); // Gets Player Base Address
		ReadProcessMemory(ph, (PBYTE *)(Base + 0xF0), &MyTeam, sizeof(DWORD), NULL); // Gets My Team
		//std::cout << "My Team: " << MyTeam << "\n";
		for (int i = 0; i < 32; i++)
		{
			ReadProcessMemory(ph,(PBYTE *)(Coff + EntBase + (i * 0x10)),&Player,sizeof(DWORD),NULL); // Gets Player
			ReadProcessMemory(ph, (PBYTE *)(Player + TEAM), &Team, sizeof(DWORD), NULL); // Gets Player Team
			//std::cout << "ID : " << i + 1 << "Team: " << Team << "\n";
			if (Team != MyTeam && (Team == 2 || Team == 3)) // If Player Is not on our Team add hem to Enemy List otherwise do nothing
			{
				Enemy[Temp] = i+1;
				Temp++;
			}
		}
		//std::cout << Enemy[0] << std::endl << Enemy[1] << std::endl << Enemy[2] << std::endl << Enemy[3] << std::endl << Enemy[4] << std::endl;
	}

	void ReadInfo()//Read player Crosshair ID
	{
		ReadProcessMemory(ph,(PBYTE *)(Base + Cross),&ID,sizeof(DWORD),NULL);
	}
};

int main()
{
	Sleep(1000);
	User P;
	ID = GetProc("csgo.exe");
	ph = OpenProcess(PROCESS_VM_READ, 0, ID);
	Coff = GetDLL("client.dll");
	P.Once();

	while (!GetAsyncKeyState(VK_END))
	{
		Sleep(2);
		P.ReadInfo();
		//std::cout << P.ID << "\n";
		for (int i = 0; i < 32;i++){
			if (P.ID == P.Enemy[i] && P.ID != 0) {
				mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
				Sleep(10);
				mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
			}
		}
	}
	CloseHandle(ph);
	//system("PAUSE");
	return 0;
}

DWORD GetProc(char * name) //Get ProcID
{
	PROCESSENTRY32 proc;
	proc.dwSize = ProcSize;
	HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);

	if (Process32First(snap, &proc))
	{
		do {
			if (!strcmp(proc.szExeFile,name))
			{
				CloseHandle(snap);
				return proc.th32ProcessID;
			}
		} while (Process32Next(snap, &proc));
	}
	return 0;
}

DWORD GetDLL(char * name) //Get Client.dll Base address
{
	MODULEENTRY32 mod;
	mod.dwSize = ModSize;
	HANDLE m = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,ID);

	if (Module32First(m, &mod))
	{
		do {
			if (!strcmp(name, mod.szModule))
			{
				CloseHandle(m);
				return (DWORD)mod.modBaseAddr;
			}
		} while (Module32Next(m,&mod));
	}
	return 0;
}
Why dont you just post the trigger code here so we can review it? Rather then being forced to PM an unknown user?
I guess u have a point Ill post the code
Quote Originally Posted by diogo464 View Post
I guess u have a point Ill post the code
So by looking at it, im quite the dirty coder myself so i cant really give you advice in that regard. However, since you are doing a triggerbot i wouldn't do mouse events.. Write to attack instead.
I dont really know how VAC works exacly but from my understanding wouldn't Writting to a common offset make my cheat easer to detect rather then just reading a value and then use mouse event?
Quote Originally Posted by diogo464 View Post
I dont really know how VAC works exacly but from my understanding wouldn't Writting to a common offset make my cheat easer to detect rather then just reading a value and then use mouse event?
no lol

//2short
Ok Ill add that in then and probably re-write the code since someone allready saw it thx.
Quote Originally Posted by diogo464 View Post
Ok Ill add that in then and probably re-write the code since someone allready saw it thx.
I don´t think that Mew will release your codenz.
And you can youse mouse_event. I use it too. Dont think there is a difference ^^
Looks like very basic code that everyone c+p uses nowadays, I'd suggest spending time making your own framework for handling stuff like input, GUI & memory wise both interprocess and for your own process like comparing bytes etc.

Ok thx for your answers Ill try and add more stuff to the code and should I make a GUI should it be drawed on the game window or should it be an actuall GUI using some library?
Go internal or take directx overlay path
Or.. Dont make a GUI
For now will probably leave whitout gui and just add a few other things since making a gui seems a bit complicated
what is your compiler you are using ?
Posts 1–15 of 17 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us