hi im a big dumb paster
i have some code for circle-strafing & it works but whenever i execute it i get some big lag
there's an example for ya
the code is here:
Code:
void StartStrafe(CUserCmd *pCmd)
{
IClientEntity* pLocal = hackManager.pLocal();
StrafeAngle = 0;
IsActive = true;
QAngle CurrentAngles;
CurrentAngles.x = 0;
CurrentAngles.y = 0;
Vector Forward = CurrentAngles.Direction();
Vector Right = Forward.Cross(Vector(0, 0, 1));
Vector Left = Vector(-Right.x, -Right.y, Right.z);
float LeftPath = GetTraceFractionWorldProps(pLocal->GetAbsOrigin() + Vector(0, 0, 10), pLocal->GetAbsOrigin() + Left * 450.f + Vector(0, 0, 10));
float RightPath = GetTraceFractionWorldProps(pLocal->GetAbsOrigin() + Vector(0, 0, 10), pLocal->GetAbsOrigin() + Right * 450.f + Vector(0, 0, 10));
RightMovement = 1;
}
void Strafe(CUserCmd *pCmd)
{
IClientEntity* pLocal = hackManager.pLocal();
Vector Velocity = pLocal->GetVelocity();
Velocity.z = 0;
float Speed = Velocity.Length();
if (Speed < 45) Speed = 45;
if (Speed > 750) Speed = 750;
float FinalPath = GetTraceFractionWorldProps(pLocal->GetAbsOrigin() + Vector(0, 0, 10), pLocal->GetAbsOrigin() + Vector(0, 0, 10) + Velocity / 2.0f);
float DeltaAngle = RightMovement * fmax((275.0f / Speed) * (2.0f / FinalPath) * (128.0f / (1.7f / Interfaces::Globals->interval_per_tick)) * CircleFactor, 2.0f);
StrafeAngle += DeltaAngle;
if (fabs(StrafeAngle) >= 360.0f)
{
StrafeAngle = 0.0f;
IsActive = false;
//RightMovement = 0;
}
else
{
pCmd->forwardmove = cos((StrafeAngle + 90 * RightMovement) * (M_PI / 180.0f)) * 450.f;
pCmd->sidemove = sin((StrafeAngle + 90 * RightMovement) * (M_PI / 180.0f)) * 450.f;
}
}