Solved CSGO Mouse_Event aimbot seems slow?

  • CSGO recently moved logic from 'client_panorama.dll' to 'client.dll', you must update all code that uses 'client_panorama.dll' and replace it with 'client.dll' or the code will not work.
Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Tarolion

Newbie
Full Member
Nobleman
Mar 12, 2015
42
258
1
Hi,

My aimbot code is below, can anyone please suggest why this aimbot does not seem to aim directly at the head? it feels like it gets close, then the dx and dy being passed to mouse_event appear to be too small for mouse_event to register any movement?

C++:
// Determine Target
	int target = -1;
	float maxDist = 500.0f;
	float minDist = maxDist;

	std::vector<float> screenCoords;
	POINT mPos;
	GetCursorPos(&mPos);

	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		if (m_players[i].memIndex == 0)
			continue;

		if (m_players[i].GetDormant())
			continue;

		if (m_players[i].GetAlive())
			continue;
		
		if (!m_players[i].IsEnemy())
			continue;

		screenCoords = GetScreenPosBone(i, 4);

		if (screenCoords[0] == -1.0f || screenCoords[1] == -1.0f)
		{
			continue;
		}

		float x = screenCoords[0] - mPos.x;
		float y = screenCoords[1] - mPos.y;
		float dist = sqrt2(x*x + y*y);

		if (dist < 200 && dist < minDist)
		{
			minDist = dist;
			target = i;
		}

	}

	if (target == -1)
		return;

	// Now, if we have a target aim at them.
	if (target > -1)
	{
		GetCursorPos(&mPos);
		int targetBone = 4;
		screenCoords = GetScreenPosBone(target, targetBone);

		if (screenCoords[0] == -1.0f || screenCoords[1] == -1.0f)
			return;

		float dx = ((screenCoords[0] - mPos.x) * minDist/maxDist * 1/minDist)* 65535 / 1920;
		float dy = ((screenCoords[1] - mPos.y) * minDist/maxDist * 1/minDist)* 65535 / 1080;

		dx /= 1;
		dy /= 1;

		std::string test = std::to_string(dx) + ", " + std::to_string(dy);
				
		mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK, dx, dy, NULL, NULL);
	}
 

Tarolion

Newbie
Full Member
Nobleman
Mar 12, 2015
42
258
1
Ok, so I gave up on using mouse movements. I'm finding them just too slow, instead I'm trying to work on the spray pattern adjustment. I feel like I'm doing something wrong? maybe the screenshot makes it clear. Have I understood the punch angle correctly?



The red dots are the impact points from my spray.

The way I understand this, when I fire a bullet, the punch angle is added to my aim angle to produce the projectile direction? So when I do the aim calculation, I calculate the direction to the target, then take off the punch angle?

C++:
if (aimbotTarget > -1)
	{
		int targetBone = 6;

		// Calculate Distance to Target
		std::vector<float> origin = m_localPlayer.GetEyePosition();
		std::vector<float> target = m_players[aimbotTarget].GetBonePosition(targetBone);
		float xx = target[0] - origin[0];
		float yy = target[1] - origin[1];
		float zz = target[2] - origin[2];

		float targetDist = sqrt2(xx*xx + yy*yy + zz*zz);

		std::vector<float> direction;
		direction.push_back(xx);
		direction.push_back(yy);
		direction.push_back(zz);

		// Now we want to find the aimPunch Angle and add this to our aimPosition
		std::vector<float> punchAngle = m_localPlayer.GetPunchAngle();
		int shots = m_localPlayer.GetShotsFired();

		// Direction to Target
		float yaw = atan(yy / xx) * 180 / 3.14159265359 - punchAngle[0];
		float pitch = acosf(zz / sqrt2(xx*xx + yy*yy)) * 180 / 3.14159265359 + punchAngle[1] - 90;

		if (xx < 0) yaw += 180.0;
		while (yaw > 180) yaw -= 360;
		while (yaw < -180) yaw += 360;

		if (pitch > 88)
			pitch = 88;
		if (pitch < -88)
			pitch = -88;

		SIZE_T size;
		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(m_localPlayer.memIndex + OFFSET_ENT_EYEANGLES + 0x0), &pitch, sizeof(float), &size);
		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(m_localPlayer.memIndex + OFFSET_ENT_EYEANGLES + 0x4), &yaw, sizeof(float), &size);

		DWORD clientState = Mem.Read<DWORD>(EngineDLL + OFFSET_ENGINE_CLIENTSTATE);

		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(clientState + OFFSET_CLIENTSTATE_ANGLES + 0x0), &pitch, sizeof(float), &size);
		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(clientState + OFFSET_CLIENTSTATE_ANGLES + 0x4), &yaw, sizeof(float), &size);
	}
 

Oneshot

Meme Tier VIP
Apr 4, 2015
232
190
13
I did an aimbot that used sendinput but it did not use screen coordinates it was based on my viewangles so i calculated the angle to the enemy and then i i moved the mouse with sendinput. i used this function
C++:
void MouseMove(float x, float y)
{
	float fScreenWidth = ::GetSystemMetrics(SM_CXSCREEN) - 1;
	float fScreenHeight = ::GetSystemMetrics(SM_CYSCREEN) - 1;
	float fx = x*(6553500.0f / fScreenWidth);
	float fy = y*(6553500.0f / fScreenHeight);
	float ffx = fx* (0.0133297787256732) / sensitivity;
	float ffy = fy*(0.7488393073015545) / sensitivity;

	INPUT  Input = { 0 };
	Input.type = INPUT_MOUSE;
	Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
	Input.mi.dx = ffx;
	Input.mi.dy = ffy;
	::SendInput(1, &Input, sizeof(INPUT));
}
this will work if you have 1 in sensitivity its just like manipulate the real viewangles but its not 100% accurate cause the minimum you can move your mouse on screen is 1 pixel.

here it is https://www.youtube.com/watch?v=wNE6BydGPak
 

Oneshot

Meme Tier VIP
Apr 4, 2015
232
190
13
Oh boy it's that number again.
This function is copy pasted. That number i got when i satt the viewangles to 0,
and then i moved them with this function. i inputted 1, and then i took the changed viewangles values and divided 1 with the new viewangles.

This function works like if i set them to 15 the viewangles will add 15ish. so from lets say yaw 45.8469 degrees + 15 = 60.???? degress. its bad i know but it works its not that accurate but the lower the sens in game the higher precision this will get if you tweak it some. Obsta do you have a better method you wanna share? cause this is not the best its dirty :)
 

Tarolion

Newbie
Full Member
Nobleman
Mar 12, 2015
42
258
1
Hey guys, where do you get the offsets for the weapon spray patterns.. I can't find these
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
God forbid anyone learned how to reverse engineer
 

Oneshot

Meme Tier VIP
Apr 4, 2015
232
190
13
remove the punch angle times 2 and instead of using atan you can use atan2 then you do not need to deal with the normalizing shit you are doing there.

dont trust that i have not made a typo here hahah :)

C++:
if (aimbotTarget > -1)
	{
		int targetBone = 8; // 8 is the new bone for head i think :) 

		std::vector<float> origin = m_localPlayer.GetEyePosition();
		std::vector<float> target = m_players[aimbotTarget].GetBonePosition(targetBone);
		float xx = target[0] - origin[0];
		float yy = target[1] - origin[1];
		float zz = target[2] - origin[2];

		float targetDist = sqrt2(xx*xx + yy*yy + zz*zz);

		std::vector<float> direction;
		direction.push_back(xx);
		direction.push_back(yy);
		direction.push_back(zz);

		std::vector<float> punchAngle = m_localPlayer.GetPunchAngle();
		int shots = m_localPlayer.GetShotsFired();

		float yaw = atan2(yy / xx) * 180 / 3.14159265359 - (punchAngle[0] * 2);
		float pitch = acosf(zz / sqrt2(xx*xx + yy*yy)) * 180 / 3.14159265359 + (punchAngle[1] * 2) - 90;

		if (yaw > 180) // just clamped the viewangles.
            yaw = 179.9999;
        if (yaw < -180)
            yaw = -179.9999;

		if (pitch > 89)
			pitch = 88.9999;
		if (pitch < -89)
			pitch = -88.9999;

		SIZE_T size; // what are you doing here???? do you write to the localplayer viewangles?
		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(m_localPlayer.memIndex + OFFSET_ENT_EYEANGLES + 0x0), &pitch, sizeof(float), &size);
		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(m_localPlayer.memIndex + OFFSET_ENT_EYEANGLES + 0x4), &yaw, sizeof(float), &size);

		DWORD clientState = Mem.Read<DWORD>(EngineDLL + OFFSET_ENGINE_CLIENTSTATE);

		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(clientState + OFFSET_CLIENTSTATE_ANGLES + 0x0), &pitch, sizeof(float), &size);
		WriteProcessMemory(Mem.GetHProcess(), (LPVOID)(clientState + OFFSET_CLIENTSTATE_ANGLES + 0x4), &yaw, sizeof(float), &size);
	}
you really should make a check if the angles you are trying to set if they are finite or an int. then you might get untrusted. isfinite() and convert the angle to an inte int intYaw = yaw; and then check if its the same as the float like if(intYaw == yaw){ return 0; } something like that.
 
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