SHARE
TWEET

Untitled

a guest Apr 24th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "resolver.h"
  2.  
  3. bool Settings::Resolver::resolveAll = false;
  4. std::vector<std::pair<C_BasePlayer*, QAngle>> player_data;
  5.  
  6. void Resolver::FrameStageNotify(ClientFrameStage_t stage)
  7. {
  8.     if (!engine->IsInGame())
  9.         return;
  10.  
  11.     C_BasePlayer* localplayer = (C_BasePlayer*) entityList->GetClientEntity(engine->GetLocalPlayer());
  12.     if (!localplayer)
  13.         return;
  14.  
  15.     static std::array<int, 64> oldMissedShots = { 0 };
  16.  
  17.     if (stage == ClientFrameStage_t::FRAME_NET_UPDATE_POSTDATAUPDATE_START)
  18.     {
  19.         for (int i = 1; i < engine->GetMaxClients(); ++i)
  20.         {
  21.             C_BasePlayer* player = (C_BasePlayer*) entityList->GetClientEntity(i);
  22.  
  23.             if (!player
  24.                 || player == localplayer
  25.                 || player->GetDormant()
  26.                 || !player->GetAlive()
  27.                 || player->GetImmune()
  28.                 || player->GetTeam() == localplayer->GetTeam())
  29.                 continue;
  30.  
  31.             CCSGOAnimState* animState = player->GetAnimState();
  32.             if (!animState)
  33.                 continue;
  34.  
  35.             float maxDelta = AntiAim::GetMaxDelta(animState);
  36.  
  37.             int missedShot = LogShots::missedShots[player->GetIndex() - 1];
  38.             int oldMissedShot = oldMissedShots[player->GetIndex() - 1];
  39.  
  40.             if (missedShot <= oldMissedShot)
  41.                 continue;
  42.  
  43.             player_data.push_back(std::pair<C_BasePlayer*, QAngle>(player, *player->GetEyeAngles()));
  44.  
  45.             switch (missedShot % 5)
  46.             {
  47.                 case 0:
  48.                     player->GetEyeAngles()->y -= 0;
  49.                     break;
  50.                 case 1:
  51.                     player->GetEyeAngles()->y -= maxDelta;
  52.                     break;
  53.                 case 2:
  54.                     player->GetEyeAngles()->y += maxDelta;
  55.                     break;
  56.                 case 3:
  57.                     player->GetEyeAngles()->y -= maxDelta / 2;
  58.                     break;
  59.                 case 4:
  60.                     player->GetEyeAngles()->y += maxDelta / 2;
  61.                     break;
  62.             }
  63.         }
  64.     }
  65.     else if (stage == ClientFrameStage_t::FRAME_RENDER_END)
  66.     {
  67.         for (unsigned long i = 0; i < player_data.size(); i++)
  68.         {
  69.             std::pair<C_BasePlayer*, QAngle> player_aa_data = player_data[i];
  70.             *player_aa_data.first->GetEyeAngles() = player_aa_data.second;
  71.         }
  72.  
  73.         oldMissedShots = LogShots::missedShots;
  74.  
  75.         player_data.clear();
  76.     }
  77. }
  78.  
  79. void Resolver::PostFrameStageNotify(ClientFrameStage_t stage)
  80. {
  81. }
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
 
Top