HelpESP doesnt draw a Box

Posts 112 of 12 · Page 1 of 1
ESP doesnt draw a Box
Hey guys, i drawed a box when WorldToScreen() function... in the top left corner of cs go... At first i want to draw a box of all Player but it doesnt work, theres no box, only the top left one...

My Offsets are right btw

Code:
void ESP()
{

	DWORD dwClient = Mem.Module("client.dll");
	DWORD dwEngine = Mem.Module("engine.dll");
	ReadProcessMemory(pHandle, (LPVOID)(dwClient + ViewMatrix), &W2S_M.flMatrix, sizeof(WorldToScreenMatrix_t), NULL);

	GetWindowRect(FindWindow(NULL, "Counter-Strike: Global Offensive"), &m_Rect);

	DWORD pLocal = Mem.Read<DWORD>(dwClient + dw_PlayerBase);
	//int LocalTeam = Mem.Read<int>(pLocal + dw_teamOffset);
	
	DWORD LocalTeam = ReadProcessMemory(pHandle, (LPVOID)(dw_PlayerBase + 0xF0), &LocalTeam, sizeof(LocalTeam), NULL);

	int LocalHealth = Mem.Read<int>(pLocal + dw_healthOffset);

	float LocalPosition[3];
	LocalPosition[0] = Mem.Read<float>(pLocal + 0x134);
	LocalPosition[1] = Mem.Read<float>(pLocal + 0x138);
	LocalPosition[2] = Mem.Read<float>(pLocal + 0x13C);

	for (int i = 0; i < 32; i++)
	{
		uintptr_t pEnemy = Mem.Read<uintptr_t>(dwClient + dw_EntityBase + (i  * dw_EntityLoopDistance));

		int EnemyTeam = ReadProcessMemory(pHandle, (LPVOID)(dw_EntityBase + 0xF0), &EnemyTeam, sizeof(EnemyTeam), NULL);
		int EnemyHealth = Mem.Read<int>(pEnemy + dw_healthOffset);

		float HeadPos[3];
		float Position[3];
		Position[0] = Mem.Read<float>(pEnemy + 0x134);
		Position[1] = Mem.Read<float>(pEnemy + 0x138);
		Position[2] = Mem.Read<float>(pEnemy + 0x13C);

       uintptr_t BoneBase = Mem.Read<uintptr_t>(pEnemy + dw_BoneMatrix);

		GetBonePos(BoneBase, 6, HeadPos);

		float EnemyXYHeadPos[3];
		float EnemyXY[3];
		if (WorldToScreen(Position, EnemyXY) && WorldToScreen(HeadPos, EnemyXYHeadPos))
		{

			float Distance = Get3dDistance(LocalPosition, Position);
			float Height = abs(EnemyXY[1] - EnemyXYHeadPos[1]);
			float Width = Height / 2;

			DrawBox(10, 10, 20, 20, 1, 255, 0, 0, 255);

			DrawBox(EnemyXY[0] - (Width / 2), EnemyXY[1] - Height, Width, Height, 1, 255, 0, 0, 255);
    }
}
There could maybe be a syntax error cuz C&P

Thx in advance !
/Moved to the correct section.
What is your drawbox function?
The Draw Box func ist working cuz my little Box was drawed top left of cs go

void DrawBox(float x, float y, float width, float height, float px, int r, int g, int b, int a)
{
D3DXVECTOR2 points[5];
points[0] = D3DXVECTOR2(x, y);
points[1] = D3DXVECTOR2(x + width, y);
points[2] = D3DXVECTOR2(x + width, y + height);
points[3] = D3DXVECTOR2(x, y + height);
points[4] = D3DXVECTOR2(x, y);
DirectX.Line->SetWidth(1);
DirectX.Line->Draw(points, 5, D3DCOLOR_RGBA(r, g, b, a));
}
Please don't use d3d lines for drawing boxes, use vertecies.

How does your WorldToScreen function look like?
Quote Originally Posted by WasserEsser View Post
Please don't use d3d lines for drawing boxes, use vertecies.

How does your WorldToScreen function look like?
Ok i heared of vertecies i should look for it and my W2S :

Code:
typedef struct {
	float flMatrix[4][4];
}WorldToScreenMatrix_t;

WorldToScreenMatrix_t W2S_M;

RECT m_Rect; //WORLD TO SCREEN RECT

bool WorldToScreen(float * from, float * to)
{
	to[0] = W2S_M.flMatrix[0][0] * from[0] + W2S_M.flMatrix[0][1] * from[1] + W2S_M.flMatrix[0][2] * from[2] + W2S_M.flMatrix[0][3];
	to[1] = W2S_M.flMatrix[1][0] * from[0] + W2S_M.flMatrix[1][1] * from[1] + W2S_M.flMatrix[1][2] * from[2] + W2S_M.flMatrix[1][3];

	float w = W2S_M.flMatrix[3][0] * from[0] + W2S_M.flMatrix[3][1] * from[1] + W2S_M.flMatrix[3][2] * from[2] + W2S_M.flMatrix[3][3];

	if (w < 0.01f)
		return false;

	float invw = 1.0f / w;
	to[0] *= invw;
	to[1] *= invw;

	int width = (int)(m_Rect.right - m_Rect.left);
	int height = (int)(m_Rect.bottom - m_Rect.top);

	float x = width / 2;
	float y = height / 2;

	x += 0.5 * to[0] * width + 0.5;
	y -= 0.5 * to[1] * height + 0.5;

	to[0] = x + m_Rect.left;
	to[1] = y + m_Rect.top;

	return true;
} 

//and this in my ESP func:

GetWindowRect(FindWindow(NULL, "Counter-Strike: Global Offensive"), &m_Rect);

ReadProcessMemory(pHandle, (LPVOID)(dwClient + ViewMatrix), &W2S_M.flMatrix, sizeof(WorldToScreenMatrix_t), NULL);
Does nobody know a solution ? :/
Quote Originally Posted by xShouty View Post
Does nobody know a solution ? :/
So you're reading your local team from your playerBase? Don't understand how that works.
You need to read it from pLocal, ClientDLL->LocalPlayer->LocalTeam

Code:
DWORD pLocal = Mem.Read<DWORD>(dwClient + dw_PlayerBase);
DWORD LocalTeam = ReadProcessMemory(pHandle, (LPVOID)(dw_PlayerBase + 0xF0), &LocalTeam, sizeof(LocalTeam), NULL);
You're using two different methods to read memory. You should probably stick to one. (Your best bet is to stick to the 'Mem' class)

It's allowing you to make errors like the one below, where you don't actually understand where you're reading to.
dw_EntityBase is just an offset. (Offset is how far away from one thing is from a desired another).

For example, if I know X is ALWAYS 12 away from Y, then if you want to find the value of X, X is always located Y+12 units (in our case bytes), as long as the location of Y if known then all you have to do is add 12 to find the value of X. EZ

By RPM dw_EntityBase + healthOffset, you're giving an invalid value because it doesn't know where to start reading. You are only giving it links to how far away from 'CSGO' but not actually telling it where CSGO is. If you use pEnemy instead, it actually links to a player instead of just some random value.

pEnemy = ClientDLL->EntityPlayer
EnemyHealth = ClientDLL->EntityPlayer->EnemyHealth

So, with that said, EnemyHealth = pEnemy->EnemyHealth

Code:
uintptr_t pEnemy = Mem.Read<uintptr_t>(dwClient + dw_EntityBase + (i  * dw_EntityLoopDistance));
int EnemyTeam = ReadProcessMemory(pHandle, (LPVOID)(dw_EntityBase + 0xF0), &EnemyTeam, sizeof(EnemyTeam), NULL);
Try fixing these things first and then try to make an ESP.

If you need more help, I'm on discord, pm me and ill link you to it and I'll help you further.
Quote Originally Posted by Buttars0070 View Post
So you're reading your local team from your playerBase? Don't understand how that works.
You need to read it from pLocal, ClientDLL->LocalPlayer->LocalTeam

Code:
DWORD pLocal = Mem.Read<DWORD>(dwClient + dw_PlayerBase);
DWORD LocalTeam = ReadProcessMemory(pHandle, (LPVOID)(dw_PlayerBase + 0xF0), &LocalTeam, sizeof(LocalTeam), NULL);
You're using two different methods to read memory. You should probably stick to one. (Your best bet is to stick to the 'Mem' class)

It's allowing you to make errors like the one below, where you don't actually understand where you're reading to.
dw_EntityBase is just an offset. (Offset is how far away from one thing is from a desired another).

For example, if I know X is ALWAYS 12 away from Y, then if you want to find the value of X, X is always located Y+12 units (in our case bytes), as long as the location of Y if known then all you have to do is add 12 to find the value of X. EZ

By RPM dw_EntityBase + healthOffset, you're giving an invalid value because it doesn't know where to start reading. You are only giving it links to how far away from 'CSGO' but not actually telling it where CSGO is. If you use pEnemy instead, it actually links to a player instead of just some random value.

pEnemy = ClientDLL->EntityPlayer
EnemyHealth = ClientDLL->EntityPlayer->EnemyHealth

So, with that said, EnemyHealth = pEnemy->EnemyHealth

Code:
uintptr_t pEnemy = Mem.Read<uintptr_t>(dwClient + dw_EntityBase + (i  * dw_EntityLoopDistance));
int EnemyTeam = ReadProcessMemory(pHandle, (LPVOID)(dw_EntityBase + 0xF0), &EnemyTeam, sizeof(EnemyTeam), NULL);
Try fixing these things first and then try to make an ESP.

If you need more help, I'm on discord, pm me and ill link you to it and I'll help you further.
Ok, first i fixed these things a few days ago with the different PRM methodes, i know the working of cdll->enemy->health, but my code doesnt draw anything...
and i dont F*cking know why :/

Code:
void ESP()
{
	if (callonOnce == false)
	{
		dwClient = Mem.Module("client.dll");
		dwEngine = Mem.Module("engine.dll");
		callonOnce = true;
	}

	W2S_M = Mem.Read<WorldToScreenMatrix_t>(dwClient + ViewMatrix);

	DWORD pLocal = Mem.Read<DWORD>(dwClient + dw_PlayerBase);
	//int LocalTeam = Mem.Read<int>(pLocal + dw_teamOffset);
	
	DWORD LocalTeam = Mem.Read<DWORD>(pLocal + dw_teamOffset);

	DWORD LocalHealth = Mem.Read<DWORD>(pLocal + dw_healthOffset);

	float LocalPosition[3];

	LocalPosition[0] = Mem.Read<float>(pLocal + 0x134);
	LocalPosition[1] = Mem.Read<float>(pLocal + (0x134 + 0x4));
	LocalPosition[2] = Mem.Read<float>(pLocal + (0x134 + 0x8));

	for (int i = 0; i < 32; i++)
	{
		DWORD pEnemy = Mem.Read<DWORD>(dwClient + dw_EntityBase + (i * dw_EntityLoopDistance));

		DWORD EnemyTeam = Mem.Read<DWORD>(pEnemy + dw_teamOffset);
		DWORD EnemyHealth = Mem.Read<DWORD>(pEnemy + dw_healthOffset);

		float HeadPos[3];
		float Position[3];

		Position[0] = Mem.Read<float>(pEnemy + 0x134);
		Position[1] = Mem.Read<float>(pEnemy + (0x134 + 0x4));
		Position[2] = Mem.Read<float>(pEnemy + (0x134 + 0x8));

		DWORD BoneBase = Mem.Read<DWORD>(pEnemy + dw_BoneMatrix);

		GetBonePos(BoneBase, 6, HeadPos);

		float EnemyXYHeadPos[3];
		float EnemyXY[3];

		if (WorldToScreen(Position, EnemyXY))
		{

			float Distance = Get3dDistance(LocalPosition, Position);
			float Height = 20000 / Distance;
			float Width = 20000 / Distance;


			Drawing::Rect(10, 10, 20, 20, D3DCOLOR_ARGB(255, 0, 255, 0));
			Drawing::Rect(EnemyXY[0] - (Width / 2), EnemyXY[1] - Height, Width, Height, Color::White);
        }
    }
}
I dont know wheather the EnemyXZ var is right or not, my world to screen is still the same (top!) :/
Very nice, I'm very impressed on how much your style improved. Remember, consistency is key. I recommend reading and following this Google's C++ Style Guide

Most everything is right but the way you're trying to scale is 1. Over complicated 2.Broken

You're not finding the Height, Width, or enough W2S info (for my method). I know @ImWhacky used this method before I broke him of that
Here's what I have to make mine work. If you can't seem to figure it out, PM me and I'll add you on Discord or something and help ya out.

Code:
if (WorldToScreenM(EntityPlayer.Pos, W2SP) && WorldToScreenM(EntityPlayer.HeadPos, W2S_Head)) {
 int height = abs(W2SP[1] - W2S_Head[1]);
 int width = height / 2; //Or whatever you want.
 CornerBox(W2SP[0] - (width / 2), W2SP[1] - height, width, height, Color.Enemy.R, Color.Enemy.G, Color.Enemy.B, 255);
Try and figure that out and post back your draw functions.
Quote Originally Posted by Buttars0070 View Post
Try and figure that out and post back your draw functions.

This is my Draw fucntion:

Code:
void DrawBox(float x, float y, float width, float height, float px, int r, int g, int b, int a)
{
	D3DXVECTOR2 points[5];
	points[0] = D3DXVECTOR2(x, y);
	points[1] = D3DXVECTOR2(x + width, y);
	points[2] = D3DXVECTOR2(x + width, y + height);
	points[3] = D3DXVECTOR2(x, y + height);
	points[4] = D3DXVECTOR2(x, y);
	DirectX.Line->SetWidth(1);
	DirectX.Line->Draw(points, 5, D3DCOLOR_RGBA(r, g, b, a));
}
- - - Updated - - -

Quote Originally Posted by Buttars0070 View Post
Very nice, I'm very impressed on how much your style improved. Remember, consistency is key. I recommend reading and following this Google's C++ Style Guide

Most everything is right but the way you're trying to scale is 1. Over complicated 2.Broken

You're not finding the Height, Width, or enough W2S info (for my method). I know @ImWhacky used this method before I broke him of that

Here's what I have to make mine work. If you can't seem to figure it out, PM me and I'll add you on Discord or something and help ya out.

Code:
if (WorldToScreenM(EntityPlayer.Pos, W2SP) && WorldToScreenM(EntityPlayer.HeadPos, W2S_Head)) {
 int height = abs(W2SP[1] - W2S_Head[1]);
 int width = height / 2; //Or whatever you want.
 CornerBox(W2SP[0] - (width / 2), W2SP[1] - height, width, height, Color.Enemy.R, Color.Enemy.G, Color.Enemy.B, 255);
Try and figure that out and post back your draw functions.
Ok i figured out where the prob is, my world to screen is always returning true because i see did a green rectangle in the top left corner of cs go and this is always there if im in the menu of cs go or ingame in a round...

Code:
RECT W2S_Rect;

typedef struct {
	float flMatrix[4][4];
}WorldToScreenMatrix_t;

WorldToScreenMatrix_t W2S_M;

bool WorldToScreen(float * from, float * to)
{
	W2S_M = Mem.Read<WorldToScreenMatrix_t>(dwClient + ViewMatrix);

	to[0] = W2S_M.flMatrix[0][0] * from[0] + W2S_M.flMatrix[0][1] * from[1] + W2S_M.flMatrix[0][2] * from[2] + W2S_M.flMatrix[0][3];
	to[1] = W2S_M.flMatrix[1][0] * from[0] + W2S_M.flMatrix[1][1] * from[1] + W2S_M.flMatrix[1][2] * from[2] + W2S_M.flMatrix[1][3];

	float w = W2S_M.flMatrix[3][0] * from[0] + W2S_M.flMatrix[3][1] * from[1] + W2S_M.flMatrix[3][2] * from[2] + W2S_M.flMatrix[3][3];

	if (w < 0.01f)
		return false;

	float invw = 1.0f / w;
	to[0] *= invw;
	to[1] *= invw;

	int width = (int)(W2S_Rect.right - W2S_Rect.left);
	int height = (int)(W2S_Rect.bottom - W2S_Rect.top);

	float x = width / 2;
	float y = height / 2;

	x += 0.5 * to[0] * width + 0.5;
	y -= 0.5 * to[1] * height + 0.5;

	to[0] = x + W2S_Rect.left;
	to[1] = y + W2S_Rect.top;

	return true;
}

GetWindowRect(FindWindow(NULL, "Counter-Strike: Global Offensive"), &W2S_Rect);
and Offsets and Funcs:

Code:
DWORD ViewMatrix = 0x4A3E664; //VIEWMATRIX
DWORD dw_PlayerBase = 0x00A31504;
DWORD dw_teamOffset = 0xFC;
DWORD dw_healthOffset = 0xF0;
DWORD dw_EntityBase = 0x04A4CAC4;
DWORD dw_EntityLoopDistance = 0x10;
DWORD dw_BoneMatrix = 0x2698;

//Position Enemy:
		float Position[3];

		Position[0] = Mem.Read<float>(pEnemy + 0x134);
		Position[1] = Mem.Read<float>(pEnemy + 0x138);
		Position[2] = Mem.Read<float>(pEnemy + 0x13C);
EDIT: If im using the Mem Functions for reading the viewmatrix, mw W2S ist always returning true, and if im using the RPM Method then it only return true if i looking in a const direction like north ... yk
Believe this has been solved.

/Closed.
Posts 112 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?