-
Автор темы
- #1
as said above
C++:
void antiaim::fix_movement(CUserCmd* cmd, QAngle wish_angle)
{
//get our viewangles for calculations for lator on
QAngle real_angles;
g_pEngine->GetViewAngles(real_angles);
// adjust for roll if we in nospread, no spread is dead but may aswell do this anyway
if (!(g_pLocalPlayer->m_fFlags() & FL_ONGROUND) && real_angles.z != 0.f)
cmd->sidemove = 0.f;
//get our speed from cmd move crap
Vector m_flMove = Vector{ cmd->forwardmove, cmd->sidemove, cmd->upmove };
const float m_flVelocity = m_flMove.Length2D();
//no need fix if we not moving
if (m_flVelocity == 0.f)
return;
//calc our move angles
QAngle move_angle;
VectorAngles(m_flMove, move_angle);
//get our needed yaw
float yaw = DEG2RAD(cmd->viewangles.y - real_angles.y + move_angle.y);
//fix our movements with the crap we calculated before
cmd->forwardmove = cos(yaw) * m_flVelocity;
cmd->sidemove = sin(yaw) * m_flVelocity;
//yeah this is a shit way fix leg slide but simple asf u can just do a hook to fix it or something
//fix our feet animations, doing it here cuz we don't really need fix it if we dont move
if (g_pLocalPlayer->get_move_type() != MOVETYPE_LADDER)
cmd->buttons &= ~(IN_FORWARD | IN_BACK | IN_MOVERIGHT | IN_MOVELEFT);
}
Последнее редактирование: