Problem with mouse_event RCS

Posts 1–4 of 4 · Page 1 of 1
Problem with mouse_event RCS
So I got some code for a mouse_event RCS but when I hold down LMB it just starts rotating upwards. (Check video for example)
(I'm using ProcMem)

And no, I do not want to set angles. I want a mouse_event RCS but I can't seem to get it to work.

RCS Code:
Code:
void RCS()
{
	Vec PunchAngle = Mem.Read<Vec>(LocalBase + VecPunch); // LocalBase = Client.dll + dwLocalPlayer
	 
	int xangle = 1920 / 90;
	int yangle = 1080 / 90;
	 
	int xcenter = 1920 / 2;
	int ycenter = 1080 / 2;
	 
	int newX = xcenter - (int)(xangle * (PunchAngle.y / 2.0f));
	int newY = ycenter - (int)(yangle * (-PunchAngle.x / 2.0f));
						
	if (oldX != newX || oldY != newY)
	{
		mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, -(newX - oldX) * 4, 0, 0, 0);
		mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, 0, -(newY - oldY) * 4, 0, 0);
	}
	 
	oldX = newX;
	oldY = newY;
}
Vec struct:
Code:
struct Vec 
{
	float x, y, z;
};
oldX and oldY are on the top of the source.
Code:
int oldX = 0;
int oldY = 0;
Video:
https://a.desu.sh/bated*****4
I got this from @failnoobgamer

Code:
void RecoilControl()
{
	static Vector LastPunch;
	Vector newPunch;

	Vector currentPunch = G::LocalPlayer->GetPunch();
	if (!currentPunch.IsZero())
	{
		auto m_pitch = 0.022;
		auto m_yaw = 0.022;
		auto flSens = GetSens();

		if (G::LocalPlayer->GetShotsFired() > 1)
		{
			newPunch.x = (currentPunch.y - LastPunch.y) * 2.f / (m_pitch * flSens * 1);
			newPunch.y = -(currentPunch.x - LastPunch.x) * 2.f / (m_yaw * flSens * 1);

			mouse_event(MOUSEEVENTF_ABSOLUTE, -newPunch.x * -1, 0, 0, 0);
			mouse_event(MOUSEEVENTF_ABSOLUTE, 0, newPunch.y, 0, 0);
		}
		LastPunch = currentPunch;
	}
}
Or just do it like this
Code:
                Vector3 punch = Core.LocalPlayer.VecPunch - LastPunch;
                _pixels.X = punch.X / (float)(0.22 * _sensitivity) * 2f;
                _pixels.Y = punch.Y / (float)(0.22 * _sensitivity) * 2f;
                WinAPI.mouse_event((uint)0, (uint)_pixels.Y, (uint)-_pixels.X, 0, 0);
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?