Solved Glitchy ESP

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

PwndDepot

I has a status
Dank Tier VIP
Trump Tier Donator
Dank Tier Donator
Nov 5, 2014
239
7,748
19
For the most part this thing works pretty well. But there's definitely a few things wrong with it. I get some weird resizing issues with it, and i'll see random lines and boxes in my screen when there shouldn't be and some are pretty large. It's really weird and i'm not sure exactly what's wrong with it.

https://prntscr.com/em3pyi
https://prntscr.com/em3qbk
https://prntscr.com/em3qoy
https://prntscr.com/em3qwq

C++:
void ESP::Draw(LPDIRECT3DDEVICE9 pDevice)
{
	int width = 1280, height = 600; // yeah yeah ill change this later
	std::vector<PlayerEnt*> entityList;
	entityList.push_back(NULL);
	PlayerEnt* localPlayer = *(PlayerEnt**)dwLocalPlayer;
	int PlayerCount = *(int*)dwPlayerCount;
	// Loop through entity list

	for (int i = 1; i < (int)PlayerCount; i++)
	{
		entityList.push_back(((PlayerEnt*)*(DWORD*)(m_dwEntityList + (i * 0x10))));

		// Checks life state but idk if right values for css
		//if (!entityList[i] || entityList[i]->State != 0)
		//	continue;
		if (!entityList[i] == NULL)
		{
			vec3_t pos = entityList[i]->vPos;
			vec2 enemyScreenCoords = { 0 , 0 };
			float ViewMatrix[16];
			DWORD dwViewMatrixTemp = m_dwViewMatrix;
			for (int j = 0; j < 16; j++)
			{
				ViewMatrix[j] = *(float*)dwViewMatrixTemp;
				dwViewMatrixTemp += 4;
			}
			if (ESP::WorldToScreen(pos, enemyScreenCoords, ViewMatrix, width, height))
			{

				vec3_t entPos = entityList[i]->vPos;
				vec3_t playerPos = localPlayer->vPos;

				// Find Bone Coordinates
				DWORD dwEntity = *(DWORD*)((m_dwEntityList + (i * 0x10)));
				DWORD dwBoneMatrix = *(DWORD*)(dwEntity + cBoneMatrix);
				float enemyHeadX = *(float*)(dwBoneMatrix + 0x30 * 8 + 0x0C);
				float enemyHeadY = *(float*)(dwBoneMatrix + 0x30 * 8 + 0x1C);
				float enemyHeadZ = *(float*)(dwBoneMatrix + 0x30 * 8 + 0x2C);

				vec3_t enemyHeadPos = { enemyHeadX, enemyHeadY, enemyHeadZ };
				vec2 enemyHeadScreenCoords = { 0 , 0 };

				ESP::WorldToScreen(enemyHeadPos, enemyHeadScreenCoords, ViewMatrix, width, height);

				double distX = pow((enemyHeadScreenCoords.x - enemyScreenCoords.x), 2);
				double distY = pow((enemyHeadScreenCoords.y - enemyScreenCoords.y), 2);
				double height = sqrt(distX + distY) * 1.2;
				double width = height / 2;

				if (entityList[i]->m_iHealth > 0) // If not dead
				{
					if (entityList[i]->m_iTeamNum == localPlayer->m_iTeamNum)
						DrawBorderBox(enemyHeadScreenCoords.x - (width / 2), enemyHeadScreenCoords.y - (height / 8), width, height, 2, LAWNGREEN(255), pDevice);
					else
						DrawBorderBox(enemyHeadScreenCoords.x - (width / 2), enemyHeadScreenCoords.y - (height / 8), width, height, 2, PINK(255), pDevice);
				}
			}
		}
	}
}
I'm using HexMurder's method of scaling from here:
https://guidedhacking.com/showthread.php?7845-Best-way-to-scale-ESP
Any help would be much preciated, thxx :foreveralone:
 

HexMurder

Arcane Hacker
Dank Tier VIP
Dank Tier Donator
Jun 7, 2012
319
7,988
22
Those weird lines popping out of no where could be a box being drawn around your player. So to check that you could type "thirdperson" in console and see if that is in fact the case. If that IS the case, you could fix that issue by checking the distance of the players. i.e if(distance <150) don't draw. (something along those lines).

And yes, the other is a dormancy issue. This is a simple fix. The server will only update the enemy's information if it believes it to be necessary. So if they are at A site and you are at B, it will not send you updated information on them. So by the time you get to A the guy is actually in pit but his box is STILL at A site, even though he is not. So it fix this, they made it very very easy for us. Just check if Entity + 0xE9 is = 1 or 0. If it's 0, we have the information so you should draw the box. If it's 1 they are in fact "dormant", so we should not draw. This is how literally every esp in csgo works, and there is no work around. Hope this helped.


btw @ me next time bruh ;)
 
Last edited:

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,294
37,938
269
cant remember if checking if health was 0 was a good indicator. There's a bool/byte that just says whether the player is alive.

Also, you should add a dormancy check, that will be a big factor as well.

As for the algorithm, I've always been part of the school of thought that would prefer to try to find the model's bounds and use that for all drawing; should get you picture perfect boxes
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
Are those phantom lines from players that are very close to you? If so you can be gay and not draw targets less than a certain distance. Otherwise I think it's a dormant issue (look at me like I know cs:go trolololo)
 

PwndDepot

I has a status
Dank Tier VIP
Trump Tier Donator
Dank Tier Donator
Nov 5, 2014
239
7,748
19
So i've fixed most of the annoying glitches with a few checks. I added the dormant check and what not, thanks guiz

C++:
				float distX = pow((enemyHeadScreenCoords.x - enemyScreenCoords.x), 2);
				float distY = pow((enemyHeadScreenCoords.y - enemyScreenCoords.y), 2);
				float height = sqrt(distX + distY);
				float width = height / 2;

				if ((entityList[i]->m_iHealth > 0) && 
					!(entityList[i]->m_bDormant) && 
					!(width > enemyHeadScreenCoords.x - (width/2)))
				{
					if (entityList[i]->m_iTeamNum == localPlayer->m_iTeamNum)
						DrawBorderBox(enemyHeadScreenCoords.x - (width / 2), enemyHeadScreenCoords.y, width, height, 2, LAWNGREEN(255), pDevice);
					else
						DrawBorderBox(enemyHeadScreenCoords.x - (width / 2), enemyHeadScreenCoords.y, width, height, 2, PINK(255), pDevice);
				}
I tried to add a check to make it not draw if the width/height got too big. It works almost perfectly unless i look to the left of the entity
It does what I want it to to an extent. when I look up too much and it starts expanding, it will disappear if it gets too big. and same for moving my view to the left like so:
before: https://prntscr.com/emiyv6
after: https://prntscr.com/emiyyz
^ this is what I want to happen
but...
Looking the other way: https://prntscr.com/emiz4t
It doesn't disappear at all...
I am fucking shit with math and I don't know what I need to add to my check to fix this
 

HexMurder

Arcane Hacker
Dank Tier VIP
Dank Tier Donator
Jun 7, 2012
319
7,988
22
So i've fixed most of the annoying glitches with a few checks. I added the dormant check and what not, thanks guiz

C++:
				float distX = pow((enemyHeadScreenCoords.x - enemyScreenCoords.x), 2);
				float distY = pow((enemyHeadScreenCoords.y - enemyScreenCoords.y), 2);
				float height = sqrt(distX + distY);
				float width = height / 2;

				if ((entityList[i]->m_iHealth > 0) && 
					!(entityList[i]->m_bDormant) && 
					!(width > enemyHeadScreenCoords.x - (width/2)))
				{
					if (entityList[i]->m_iTeamNum == localPlayer->m_iTeamNum)
						DrawBorderBox(enemyHeadScreenCoords.x - (width / 2), enemyHeadScreenCoords.y, width, height, 2, LAWNGREEN(255), pDevice);
					else
						DrawBorderBox(enemyHeadScreenCoords.x - (width / 2), enemyHeadScreenCoords.y, width, height, 2, PINK(255), pDevice);
				}
I tried to add a check to make it not draw if the width/height got too big. It works almost perfectly unless i look to the left of the entity
It does what I want it to to an extent. when I look up too much and it starts expanding, it will disappear if it gets too big. and same for moving my view to the left like so:
before: https://prntscr.com/emiyv6
after: https://prntscr.com/emiyyz
^ this is what I want to happen
but...
Looking the other way: https://prntscr.com/emiz4t
It doesn't disappear at all...
I am fucking shit with math and I don't know what I need to add to my check to fix this
wait.. i'm a little confused. What exactly are you trying to achieve? i'l be happy to help if you can explain it a little better.
 

PwndDepot

I has a status
Dank Tier VIP
Trump Tier Donator
Dank Tier Donator
Nov 5, 2014
239
7,748
19
wait.. i'm a little confused. What exactly are you trying to achieve? i'l be happy to help if you can explain it a little better.
Sorry, it's a little hard to explain without seeing it. Basically the lines get waaayyy too big when im close to an enemy and look up or down. and they get all messed up when im close and look left or right. Are you on discord? I think I might go with mamda's idea, might make the boxes a little more accurate.
 

HexMurder

Arcane Hacker
Dank Tier VIP
Dank Tier Donator
Jun 7, 2012
319
7,988
22
Sorry, it's a little hard to explain without seeing it. Basically the lines get waaayyy too big when im close to an enemy and look up or down. and they get all messed up when im close and look left or right. Are you on discord? I think I might go with mamda's idea, might make the boxes a little more accurate.
I am on discord. pm me. You can find me in the GH discord.
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
PwndDepot it's always gonna look like that on the edges of the screen or when characters are very close using this basic ESP box scaling method. If you want it to be sexier you will have to calculate the left most, right most, top most and bottom most vertices of the character model and draw the box using those values, to do this you need to use the bones I think
 

HexMurder

Arcane Hacker
Dank Tier VIP
Dank Tier Donator
Jun 7, 2012
319
7,988
22
Rake;48343 said:
PwndDepot it's always gonna look like that on the edges of the screen or when characters are very close using this basic ESP box scaling method. If you want it to be sexier you will have to calculate the left most, right most, top most and bottom most vertices of the character model and draw the box using those values, to do this you need to use the bones I think
This is a rather annoying problem that i don't really have a great answer to either. I spent a little time on it just now to see if i could find a solution. I got it to work to an extent, but the method i used brings it's own array of problems afterwards. First of all, this is how it looks drawing a regular box when looking too closely to an enemy. (as we all know)
https://i.gyazo.com/5b2081eeba03542b97d66a47fe71a1b3.mp4

So after a little math i figured out a method which resulted in this:
https://gyazo.com/97382c156479d139d668fd00a66e11f1

Looks great right!? like holy shit i just fixed the problem.
But of course, ya boy HexMurder isn't that lucky. And this is what it looks like from above the enemy.


Needless to say, if i knew how to read the actual boundaries of the models this would be very easy. But unfortunately i don't. Perhaps someone would care to share? lol

The big difference between the classic method of drawing and this new method i am playing with is this:
The classic method is restricted to drawing right angles. Actual rectangles. When the player model is not in fact always going to sit in a pretty rectangle when they are very close to the screen. I switch between the classic and "newish" method here:
https://i.gyazo.com/1afe523a565130514d56ab41606d15cf.mp4


As you can see from this shitty photoshop: if we simply draw a vertical line from the foot, the head is well within the boundaries for players that are further away. But when the player models are very close to our screen you can see that is not that case. So using only 90 degree angles to draw boxes at a very close distance will lead to a very large box, or distortion. UNLESS you use a method which isn't restricted to 90 degree angles.
 
Last edited:
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.

Community Mods