Submitted on July 29, 2017 at 02:56 AM

New Paste (Text)

bool __stdcall CreateMoveClient_Hooked(float frametime, CUserCmd* pCmd) {
	if (!pCmd->command_number)
		return true;

	if (Interfaces::Engine->IsConnected() || Interfaces::Engine->IsInGame()) {
		PVOID pebp;
		__asm mov pebp, ebp;
		bool* pbSendPacket = (bool*)(*(DWORD*)pebp - 0x1C);
		bool& bSendPacket = *pbSendPacket;

		if (Vars.Misc.FakeLagMode >= 1) {
			int x = Vars.Misc.FakeLagMode;
			if (x == 1) {
				int iChoke = Vars.Misc.FakeLagChoke;
				static int iFakeLag = 0;

				if (iFakeLag < iChoke) {
					bSendPacket = false;
				}
				if (iFakeLag > iChoke) {
					iFakeLag = 0;
					bSendPacket = true;
				}
				iFakeLag++;
			}
			else if (x == 2) {
				int iFlags = hackManager.pLocal()->GetFlags();
				if (!(iFlags & FL_ONGROUND)) {
					int iChoke = Vars.Misc.FakeLagChoke;
					static int iFakeLag = 0;

					if (iFakeLag < iChoke) {
						bSendPacket = false;
					}
					if (iFakeLag > iChoke) {
						iFakeLag = 0;
						bSendPacket = true;
					}
					iFakeLag++;
				}
			}
			else if (x == 3) {
				int iFlags = hackManager.pLocal()->GetFlags();
				if (iFlags & FL_DUCKING) {
					int iChoke = Vars.Misc.FakeLagChoke;
					static int iFakeLag = 0;

					if (iFakeLag < iChoke) {
						bSendPacket = false;
					}
					if (iFakeLag > iChoke) {
						iFakeLag = 0;
						bSendPacket = true;
					}
					iFakeLag++;
				}
			}
			else if (x == 4) {
				int iFlags = hackManager.pLocal()->GetFlags();
				if (iFlags & FL_ONGROUND) {
					int iChoke = Vars.Misc.FakeLagChoke;
					static int iFakeLag = 0;

					if (iFakeLag < iChoke) {
						bSendPacket = false;
					}
					if (iFakeLag > iChoke) {
						iFakeLag = 0;
						bSendPacket = true;
					}
					iFakeLag++;
				}
			}
		}
		auto LocalPlayer = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
		if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && LocalPlayer && LocalPlayer->IsAlive())
			Hacks::MoveHacks(pCmd, bSendPacket);// Do da hacks
		EnginePred(pCmd);
	}
	// Backup for safety
	Vector origView = pCmd->viewangles;
	Vector viewforward, viewright, viewup, aimforward, aimright, aimup;
	Vector qAimAngles;
	qAimAngles.Init(0.0f, pCmd->viewangles.y, 0.0f);
	AngleVectors(qAimAngles, &viewforward, &viewright, &viewup);
	//Movement Fix
	qAimAngles.Init(0.0f, GetAutostrafeView().y, 0.0f);
	AngleVectors(qAimAngles, &viewforward, &viewright, &viewup);
	qAimAngles.Init(0.0f, pCmd->viewangles.y, 0.0f);
	AngleVectors(qAimAngles, &aimforward, &aimright, &aimup);
	Vector vForwardNorm;
	Normalize(viewforward, vForwardNorm);
	Vector vRightNorm;
	Normalize(viewright, vRightNorm);
	Vector vUpNorm;
	Normalize(viewup, vUpNorm);

	// Original shit for movement correction
	float forward = pCmd->forwardmove;
	float right = pCmd->sidemove;
	float up = pCmd->upmove;
	if (forward > 450) forward = 450;
	if (right > 450) right = 450;
	if (up > 450) up = 450;
	if (forward < -450) forward = -450;
	if (right < -450) right = -450;
	if (up < -450) up = -450;
	pCmd->forwardmove = DotProduct(forward * vForwardNorm, aimforward) + DotProduct(right * vRightNorm, aimforward) + DotProduct(up * vUpNorm, aimforward);
	pCmd->sidemove = DotProduct(forward * vForwardNorm, aimright) + DotProduct(right * vRightNorm, aimright) + DotProduct(up * vUpNorm, aimright);
	pCmd->upmove = DotProduct(forward * vForwardNorm, aimup) + DotProduct(right * vRightNorm, aimup) + DotProduct(up * vUpNorm, aimup);
	// Angle normalisation
	if (Vars.Misc.AntiUntrust) {
		GameUtils::NormaliseViewAngle(pCmd->viewangles);
		pCmd->viewangles.z = 0.00;
		if (pCmd->viewangles.x < -89 || pCmd->viewangles.x > 89 || pCmd->viewangles.y < -180 || pCmd->viewangles.y > 180) {
			GameUtils::NormaliseViewAngle(pCmd->viewangles);
			if (pCmd->viewangles.x < -89 || pCmd->viewangles.x > 89 || pCmd->viewangles.y < -180 || pCmd->viewangles.y > 180) {
				pCmd->viewangles = origView;
				pCmd->sidemove = right;
				pCmd->forwardmove = forward;
			}
		}
	}
	PVOID pebp;
	__asm mov pebp, ebp;
	bool* pbSendPacket = (bool*)(*(DWORD*)pebp - 0x1C);
	bool& bSendPacket = *pbSendPacket;
	if (bSendPacket) {
		LastAngleAA = pCmd->viewangles;
	}
	return false;
}