Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool c_aimhelper::compute_auto_revolver(c_cs_player* local, c_base_combat_weapon* weapon, c_user_cmd* cmd)
- {
- static auto last_checked = 0;
- static auto last_spawn_time = 0.f;
- static auto tick_cocked = 0;
- static auto tick_strip = 0;
- static auto can_fire = false;
- const auto max_ticks = time_to_ticks(.25f) - 1;
- const auto tick_base = time_to_ticks(global_vars_base->curtime);
- if (local->get_spawn_time() != last_spawn_time)
- {
- last_spawn_time = local->get_spawn_time();
- tick_cocked = tick_base;
- tick_strip = tick_base - max_ticks - 1;
- }
- if (weapon->get_next_primary_attack() > global_vars_base->curtime)
- {
- cmd->buttons &= ~c_user_cmd::attack;
- return false;
- }
- if (last_checked == tick_base)
- return can_fire;
- last_checked = tick_base;
- can_fire = false;
- if (tick_base - tick_strip > 2 && tick_base - tick_strip < 16)
- can_fire = true;
- if (cmd->buttons & c_user_cmd::attack && can_fire)
- return can_fire;
- cmd->buttons |= c_user_cmd::attack;
- if (weapon->get_next_secondary_attack() >= global_vars_base->curtime)
- cmd->buttons |= c_user_cmd::attack2;
- if (tick_base - tick_cocked > max_ticks * 2 + 1)
- {
- tick_cocked = tick_base;
- tick_strip = tick_base - max_ticks - 1;
- }
- const auto cock_limit = tick_base - tick_cocked >= max_ticks;
- const auto after_strip = tick_base - tick_strip <= max_ticks;
- if (cock_limit || after_strip)
- {
- tick_cocked = tick_base;
- cmd->buttons &= ~c_user_cmd::attack;
- if (cock_limit)
- tick_strip = tick_base;
- }
- return can_fire;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement