-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
void c_antiaim::fakelag(c_cs_player* local, c_user_cmd* cmd, bool& send_packet)
{
static constexpr auto target_standing = 1;
static constexpr auto target_moving = 13;
static constexpr auto target_air = 8;
static auto last_origin = c_vector3d();
static auto last_simtime = 0.f;
static auto last_ducked = false;
static auto fakeland = false;
static auto onpeek_timer = 0.f;
static auto unduck_timer = 0.f;
static auto onpeek = false;
auto choke_amount = target_standing;
choke_amount = std::max(14, target_standing);
if (!local || !local->is_alive() || !cmd || game_rules->is_freeze_period())
return;
const auto weapon = reinterpret_cast<c_base_combat_weapon*>(
client_entity_list()->get_client_entity_from_handle(local->get_current_weapon_handle()));
if (!weapon)
return;
const auto info = weapon_system->get_weapon_data(weapon->get_item_definition());
if (!info)
return;
const auto max_choke_amount = game_rules->is_valve_ds() ? 9u : 15u;
if (local->get_velocity().length2d() > info->get_standing_accuracy(weapon) || local->get_duck_amount() > 0.f)
choke_amount = target_moving;
if (!local->is_on_ground())
choke_amount = target_air;
// are we in on peek?
if (onpeek_timer > global_vars_base->curtime + ticks_to_time(16))
{
onpeek_timer = 0.f;
onpeek = false;
}
// are we in unduck?
if (unduck_timer > global_vars_base->curtime + ticks_to_time(16))
unduck_timer = 0.f;
// extend fake lag to maximum.
if (onpeek_timer >= global_vars_base->curtime || unduck_timer >= global_vars_base->curtime)
choke_amount = max_choke_amount + 1;
// force enemy to extrapolate us.
if (last_simtime == global_vars_base->curtime - global_vars_base->interval_per_tick
&& (local->get_origin() - last_origin).length2dsqr() > 4096.f)
choke_amount = 1;
auto missing_target = false;
if (on_peek(local, missing_target))
{
if (!onpeek && onpeek_timer < global_vars_base->curtime)
{
onpeek_timer = global_vars_base->curtime + ticks_to_time(16);
if (client_state->choked_commands > 1)
choke_amount = 1;
}
onpeek = true;
}
else if (missing_target)
onpeek = false;
if (local->get_flags() & c_base_player::flags::on_ground
&& !(cmd->buttons & c_user_cmd::flags::duck) && last_ducked)
{
if (unduck_timer < global_vars_base->curtime)
{
unduck_timer = global_vars_base->curtime + ticks_to_time(16);
if (client_state->choked_commands > 1)
{
cmd->buttons |= c_user_cmd::flags::duck;
choke_amount = 1;
}
}
}
if (unduck_timer > global_vars_base->curtime - ticks_to_time(2) && !client_state->choked_commands)
cmd->buttons |= c_user_cmd::flags::duck;
// fake land to desync animations for pasted cheats.
auto origin = local->get_origin();
auto velocity = local->get_velocity();
auto flags = local->get_flags();
c_trace_system::extrapolate(local, origin, velocity, flags,
prediction_system->unpredicted_flags & c_base_player::on_ground);
if (flags & c_base_player::flags::on_ground
&& !(local->get_flags() & c_base_player::flags::on_ground))
{
fakeland = fabsf(math::normalize_yaw(local->get_lby()
- animation_system->local_animation.eye_angles.y)) > 35.f;
choke_amount = fakeland ? max_choke_amount : 0;
}
else if (local->get_flags() & c_base_player::flags::on_ground && fakeland)
{
fakeland = false;
choke_amount = 1;
}
if (global_vars_base->curtime + global_vars_base->interval_per_tick > next_lby_update
|| lby_update >= global_vars_base->curtime - global_vars_base->interval_per_tick)
choke_amount = max_choke_amount;
const auto shot_last_tick = antiaim->shot_cmd <= cmd->command_number && antiaim->shot_cmd > cmd->command_number - client_state->choked_commands;
estimated_choke = choke_amount;
static int fox = 0;
if (fox >= 0 && fox < choke_amount)
{
client_state->choked_commands = fox;
fox++;
}
else
fox = 0;
// store data of current tick for next evaluation.
last_origin = local->get_origin();
last_simtime = global_vars_base->curtime;
last_ducked = cmd->buttons & c_user_cmd::flags::duck;
} [/ CODE]
Последнее редактирование: