-
Автор темы
- #1
C++:
void fastStop(CUserCmd* cmd)
{
if (!(g_cl.m_local->m_fFlags() & FL_ONGROUND && g_cl.m_flags & FL_ONGROUND))
return;
auto pressed_move_key = g_cl.m_cmd->m_buttons & IN_FORWARD || g_cl.m_cmd->m_buttons & IN_MOVELEFT || g_cl.m_cmd->m_buttons & IN_BACK || g_cl.m_cmd->m_buttons & IN_MOVERIGHT || g_cl.m_cmd->m_buttons & IN_JUMP;
if (pressed_move_key)
return;
auto velocity = g_cl.m_local->m_vecVelocity();
if (velocity.length_2d() > 20.0f)
{
ang_t direction;
vec3_t real_view;
math::VectorAngles(velocity, direction);
g_csgo.m_engine->GetViewAngles1(real_view);
direction.y = real_view.y - direction.y;
vec3_t forward;
math::AngleVectors(direction, &forward);
static auto cl_forwardspeed = g_csgo.m_cvar->FindVar(HASH("cl_forwardspeed"));
static auto cl_sidespeed = g_csgo.m_cvar->FindVar(HASH("cl_sidespeed"));
auto negative_forward_speed = -cl_forwardspeed->GetFloat();
auto negative_side_speed = -cl_sidespeed->GetFloat();
auto negative_forward_direction = forward * negative_forward_speed;
auto negative_side_direction = forward * negative_side_speed;
g_cl.m_cmd->m_forward_move = negative_forward_direction.x;
g_cl.m_cmd->m_side_move = negative_side_direction.y;
}
}