Solved CSS Triggerbot Error

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
Hey guys, I was following fleeps video on css memory triggerbot. I'm trying to get into gamehacking for myself.

C++:
#include <Windows.h>
#include <iostream>
#include "HackProcess.h"

CHackProcess fProcess;

const DWORD Player_Base = 0x4C6708;

#define F6_KEY 0x75
bool b_ShotNow = false;
const DWORD dw_attack = 0x4F3B48;
const DWORD dw_teamOffset = 0x98;

int i_shoot = 5;
int i_dontShoot = 4;

int numOfPlayers = 32;
const DWORD dw_playerCountOffset = 0x5D29BC;
const DWORD dw_crosshairOffset = 0x145C;

const DWORD dw_entityBase = 0x4D3904;
const DWORD dw_entityLoopDist = 0x10;

struct MyPlayer {
	DWORD CLocalPlayer;
	int Team;
	int CrosshairEntityID;

	void ReadInformation() {
		//base into clocal
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + Player_Base), &CLocalPlayer, sizeof(DWORD), 0);
		//clocal + teamoffset = get team off
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_teamOffset), &Team, sizeof(int), 0);
		//clocal + crosshair offset = crosshair address
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_crosshairOffset), &CrosshairEntityID, sizeof(int), 0);
		//num of players
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_playerCountOffset), &numOfPlayers, sizeof(int), 0);
	}
}MyPlayer;

struct PlayerList {
	DWORD CBaseEnt;
	int Team;

	void ReadInformation(int Player) {
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_entityBase + (Player* dw_entityLoopDist)), &CBaseEnt, sizeof(DWORD), 0);

		//team
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEnt + dw_teamOffset), &Team, sizeof(int), 0);
	}
}PlayerList[32];

void TriggerBot() {
	if (!b_ShotNow) {
		WriteProcessMemory(fProcess.__HandleProcess, (int*)(fProcess.__dwordClient + dw_attack), &i_dontShoot, sizeof(int), NULL);
		b_ShotNow = !b_ShotNow;
	}

	if (MyPlayer.CrosshairEntityID == 0)
		return;

	if (PlayerList[MyPlayer.CrosshairEntityID-1].Team == MyPlayer.Team)
		return;

	if (MyPlayer.CrosshairEntityID > numOfPlayers)
		return;

	if (b_ShotNow) {
		WriteProcessMemory(fProcess.__HandleProcess, (int*)(fProcess.__dwordClient + dw_attack), &i_shoot, sizeof(int), NULL);
		b_ShotNow = !b_ShotNow;
	}
}

int main() {
	fProcess.RunProcess();
	std::cout << "Game Found! Running hack.." << std::endl;

	while (!GetAsyncKeyState(F6_KEY)) {
		MyPlayer.ReadInformation();

		for (int i = 0; i < numOfPlayers; i++) {
			PlayerList[i].ReadInformation(i);
		}
		TriggerBot();
	}
}
The program breaks right here
C++:
if (PlayerList[MyPlayer.CrosshairEntityID-1].Team == MyPlayer.Team)
		return;
Idk if I messed up the code in the PlayerList structure, but the error I'm getting is:
Exception thrown at 0x002D2B63 in csshk.exe: 0xC0000005: Access violation reading location 0x1F2DC2A4.
Unhandled exception at 0x002D2B63 in csshk.exe: 0xC0000005: Access violation reading location 0x1F2DC2A4.


I got the address and offsets myself and I'm still very new, so maybe I got the wrong address and offsets. The only other hack I made was an internal assault cube hack so I lack experience.


The hack finds the game. If i comment out that section, my gun just non-stop shoots, no matter what entity it's looking at.
.


I suspect is has something to do with:

const DWORD dw_teamOffset = 0x98;
 
Last edited:

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
Rake I just wanted to say you're awesome for all the help you give to everyone. Lol.
You're welcome, just don't disappear like everyone else :) We need good people who are committed to game hacking

I just found what you meant with the playerlist array

Everything equals 0.
That's not good, use cheat engine side by side with the visual studio debugger and compare the addresses you see in VS to what you see in CE


Crosshair offset is something weird also,
Yup crosshairID is wrong. Don't give up, just get 1 piece of code to work at a time, then go to the next part and fix that until it's done. If you're still having trouble, ditch the aimbot and make a trainer instead and practice the basics
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
You have the wrong addresses.
Look at the playerList in cheat engine's struct dissector and at the same time, Run the hack in the Visual Studio Debugger and set a breakpoint on:

C++:
PlayerList[i].ReadInformation(i);
Step into each line of code make sure that the PlayerList is being populated with the correct information for each and every player.
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
Damn, I'm not sure if I know what most of that means related to cheat engine. I'm gonna come back to this project later tonight. I'm gonna watch a couple hours of CE tutorials and try to figure that out. Some reason my CE tables got corrupted so I gotta start over :(
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
I think all my address are correct..

with the excection of
C++:
const DWORD dw_teamOffset = 0x98;
being 9C


Still dont work though
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
You're accessing the element of the player array with [cross hair ID -1] make sure cross hair is the correct thing. If crosshair ID is zero or a big number you will get an access violation when trying to read team. Team itself can't be the problem, that wouldn't throw an access violation and niether would the compare. When you debug your program yoi have to verify that every variable is correct, you do this by checking the local watch window and adding variables to the watch windows
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
Rake;41162 said:
You're accessing the element of the player array with [cross hair ID -1] make sure cross hair is the correct thing. If crosshair ID is zero or a big number you will get an access violation when trying to read team. Team itself can't be the problem, that wouldn't throw an access violation and niether would the compare. When you debug your program yoi have to verify that every variable is correct, you do this by checking the local watch window and adding variables to the watch windows
Rake I just wanted to say you're awesome for all the help you give to everyone. Lol.

Anyway,

I just found what you meant with the playerlist array




That means I fucked up right?

MyPlayer is correct though.



Everything equals 0.



Crosshair offset is something weird also,
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
I'm about to give up. I think I fixed it because I changed the crosshair id offset and I dont have an error, but the cheat doesn't work. Maybe I got the entity list address wrong..
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
I'm gonna try to stick around. I've always been interested in gamehacking, this is just my first time diving into it, I just wish I can contribute to it more.

I'm not completely sure how to cross check the variables on CE and visual studio? And I think I got the right offset, but now nothing happens so I really can't tell. I think my base entity is off, but I had trouble finding it so idk If i can correct it or not.

What would you recommend I try to do before continuing this project? This might be a little to hard for skill level.
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
Make a trainer that that gives you unlimited health and ammo, something easy like that.

Here is a step by step guide,do not proceed until you 100% understand each step.

1)Start by finding addreses that are writable by cheat engine
2)If they are dynamic find good pointers to them
https://guidedhacking.com/showthread.php?7194-C-Hacking-Any-Game-1-10-Difficulty-Part-1-2

3)Learn basic C++ practicing with console applications
https://www.learncpp.com/

Step 3-4 are necessary because you need a handle to the process to use ReadProcessMemory and WriteProcessMemory

3) Use FindWindow() to get the window handle
4) Pass the window handle to GetWindowThreadProcessID
5) Pass the ProcessID to OpenProcess to get a handle to the process

6)Calculate dynamic base addresses using this functionality:
https://guidedhacking.com/showthread.php?6292-Calculating-MultiLevel-Pointers

If pointer base addresses are "server.dll + 945740" or whatever use this function to find dynamic runtime address of the module using this:
https://guidedhacking.com/showthread.php?5781-SpoonFed-Get-Module-Base-Address

7)Use ReadProcessMemory to read the health and ammo into local variables and then print them to console. Try printing the dynamic runtime address of the variables to console.
https://msdn.microsoft.com/en-ca/library/windows/desktop/ms680553(v=vs.85).aspx

8) Now that you're a pro, use WriteProcessMemory to change the values.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681674(v=vs.85).aspx
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
Awesome. You're a great help dude. You don't get enough credit for the help you give new members.

I was able to make a hack for assaultcube with hp, recoil, rapid fire, and armor, so I kind of get most of that stuff. I am also taking a class in college for basic C++. I'm probably not even close to being 100% for that. I just don't really know how to practice, because THIS is a little to hard and assaultcube is a little to easy haha. I'm gonna keep working on i t
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
Idk If I should make a new topic for this or not. I'm trying to figure out aimbot from fleep's video.

I get an error here:
C++:
TargetList[targetLoop] = Target_List(PlayerList[i].AimbotAngle, MyPlayer.Position, PlayerList[i].pos);
Error: no suitable contructor exists to convert from float [3] to "Target_List"


Aimbot function:
C++:
void Aimbot() {
	Target_List * TargetList = new Target_List[numOfPlayers];

	int targetLoop = 0;
	for (int i = 0; i < numOfPlayers; i++) {
		if (PlayerList[i].Team == MyPlayer.Team)
			continue;

		if (PlayerList[i].Health < 2)
			continue;

		CalcAngle(MyPlayer.Position, PlayerList[i].Position, PlayerList[i].AimbotAngle);
		TargetList[targetLoop] = Target_List(PlayerList[i].AimbotAngle, MyPlayer.Position, PlayerList[i].pos);

		targetLoop++;
	}

	if (targetLoop > 0) {
		std::sort(TargetList, TargetList + targetLoop, CompareTargetEnArray());

		if (!GetAsyncKeyState(0x1)) {
			WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_angRotation), TargetList[0].AimbotAngle, 12, 0);
		}
	}

	delete [] TargetList;
}

Player list struct:
C++:
struct PlayerList {
	DWORD CBaseEnt;
	int Team;
	int Health;
	float Position[3];
	float AimbotAngle[3];

	void ReadInformation(int Player) {
		//entity base of each player
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_entityBase + (Player* dw_entityLoopDist)), &CBaseEnt, sizeof(DWORD), 0);
		//hp
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_ihp), &Health, sizeof(int), NULL);
		//position
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_pos), &Position, sizeof(float[3]), NULL);
		//team
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEnt + dw_teamOffset), &Team, sizeof(int), 0);
	}
}PlayerList[32];
 

psychothug

Newbie
Full Member
Mar 17, 2016
18
72
0
I fixed the error I had. But sadly the hack is not working :(

heres my code:
C++:
#include <Windows.h>
#include <iostream>
#include "HackProcess.h"
#include <math.h>
#include <vector>
#include <algorithm>

CHackProcess fProcess;

const DWORD Player_Base = 0x4C6708; //client

#define F6_KEY 0x75
#define FL_ONGROUND 257
#define SPACE_BAR 0x20

bool b_ShotNow = false;
const DWORD dw_attack = 0x4F3B48;
const DWORD dw_teamOffset = 0x9C;
const DWORD dw_ihp = 0x94;
const DWORD dw_jump = 0x4F3B3C;
const DWORD dw_jumpOf = 0x350;

int i_shoot = 5;
int i_dontShoot = 4;

int numOfPlayers = 32;
const DWORD dw_playerCountOffset = 0x5D29BC; //engine
const DWORD dw_crosshairOffset = 0x14F0;

const DWORD dw_entityBase = 0x4D3904;
const DWORD dw_entityLoopDist = 0x10;

const DWORD dw_angRotation = 0x4622CC;//engine
const DWORD dw_pos = 0x02A4;

struct MyPlayer {
	DWORD CLocalPlayer;
	int Team;
	int CrosshairEntityID;
	int m_fFlags;
	float Position[3];
	int Health;

	void ReadInformation() {
		//base into clocal
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + Player_Base), &CLocalPlayer, sizeof(DWORD), 0);
		//jump add
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_jumpOf), &m_fFlags, sizeof(int), NULL);
		//clocal + teamoffset = get team off
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_teamOffset), &Team, sizeof(int), 0);
		//gethp
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_ihp), &Health, sizeof(int), NULL);
		//get position
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_pos), &Position, sizeof(float[3]), 0);
		//clocal + crosshair offset = crosshair address
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_crosshairOffset), &CrosshairEntityID, sizeof(int), 0);
		//num of players
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_playerCountOffset), &numOfPlayers, sizeof(int), 0);
	}
}MyPlayer;

struct TargetList_t {
	float Distance;
	float AimbotAngle[3];

	TargetList_t() {

	}

	TargetList_t(float aimbotAngle[], float myCoords[], float enemyCoords[]) {
		Distance = Get3dDistance(myCoords[0], myCoords[1], myCoords[2],
					enemyCoords[0], enemyCoords[1], enemyCoords[2]);

		AimbotAngle[0] = aimbotAngle[0];
		AimbotAngle[1] = aimbotAngle[1];
		AimbotAngle[2] = aimbotAngle[2];
	}

	float Get3dDistance(float myCoordsX, float myCoordsZ, float myCoordsY,
		float enX, float enZ, float enY) {
		return sqrt(pow(double(enX - myCoordsX), 2.0) +
					pow(double(enY - myCoordsY), 2.0) +
					pow(double(enZ - myCoordsZ), 2.0));
	}
};

struct PlayerList_t {
	DWORD CBaseEnt;
	int Team;
	int Health;
	float Position[3];
	float AimbotAngle[3];

	void ReadInformation(int Player) {
		//entity base of each player
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_entityBase + (Player* dw_entityLoopDist)), &CBaseEnt, sizeof(DWORD), 0);
		//hp
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_ihp), &Health, sizeof(int), NULL);
		//position
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_pos), &Position, sizeof(float[3]), NULL);
		//team
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEnt + dw_teamOffset), &Team, sizeof(int), 0);
	}
}PlayerList[32];

void TriggerBot() {
	if (!b_ShotNow) {
		WriteProcessMemory(fProcess.__HandleProcess, (int*)(fProcess.__dwordClient + dw_attack), &i_dontShoot, sizeof(int), NULL);
		b_ShotNow = !b_ShotNow;
	}

	if (MyPlayer.CrosshairEntityID == 0)
		return;

	if (PlayerList[MyPlayer.CrosshairEntityID-1].Team == MyPlayer.Team)
		return;

	if (MyPlayer.CrosshairEntityID > numOfPlayers)
		return;

	if (b_ShotNow) {
		WriteProcessMemory(fProcess.__HandleProcess, (int*)(fProcess.__dwordClient + dw_attack), &i_shoot, sizeof(int), NULL);
		b_ShotNow = !b_ShotNow;
	}
}

void BunnyHop() {
	bool b_true = true;
	bool b_false = false;

	//if (GetAsyncKeyState(SPACE_BAR)) {
	//	bHopStatus = !bHopStatus;
	//	Sleep(250);
	//}

	if (MyPlayer.m_fFlags == FL_ONGROUND && GetAsyncKeyState(SPACE_BAR)) {
		WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_true, sizeof(bool), NULL);
	}
	else if (MyPlayer.m_fFlags != FL_ONGROUND) {
		WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_false, sizeof(bool), NULL);
	}
	
}

struct CompareTargetEnArray {
	bool operator()(TargetList_t & lhs, TargetList_t & rhs) {
		return lhs.Distance < rhs.Distance;
	}
};

void CalcAngle(float *src, float *dst, float *angles) {
	double delta[3] = { (src[0] - dst[0]), (src[1] - dst[1]), src[2] - dst[2] };
	double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
	angles[0] = (float)(asinf(delta[2] / hyp) * 57.295779513082f);
	angles[1] = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f);
	angles[2] = 0;

	if (delta[0] >= 0.0) {
		angles[1] += 180.0f;
	}
}

void Aimbot() {
	TargetList_t* TargetList = new TargetList_t[numOfPlayers];

	int targetLoop = 0;
	for (int i = 0; i < numOfPlayers; i++) {
		PlayerList[i].ReadInformation(i);
		if (PlayerList[i].Team == MyPlayer.Team)
			continue;

		if (PlayerList[i].Health < 2)
			continue;

		CalcAngle(MyPlayer.Position, PlayerList[i].Position, PlayerList[i].AimbotAngle);
		TargetList[targetLoop] = TargetList_t(PlayerList[i].AimbotAngle, MyPlayer.Position, PlayerList[i].Position);

		targetLoop++;
	}

	if (targetLoop > 0) {
		std::sort(TargetList, TargetList + targetLoop, CompareTargetEnArray());

		if (!GetAsyncKeyState(0x1)) {
			WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_angRotation), TargetList[0].AimbotAngle, 12, 0);
		}
	}

	delete [] TargetList;
}

int main() {
	fProcess.RunProcess();
	std::cout << "Game Found! Running hack.." << std::endl;

	while (!GetAsyncKeyState(F6_KEY)) {
		MyPlayer.ReadInformation();

		for (int i = 0; i < numOfPlayers; i++) {
			PlayerList[i].ReadInformation(i);

			
		}
		TriggerBot();
		BunnyHop();
		Aimbot();
	}
}
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
I fixed the error I had. But sadly the hack is not working :(
You're gonna have to debug & step through every single line of code and find your error, it sucks but it must be done, I do it all day long cuz my code sucks :retard:
 

zars

Newbie
Full Member
Jan 16, 2015
9
82
0
I think I have the same exact problem as you do. Googling is what lead me to here. I only wish I searched before posting.
 
Status
Not open for further replies.
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Similar threads

Community Mods