SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool c_aimhelper::compute_auto_revolver(c_cs_player* local, c_base_combat_weapon* weapon, c_user_cmd* cmd)
  2. {
  3.     static auto last_checked = 0;
  4.     static auto last_spawn_time = 0.f;
  5.     static auto tick_cocked = 0;
  6.     static auto tick_strip = 0;
  7.     static auto can_fire = false;
  8.  
  9.     const auto max_ticks = time_to_ticks(.25f) - 1;
  10.     const auto tick_base = time_to_ticks(global_vars_base->curtime);
  11.  
  12.     if (local->get_spawn_time() != last_spawn_time)
  13.     {
  14.         last_spawn_time = local->get_spawn_time();
  15.         tick_cocked = tick_base;
  16.         tick_strip = tick_base - max_ticks - 1;
  17.     }
  18.    
  19.     if (weapon->get_next_primary_attack() > global_vars_base->curtime)
  20.     {
  21.         cmd->buttons &= ~c_user_cmd::attack;
  22.         return false;
  23.     }
  24.  
  25.     if (last_checked == tick_base)
  26.         return can_fire;
  27.  
  28.     last_checked = tick_base;
  29.     can_fire = false;
  30.    
  31.     if (tick_base - tick_strip > 2 && tick_base - tick_strip < 16)
  32.         can_fire = true;
  33.  
  34.     if (cmd->buttons & c_user_cmd::attack && can_fire)
  35.         return can_fire;
  36.  
  37.     cmd->buttons |= c_user_cmd::attack;
  38.  
  39.     if (weapon->get_next_secondary_attack() >= global_vars_base->curtime)
  40.         cmd->buttons |= c_user_cmd::attack2;
  41.  
  42.     if (tick_base - tick_cocked > max_ticks * 2 + 1)
  43.     {
  44.         tick_cocked = tick_base;
  45.         tick_strip = tick_base - max_ticks - 1;
  46.     }
  47.  
  48.     const auto cock_limit = tick_base - tick_cocked >= max_ticks;
  49.     const auto after_strip = tick_base - tick_strip <= max_ticks;
  50.  
  51.     if (cock_limit || after_strip)
  52.     {
  53.         tick_cocked = tick_base;
  54.         cmd->buttons &= ~c_user_cmd::attack;
  55.  
  56.         if (cock_limit)
  57.             tick_strip = tick_base;
  58.     }
  59.    
  60.     return can_fire;
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top