Simple trigger bot

Posts 1–15 of 15 · Page 1 of 1
Simple trigger bot
Hello gaiiiiiyyyyss.
Right now I am using ProcMem.h and ProcMem.cpp by Fleep ( Ithink). But I am trying to make this simple triggerbot, it launches fine no error and finds process and module but for some reason it doesnt shoot. I appreciate the help, thanks.

Code:
#include <iostream>
#include <cstdio>

#include "ProcMem.h"
ProcMem Mem;
using namespace std;

const DWORD playerBase = 0x00A30504;
const DWORD entityBase = 0x04A4B934;
const DWORD crosshairOffset = 0x0000AA44;
 
const DWORD teamOffset = 0xF0;
const DWORD healthOffset = 0xFC;
const DWORD EntLoopDist = 0x10;





int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");


DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);

int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);

int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
	
while (true)
		{
	DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
	int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
	int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset); 
	if (LocalTeam != EnemyTeam && EnemyHealth > 0)
	{
		
		mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
		
		mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
		
	}
		}
	
	
}
I haven't really looked for the issue but there is no delay here:

mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);

And there is also no delay on the while true statement. CPU usage would be high!

- - - Updated - - -

Your offsets are wrong

- - - Updated - - -

m_dwEntityList = 0x04A4BA64
m_dwLocalPlayer = 0x00A30504
m_iCrosshairID = 0x0000AA48;
Quote Originally Posted by OhStarQ View Post
I haven't really looked for the issue but there is no delay here:

mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);

And there is also no delay on the while true statement. CPU usage would be high!

- - - Updated - - -

Your offsets are wrong

- - - Updated - - -

m_dwEntityList = 0x04A4BA64
m_dwLocalPlayer = 0x00A30504
m_iCrosshairID = 0x0000AA48;
Thanks for the fast answer but this didn't change anything The program still runs but it still doesn't shoot. I added:
Code:
const DWORD playerBase = 0x00A30504;
const DWORD entityBase = 0x04A4BA64;
const DWORD crosshairOffset = 0x0000AA48;
and

Code:
while (true)
		{
	DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
	int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
	int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset); 
	if (LocalTeam != EnemyTeam && EnemyHealth > 0)
	{
		
		mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
		Sleep(10);
		mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
		
	}
	Sleep(100);
		}
Quote Originally Posted by OhStarQ View Post
Your offsets are wrong

- - - Updated - - -

m_dwEntityList = 0x04A4BA64
m_dwLocalPlayer = 0x00A30504
m_iCrosshairID = 0x0000AA48;
The crosshair offset is 0xAA44.


@samlarenskoog

The problem is that you only read your CrossHairID once aswell as your LocalPlayer.

This should fix it:

Code:
int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");

	while (true)
	{
                DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);
		int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);
		int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
		DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
		int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
		int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
 
		if (LocalTeam != EnemyTeam && EnemyHealth > 0)
		{		
			mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
			Sleep( 5 );
			mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
		}
		Sleep( 1 );
	}	
}
Instead of using mouse_event to shoot, you can also just change the keyvalue for +attack to get rid of the Sleep statement between the mouse_event calls.

Offset: 0x2E8BA38;

Code:
int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");

	while (true)
	{
                DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);
		int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);
		int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
		DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
		int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
		int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
 
		if (LocalTeam != EnemyTeam && EnemyHealth > 0)	
			Mem.Write<int>(clientDll + 0x2E8BA38, 6);

		Sleep( 1 );
	}	
}
Quote Originally Posted by WasserEsser View Post
The crosshair offset is 0xAA44.


@samlarenskoog

The problem is that you only read your CrossHairID once aswell as your LocalPlayer.

This should fix it:

Code:
int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");

	while (true)
	{
                DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);
		int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);
		int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
		DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
		int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
		int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
 
		if (LocalTeam != EnemyTeam && EnemyHealth > 0)
		{		
			mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
			Sleep( 5 );
			mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
		}
		Sleep( 1 );
	}	
}
Instead of using mouse_event to shoot, you can also just change the keyvalue for +attack to get rid of the Sleep statement between the mouse_event calls.

Offset: 0x2E8BA38;

Code:
int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");

	while (true)
	{
                DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);
		int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);
		int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
		DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
		int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
		int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
 
		if (LocalTeam != EnemyTeam && EnemyHealth > 0)	
			Mem.Write<int>(clientDll + 0x2E8BA38, 6);

		Sleep( 1 );
	}	
}
Thank you for a well explained answer. I have tried your proposal and it worked, I have also tried to add a do, while statement for the triggerbot but it didnt seem to work. It just clicks away anywhere:
do {
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
Sleep(5);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
Sleep(1000);
} while (GetAsyncKeyState(VK_XBUTTON2));

I have also tried the Mem.Write function but I couldnt find it in the class. How do I add it in this cpp?
Quote Originally Posted by samlarenskoog View Post
Thank you for a well explained answer. I have tried your proposal and it worked, I have also tried to add a do, while statement for the triggerbot but it didnt seem to work. It just clicks away anywhere:
do {
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
Sleep(5);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
Sleep(1000);
} while (GetAsyncKeyState(VK_XBUTTON2));

I have also tried the Mem.Write function but I couldnt find it in the class. How do I add it in this cpp?
The do while loop is not necessary, you can use an if statement.

Code:
int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");

	while (true)
	{
		if ( GetAsyncKeyState(VK_XBUTTON2) & ( 1 << 15 ) )
		{
                	DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);
			int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);
			int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
			DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
			int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
			int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
 
			if (LocalTeam != EnemyTeam && EnemyHealth > 0)	
				Mem.Write<int>(clientDll + 0x2E8BA38, 6);
		}

		Sleep( 1 );
	}	
}
Quote Originally Posted by WasserEsser View Post
The do while loop is not necessary, you can use an if statement.

Code:
int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");

	while (true)
	{
		if ( GetAsyncKeyState(VK_XBUTTON2) & ( 1 << 15 ) )
		{
                	DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);
			int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);
			int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
			DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist)); 
			int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset); 
			int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
 
			if (LocalTeam != EnemyTeam && EnemyHealth > 0)	
				Mem.Write<int>(clientDll + 0x2E8BA38, 6);
		}

		Sleep( 1 );
	}	
}
If he is never checking if the entity is actually in the crosshair it would just shoot randomly?
Quote Originally Posted by OhStarQ View Post
If he is never checking if the entity is actually in the crosshair it would just shoot randomly?
He is getting the entity which is in his crosshair, he doesn't need to check whether its in there again.

He is also testing his health, which assures he doesn't get an invalid entity.
Quote Originally Posted by WasserEsser View Post
He is getting the entity which is in his crosshair, he doesn't need to check whether its in there again.

He is also testing his health, which assures he doesn't get an invalid entity.

I have tried to modify the code and add a function aswell. Now it doesnt work even though I ahve declared the function. Could you help me out?

Code:
#include <iostream>
#include <cstdio>

#include "ProcMem.h"
ProcMem Mem;

using namespace std;

const DWORD playerBase = 0x00A30504;
const DWORD entityBase = 0x04A4BA64;
const DWORD crosshairOffset = 0xAA44;
 
const DWORD teamOffset = 0xF0;
const DWORD healthOffset = 0xFC;
const DWORD EntLoopDist = 0x10;
void trig(DWORD clientDll);




int main()
{
	Mem.Process("csgo.exe");
	DWORD clientDll = Mem.Module("client.dll");
	while (true) {
	if (GetAsyncKeyState(VK_XBUTTON1)){
			void trig(DWORD clientDll);
		}
	}
}

void trig(DWORD clientDll)
{
	
		DWORD LocalPlayer = Mem.Read<DWORD>(clientDll + playerBase);
		int LocalTeam = Mem.Read<int>(LocalPlayer + teamOffset);
		int CrossHairID = Mem.Read<int>(LocalPlayer + crosshairOffset);
		DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist));
		int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset);
		int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);

		
			if (LocalTeam != EnemyTeam && EnemyHealth > 0)
			{

				mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
				Sleep(5);
				mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
				Sleep(10);

			}
			Sleep(1);
		
	
}
Code:
#include <iostream>
#include <cstdio>

#include "ProcMem.h"
ProcMem Mem;

using namespace std;

const DWORD m_dwLocalPlayer = 0x00A30504;
const DWORD m_dwEntityList = 0x04A4BA64;
const DWORD m_iCrosshairID = 0xAA44;

DWORD LocalPlayer;
DWORD Client;
DWORD Entity;

int crosshair;
int LocalTeam;
int EntityTeam;

void trig();

int main()
{
	Mem.Process("csgo.exe");
	Client = Mem.Module("client.dll");
	while (true) {
	    if (GetAsyncKeyState(VK_XBUTTON1) & 0x8000) void trig(DWORD clientDll);
            Sleep(1);
	}
}

void trig()
{	
    LocalPlayer = Mem.Read<DWORD>(Client+ m_dwLocalPlayer);
    LocalTeam = Mem.Read<int>(LocalPlayer + 0xF0);
    crosshair = Mem.Read<int>(LocalPlayer + m_iCrosshairID);
    Entity = Mem.Read<DWORD>(Client +m_dwEntityList + ((crosshair - 1) * 16));            
    EntityTeam = Mem.Read<int>(Entity + 0xF0);

    if (crosshair > 0 && crosshair < objects && EntityTeam != LocalTeam)
    {
        mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
	Sleep(5);
	mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
	Sleep(10);
    }			
}
Try this
Quote Originally Posted by OhStarQ View Post
Code:
#include <iostream>
#include <cstdio>

#include "ProcMem.h"
ProcMem Mem;

using namespace std;

const DWORD m_dwLocalPlayer = 0x00A30504;
const DWORD m_dwEntityList = 0x04A4BA64;
const DWORD m_iCrosshairID = 0xAA44;

DWORD LocalPlayer;
DWORD Client;
DWORD Entity;

int crosshair;
int LocalTeam;
int EntityTeam;

void trig();

int main()
{
	Mem.Process("csgo.exe");
	Client = Mem.Module("client.dll");
	while (true) {
	    if (GetAsyncKeyState(VK_XBUTTON1) & 0x8000) void trig(DWORD clientDll);
            Sleep(1);
	}
}

void trig()
{	
    LocalPlayer = Mem.Read<DWORD>(Client+ m_dwLocalPlayer);
    LocalTeam = Mem.Read<int>(LocalPlayer + 0xF0);
    crosshair = Mem.Read<int>(LocalPlayer + m_iCrosshairID);
    Entity = Mem.Read<DWORD>(Client +m_dwEntityList + ((crosshair - 1) * 16));            
    EntityTeam = Mem.Read<int>(Entity + 0xF0);

    if (crosshair > 0 && crosshair < objects && EntityTeam != LocalTeam)
    {
        mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
	Sleep(5);
	mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
	Sleep(10);
    }			
}
Try this
Do you mean:
if (crosshair > 0 && crosshair < Entity && EntityTeam != LocalTeam)

instead of

if (crosshair > 0 && crosshair < objects && EntityTeam != LocalTeam)


Still not working though
Quote Originally Posted by OhStarQ View Post
Code:
#include <iostream>
#include <cstdio>

#include "ProcMem.h"
ProcMem Mem;

using namespace std;

const DWORD m_dwLocalPlayer = 0x00A30504;
const DWORD m_dwEntityList = 0x04A4BA64;
const DWORD m_iCrosshairID = 0xAA44;

DWORD LocalPlayer;
DWORD Client;
DWORD Entity;

int crosshair;
int LocalTeam;
int EntityTeam;

void trig();

int main()
{
	Mem.Process("csgo.exe");
	Client = Mem.Module("client.dll");
	while (true) {
	    if (GetAsyncKeyState(VK_XBUTTON1) & 0x8000) void trig(DWORD clientDll);
            Sleep(1);
	}
}

void trig()
{	
    LocalPlayer = Mem.Read<DWORD>(Client+ m_dwLocalPlayer);
    LocalTeam = Mem.Read<int>(LocalPlayer + 0xF0);
    crosshair = Mem.Read<int>(LocalPlayer + m_iCrosshairID);
    Entity = Mem.Read<DWORD>(Client +m_dwEntityList + ((crosshair - 1) * 16));            
    EntityTeam = Mem.Read<int>(Entity + 0xF0);

    if (crosshair > 0 && crosshair < objects && EntityTeam != LocalTeam)
    {
        mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
	Sleep(5);
	mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
	Sleep(10);
    }			
}
Try this
I get an error on line 36 saying type name is not allowed????
Don't sleep for 100 milliseconds. Only 1 is needed.

if (LocalTeam != EnemyTeam && EnemyHealth > 0)
You don't need to check EnemyHealth, that might be the problem.


const DWORD EntLoopDist = 0x10;
DWORD EnemyInCH = Mem.Read<DWORD>(clientDll + entityBase + ((CrossHairID - 1) * EntLoopDist));

Just multiply by 16, not EntLoopDist


Your not checking if anything is in the crosshair. Use:
if (crosshair > 0 && crosshair < maxObjectAmount)

Get maxObjectAmount with:
Client + m_dwEntityList + 0x4
Quote Originally Posted by samlarenskoog View Post
Do you mean:
if (crosshair > 0 && crosshair < Entity && EntityTeam != LocalTeam)

instead of

if (crosshair > 0 && crosshair < objects && EntityTeam != LocalTeam)


Still not working though
No I meant what I said. No point checking if the crosshair is smaller than an address.
1 week has passed and no further replies have been made by the OP. Assuming solved.

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

Similar Threads

Tags for this Thread

None

Talk with us