-
Автор темы
- #1
как исправить
код:
Пожалуйста, авторизуйтесь для просмотра ссылки.
приколы с автопиком? код:
Код:
void misc::automatic_peek(CUserCmd* cmd, float wish_yaw)
{
if (!g_ctx.globals.weapon->is_non_aim() && key_binds::get().get_key_bind_state(18))
{
if (g_ctx.globals.start_position.IsZero())
{
g_ctx.globals.start_position = g_ctx.local()->GetAbsOrigin();
if (!(engineprediction::get().backup_data.flags & FL_ONGROUND))
{
Ray_t ray;
CTraceFilterWorldAndPropsOnly filter;
CGameTrace trace;
ray.Init(g_ctx.globals.start_position, g_ctx.globals.start_position - Vector(0.0f, 0.0f, 1000.0f));
m_trace()->TraceRay(ray, MASK_SOLID, &filter, &trace);
if (trace.fraction < 1.0f)
g_ctx.globals.start_position = trace.endpos + Vector(0.0f, 0.0f, 2.0f);
}
}
else
{
auto revolver_shoot = g_ctx.globals.weapon->m_iItemDefinitionIndex() == WEAPON_REVOLVER && !g_ctx.globals.revolver_working && (cmd->m_buttons & IN_ATTACK || cmd->m_buttons & IN_ATTACK2);
if (cmd->m_buttons & IN_ATTACK && g_ctx.globals.weapon->m_iItemDefinitionIndex() != WEAPON_REVOLVER || revolver_shoot)
g_ctx.globals.fired_shot = true;
if (g_ctx.globals.fired_shot)
{
auto& current_position = g_ctx.local()->GetAbsOrigin();
auto difference = current_position - g_ctx.globals.start_position;
if (difference.Length2D() > 5.0f)
{
auto velocity = Vector(difference.x * cos(wish_yaw / 180.0f * M_PI) + difference.y * sin(wish_yaw / 180.0f * M_PI), difference.y * cos(wish_yaw / 180.0f * M_PI) - difference.x * sin(wish_yaw / 180.0f * M_PI), difference.z);
cmd->m_forwardmove = -velocity.x * 20.0f;
cmd->m_sidemove = velocity.y * 20.0f;
}
else
{
g_ctx.globals.fired_shot = false;
g_ctx.globals.start_position.Zero();
}
}
}
}
else
{
g_ctx.globals.fired_shot = false;
g_ctx.globals.start_position.Zero();
}
}