Aimbot locking on ground

Posts 1–15 of 23 · Page 1 of 2
Aimbot locking on ground
Hi,

I'm having a issue that my aimbot is locking itself on the ground when I hold the key for it.
Now, the weird thing is is that this exact aimbot works perfectly fine in my other project, the only difference is is that in this project I am not using /CLR. Before, I had the issue that when I started the aimbot it said 'Run-Time Check Failure #3 - The variable 'index' is being used without being initialized.' but I've moved the variable index to above the closestenemytocrosshair code and that seems to be solved now.

Code:
void CalcAngle(Vec3 src, Vec3 dst, Vec3 &angles)
{
	Vec3 delta;
	delta.x = src.x - dst.x;
	delta.y = src.y - dst.y;
	delta.z = src.z - dst.z;
	double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);

	angles.x = (float)(atan(delta.z / hyp) * 57.295779513082f);
	angles.y = (float)(atan(delta.y / delta.x) * 57.295779513082f);
	angles.z = 0.0f;

	if (delta.x >= 0.0)
		angles.y += 180.0f;
}
int index;
int ClosestEnemyToCrosshair(float maxfov)
{
	DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
	int LocalTeam = Mem.Read<int>(LocalPlayer + m_iTeamNum);
	for (int i = 0; i < 64; i++)
	{
		DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (i * 0x10));
		if (entitybase == LocalPlayer)
			continue;
		bool entitydormant = Mem.Read<bool>(entitybase + isDormant);
		if (entitydormant)
			continue;
		int entityteam = Mem.Read<int>(entitybase + m_iTeamNum);

		if (entityteam == LocalTeam)
			continue;


		int entitylifestate = Mem.Read<byte>(entitybase + 0x25B); //is lifestate
		if (entitylifestate != 0)
			continue;

		DWORD Engine = Mem.Module("engine.dll");
		DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
		Vec3 currentangles = Mem.Read<Vec3>(clientstate + viewAngle);
		Vec3 pos = BonePos(entitybase, 0x2698, aimbone); //bonematrix
		float entitydistance = GetFOV(currentangles, position, pos);
		if (entitydistance < maxfov)
		{
			maxfov = entitydistance;
			index = i;
		}
	}
	return index;
}
Your angles are being set to map origin, check for null pointers correctly.
Quote Originally Posted by nexcat View Post
Your angles are being set to map origin, check for null pointers correctly.
No had that problem before but fixed it, I already check for a null pointers in my Aimbot code.
Quote Originally Posted by F4DE View Post
No had that problem before but fixed it, I already check for a null pointers in my Aimbot code.
You aren't checking for nullptr's in your ClosestEnemyToCrosshair function.
Quote Originally Posted by WasserEsser View Post
You aren't checking for nullptr's in your ClosestEnemyToCrosshair function.
What / how / where should I check for null pointers?

//EDIT: The closest enemy to crosshair code does seem to work, it only locks to the ground when the enemy is in sight

//EDIT EDIT: Maybe it is a problem with procmem? I tried to add noflash as a feature, but that doesn't seem to be doing ANYTHING but the code can't really not work..
Code:
void NoFlash()
{
	if (visual_visibleonly && 0x0000A2F4 > 0.f)
		/* Remove Flash by setting the value back to 0.f */
		Mem.Write<float>(0x00A31504 + 0, 0.f);

	/* Sleep to reduce CPU usage */
	Sleep(1);
}
Used the offsets instead of using my premade offset list to make sure those are working, tried debugging the code and that actually worked too, it just doesn't understand / seem to trigger itself with the 0x0000A2F4 > 0.f
Quote Originally Posted by F4DE View Post
Code:
void NoFlash()
{
	if (visual_visibleonly && 0x0000A2F4 > 0.f)
		/* Remove Flash by setting the value back to 0.f */
		Mem.Write<float>(0x00A31504 + 0, 0.f);

	/* Sleep to reduce CPU usage */
	Sleep(1);
}
Code:
0x0000A2F4 > 0.f
0xA2F4 is -0.000000, of course your check won't succeed. You want to check if the value of m_flFlashMaxAlpha is bigger than 0.f, it obviously won't work if you aren't even reading anything. You're also writing to a completely wrong memory address.

What / how / where should I check for null pointers?
By adding a check if it's valid into your ClosestEnemyToCrosshair function right after you get the entitybase.

Code:
if ( !entitybase ) continue;
Quote Originally Posted by WasserEsser View Post
Code:
0x0000A2F4 > 0.f
0xA2F4 is -0.000000, of course your check won't succeed. You want to check if the value of m_flFlashMaxAlpha is bigger than 0.f, it obviously won't work if you aren't even reading anything. You're also writing to a completely wrong memory address.



By adding a check if it's valid into your ClosestEnemyToCrosshair function right after you get the entitybase.

Code:
if ( !entitybase ) continue;
Hmm, doesn't seem to fix the problem ;l
Gif of what is happening;


The noflash part was pritty dumb though I have this right now, but it seems to still not be doing anything and I'm out of ideas
Code:
void NoFlash()
{
	LocalBase = Mem.Read<DWORD>(Client + 0x00A31504);
	FlashMaxAlpha = Mem.Read<float>(LocalBase + 0x0000A2F4);
	while (true)
	{
		if (visual_visibleonly && FlashMaxAlpha > 0.f)
			/* Remove Flash by setting the value back to 0.f */
			Mem.Write<float>(LocalBase + 0x0000A2F4, 0.f);

		/* Sleep to reduce CPU usage */
		Sleep(1);
	}
}
//EDIT: Think I know what is going on with the noflash, I think I should actually set LocalBase and FlashMaxAlpha in the loop to let it update
Quote Originally Posted by F4DE View Post
Hmm, doesn't seem to fix the problem ;l
Gif of what is happening;


The noflash part was pritty dumb though I have this right now, but it seems to still not be doing anything and I'm out of ideas
Code:
void NoFlash()
{
	LocalBase = Mem.Read<DWORD>(Client + 0x00A31504);
	FlashMaxAlpha = Mem.Read<float>(LocalBase + 0x0000A2F4);
	while (true)
	{
		if (visual_visibleonly && FlashMaxAlpha > 0.f)
			/* Remove Flash by setting the value back to 0.f */
			Mem.Write<float>(LocalBase + 0x0000A2F4, 0.f);

		/* Sleep to reduce CPU usage */
		Sleep(1);
	}
}
Why is

Code:
LocalBase = Mem.Read<DWORD>(Client + 0x00A31504);
FlashMaxAlpha = Mem.Read<float>(LocalBase + 0x0000A2F4);
outside of the loop?

You didn't show how you calculate your angle.
Quote Originally Posted by WasserEsser View Post
Why is

Code:
LocalBase = Mem.Read<DWORD>(Client + 0x00A31504);
FlashMaxAlpha = Mem.Read<float>(LocalBase + 0x0000A2F4);
outside of the loop?

You didn't show how you calculate your angle.
Code:
void CalcAngle(Vec3 src, Vec3 dst, Vec3 &angles)
{
	Vec3 delta;
	delta.x = src.x - dst.x;
	delta.y = src.y - dst.y;
	delta.z = src.z - dst.z;
	double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);

	angles.x = (float)(atan(delta.z / hyp) * 57.295779513082f);
	angles.y = (float)(atan(delta.y / delta.x) * 57.295779513082f);
	angles.z = 0.0f;

	if (delta.x >= 0.0)
		angles.y += 180.0f;
}
Code:
void CalcAngle(Vec3 src, Vec3 dst, Vec3 &angles)
{
	Vec3 delta;
	delta.x = src.x - dst.x;
	delta.y = src.y - dst.y;
	delta.z = src.z - dst.z;
	double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);

	angles.x = (float)(atan(delta.z / hyp) * 57.295779513082f);
	angles.y = (float)(atan(delta.y / delta.x) * 57.295779513082f);
	angles.z = 0.0f;

	if (delta.x >= 0.0)
		angles.y += 180.0f;
}
Yeah, having this right now but it still doesn't do anything
Code:
void ReadData()
{
	while (true)
	{
		LocalBase = Mem.Read<DWORD>(Client + 0x00A31504);
		FlashMaxAlpha = Mem.Read<float>(LocalBase + 0x0000A2F4);
		Sleep(1);
	}
}

void NoFlash()
{
	while (true)
	{
		if (visual_visibleonly && FlashMaxAlpha > 0.f)
			/* Remove Flash by setting the value back to 0.f */
			Mem.Write<float>(LocalBase + 0x0000A2F4, 0.f);

		/* Sleep to reduce CPU usage */
		Sleep(1);
	}
}
Quote Originally Posted by F4DE View Post
Code:
void CalcAngle(Vec3 src, Vec3 dst, Vec3 &angles)
{
	Vec3 delta;
	delta.x = src.x - dst.x;
	delta.y = src.y - dst.y;
	delta.z = src.z - dst.z;
	double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);

	angles.x = (float)(atan(delta.z / hyp) * 57.295779513082f);
	angles.y = (float)(atan(delta.y / delta.x) * 57.295779513082f);
	angles.z = 0.0f;

	if (delta.x >= 0.0)
		angles.y += 180.0f;
}
Code:
void CalcAngle(Vec3 src, Vec3 dst, Vec3 &angles)
{
	Vec3 delta;
	delta.x = src.x - dst.x;
	delta.y = src.y - dst.y;
	delta.z = src.z - dst.z;
	double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);

	angles.x = (float)(atan(delta.z / hyp) * 57.295779513082f);
	angles.y = (float)(atan(delta.y / delta.x) * 57.295779513082f);
	angles.z = 0.0f;

	if (delta.x >= 0.0)
		angles.y += 180.0f;
}
Yeah, having this right now but it still doesn't do anything
Code:
void ReadData()
{
	while (true)
	{
		LocalBase = Mem.Read<DWORD>(Client + 0x00A31504);
		FlashMaxAlpha = Mem.Read<float>(LocalBase + 0x0000A2F4);
		Sleep(1);
	}
}

void NoFlash()
{
	while (true)
	{
		if (visual_visibleonly && FlashMaxAlpha > 0.f)
			/* Remove Flash by setting the value back to 0.f */
			Mem.Write<float>(LocalBase + 0x0000A2F4, 0.f);

		/* Sleep to reduce CPU usage */
		Sleep(1);
	}
}
You still don't show how you calculate your angle.

Also where are you calling ReadData?
Ah I'm sorry, thought you meant the other thing.
Code:
			int entindex = ClosestEnemyToCrosshair(90.f);

			if (entindex == 0)
				continue;
			DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
			Vec3 origin = Mem.Read<Vec3>(LocalPlayer + 0x134);
			Vec3 vecview = Mem.Read<Vec3>(LocalPlayer + 0x104);
			position.x = origin.x + vecview.x;
			position.y = origin.y + vecview.y;
			position.z = origin.z + vecview.z;

			Vec3 punch = Mem.Read<Vec3>(LocalPlayer + 0x3018);
			Vec3 angles;

			DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (entindex * 0x10));
			Vec3 pos = BonePos(entitybase, 0x2698, bonePosition);

			CalcAngle(position, pos, angles);
			angles.x = angles.x - punch.x * 2.f;
			angles.y = angles.y - punch.y * 2.f;
			ClampAngles(angles);
			if (angles.x == 0 && angles.y == 0)
				continue;
			DWORD Engine = Mem.Module("engine.dll");
			DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
			Mem.Write<Vec3>(clientstate + 0x4D0C, angles);
I'm calling ReadData in the Main part, also calling it before the noflash thread.

Code:
		std::thread t3(ReadData);
		std::thread t1(Aimbot);
		std::thread t2(NoFlash);
Quote Originally Posted by F4DE View Post
Ah I'm sorry, thought you meant the other thing.
Code:
			int entindex = ClosestEnemyToCrosshair(90.f);

			if (entindex == 0)
				continue;
			DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
			Vec3 origin = Mem.Read<Vec3>(LocalPlayer + 0x134);
			Vec3 vecview = Mem.Read<Vec3>(LocalPlayer + 0x104);
			position.x = origin.x + vecview.x;
			position.y = origin.y + vecview.y;
			position.z = origin.z + vecview.z;

			Vec3 punch = Mem.Read<Vec3>(LocalPlayer + 0x3018);
			Vec3 angles;

			DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (entindex * 0x10));
			Vec3 pos = BonePos(entitybase, 0x2698, bonePosition);

			CalcAngle(position, pos, angles);
			angles.x = angles.x - punch.x * 2.f;
			angles.y = angles.y - punch.y * 2.f;
			ClampAngles(angles);
			if (angles.x == 0 && angles.y == 0)
				continue;
			DWORD Engine = Mem.Module("engine.dll");
			DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
			Mem.Write<Vec3>(clientstate + 0x4D0C, angles);
I'm calling ReadData in the Main part, also calling it before the noflash thread.

Code:
		std::thread t3(ReadData);
		std::thread t1(Aimbot);
		std::thread t2(NoFlash);
How does your BonePos function look like?

You should also normalize your angles after each operation you do on them.
Quote Originally Posted by WasserEsser View Post
How does your BonePos function look like?

You should also normalize your angles after each operation you do on them.
Code:
Vec3 BonePos(DWORD target, DWORD address, int boneId)
{
	DWORD boneBase = Mem.Read<DWORD>(target + address);
	Vec3 vBone;
	vBone.x = Mem.Read<float>(boneBase + 0x30 * boneId + 0x0C);
	vBone.y = Mem.Read<float>(boneBase + 0x30 * boneId + 0x1C);
	vBone.z = Mem.Read<float>(boneBase + 0x30 * boneId + 0x2C);
	return vBone;
}
Quote Originally Posted by F4DE View Post
Code:
Vec3 BonePos(DWORD target, DWORD address, int boneId)
{
	DWORD boneBase = Mem.Read<DWORD>(target + address);
	Vec3 vBone;
	vBone.x = Mem.Read<float>(boneBase + 0x30 * boneId + 0x0C);
	vBone.y = Mem.Read<float>(boneBase + 0x30 * boneId + 0x1C);
	vBone.z = Mem.Read<float>(boneBase + 0x30 * boneId + 0x2C);
	return vBone;
}
Post your entire code.
Bumbing this to the top!
Posts 1–15 of 23 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us