-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
by baby yoda
C++:
void c_legitbot::aim(c_user_cmd* cmd)
{
if (!config.legit.assist || config.rage.enabled)
return;
auto local = c_cs_player::get_local_player();
if (!local)
return;
const auto weapon = client_entity_list()->get_client_entity_from_handle(local->get_current_weapon_handle());
if (!weapon)
return;
static std::optional<std::tuple<c_vector3d, float, c_animation_system::animation*>> target = std::nullopt;
static auto time = .0f;
if (!target.has_value() || time > .15f)
{
const auto hitbox = weapon->get_class_id() == cweaponawp ? c_cs_player::hitbox::pelvis : c_cs_player::hitbox::head;
target = c_aimhelper::get_legit_target(config.legit.fov, config.legit.backtrack / 100.f, hitbox, true);
time = 0.f;
}
if (!target.has_value())
return;
time += global_vars_base->frametime;
c_qangle delta;
const auto view_angle = engine_client()->get_view_angles();
const auto shoot_position = local->get_shoot_position();
const auto recoil_scale = cvar()->find_var(_("weapon_recoil_scale"))->get_float();
auto aim_angle = math::calc_angle(shoot_position, std::get<0>(target.value()));
aim_angle -= local->get_punch_angle() * recoil_scale;
smooth(aim_angle, view_angle);
//const auto move_angle = pixels_to_angle({ *x, *y });
auto view_delta = aim_angle - view_angle;
math::normalize(view_delta);
math::normalize(aim_angle);
cmd->viewangles = aim_angle;
engine_client()->set_view_angles(aim_angle);
}