SHARE
TWEET

Untitled

a guest Oct 18th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "includes.h"
  2. #include "Aimbot.h"
  3. #include "Autowall.h"
  4. #include "Resolver.h"
  5. #include "BacktrackingHelper.h"
  6.  
  7. resolver* g_Resolver = new resolver;
  8.  
  9. bool resolver::desyncing(CBaseEntity* entity) {
  10.     auto record = data[entity->GetIndex()];
  11.     if (vars::missed_shots[entity->GetIndex()] > 0) { record.missed = true; return true; }
  12.     if (record.oldsimtime != entity->GetSimulationTime()) return true;
  13.     if (vars::logged[entity->GetIndex()]) return true;
  14.  
  15.     return false;
  16. }
  17.  
  18. void resolver::applyangle( CBaseEntity* entity, float bodyyaw ) {
  19.     auto record = data[ entity->Index( ) ];
  20.     float newyaw = bodyyaw;
  21.     record.backwardsdelta >= 90 ? newyaw *= -1 : newyaw = bodyyaw;
  22.     record.lastresolved = newyaw;
  23.     entity->AnimState()->m_flGoalFeetYaw += newyaw;
  24. }
  25.  
  26. void resolver::resolve( CBaseEntity* entity )
  27. {
  28.     auto eidx = entity->GetIndex();
  29.     auto poseparams = entity->poseparameterptr( );
  30.     auto record = data[eidx];
  31.     auto* animstate = entity->AnimState( );
  32.     if (!animstate || !entity->GetAnimOverlays( ) || !poseparams)
  33.         return;
  34.  
  35.     if ( desyncing(entity) ) {
  36.        
  37.         record.maxdesync = GameUtils::maxdesyncdelta( entity ) * .9;
  38.  
  39.         record.backwards = Math::NormalizeYaw( Math::CalcAngle( vars::LocalPlayer->GetOrigin( ), entity->GetOrigin( ) ).y + 180 );
  40.         record.backwardsdelta = abs(Math::NormalizeYaw(( entity->GetEyeAngles( ).y - record.backwards)));
  41.  
  42.         if ( GetAsyncKeyState( menu.rage.resolveroverride ) ) { // Override
  43.  
  44.             Vector pos_enemy = entity->GetOrigin();
  45.             if (GameUtils::WorldToScreen( entity->GetOrigin( ), pos_enemy ) ) {
  46.                 ImVec2 ImGui::GetMousePos( );
  47.                 record.resolvermode = "OVERRIDE";
  48.                 applyangle(entity, (ImGui::GetMousePos().x - pos_enemy.x) < 0 ? -record.maxdesync : record.maxdesync);
  49.             }
  50.         } else {
  51.             if (record.missed ? vars::missed_shots[eidx] > 1 : vars::missed_shots[eidx] > 0) {
  52.                 //FIRST SHOT RESOLVE
  53.                 if (vars::logged[eidx]) {
  54.                     //Set to Last Hit Feet Yaw
  55.                     record.resolvermode = "LOG";
  56.                     applyangle(entity, vars::loggedfeetyaw[eidx]);
  57.                 }
  58.                 else {
  59.                     //Anti-Freestanding Body yaw
  60.                     Vector headpos, leftpos, rightpos;
  61.                     headpos = entity->GetHedPos();
  62.                     leftpos = Vector(headpos.x - 50, headpos.y, headpos.z);
  63.                     rightpos = Vector(headpos.x + 50, headpos.y, headpos.z);
  64.                     float ldamage = g_Autowall->CanHit(leftpos);
  65.                     float rdamage = g_Autowall->CanHit(rightpos);
  66.                     if (ldamage != rdamage) {
  67.                         applyangle(entity, ldamage > rdamage ? -record.maxdesync : record.maxdesync);
  68.                         record.resolvermode = "FSBY";
  69.                     } else {
  70.                         applyangle(entity, -record.maxdesync);
  71.                         record.resolvermode = "RIGHT";
  72.                     }
  73.                 }
  74.             }else {
  75.                 //BRUTEFORCE
  76.                 switch (vars::missed_shots[eidx]) {
  77.                 case 1:
  78.                     applyangle(entity, -record.lastresolved);
  79.                     break;
  80.                 case 2:
  81.                     applyangle(entity, record.lastresolved / 2);
  82.                     break;
  83.                 case 3:
  84.                     applyangle(entity, -record.lastresolved / 2);
  85.                     break;
  86.                 case 4:
  87.                     applyangle(entity, 0);
  88.                     break;
  89.                 }
  90.             }
  91.         }
  92.     } else record.resolvermode = "N/A";
  93.     record.oldeyeangles = entity->GetEyeAngles( );
  94.     record.oldsimtime = entity->GetSimulationTime( );
  95.     record.oldfeetyaw = animstate->m_flGoalFeetYaw;
  96. }
  97.  
  98. void resolver::handlehits( CBaseEntity* entity )
  99. {
  100.     auto NetChannel = g_pEngine->GetNetChannelInfo( );
  101.  
  102.     if ( !NetChannel )
  103.         return;
  104.  
  105.     static float predTime[65] = { 0.f };
  106.     static bool init[65] = { false };
  107.     int eidx = entity->GetIndex();
  108.  
  109.     if ( vars::shot ) {
  110.  
  111.         if ( init[eidx] ) {
  112.  
  113.             data[eidx].pitch = entity->GetEyeAngles( ).x;
  114.             predTime[ entity->GetIndex( ) ] = g_pGlobals->curtime + NetChannel->GetAvgLatency( FLOW_INCOMING ) + NetChannel->GetAvgLatency( FLOW_OUTGOING ) + TICKS_TO_TIME( 1 ) + TICKS_TO_TIME( g_pEngine->GetNetChannel( )->m_nChokedPackets );
  115.             init[eidx] = false;
  116.         }
  117.         if ( g_pGlobals->curtime > predTime[eidx] && !vars::hit[eidx] ) {
  118.             if (vars::logged[eidx]) vars::logged[eidx] = false;
  119.             if ( vars::missed_shots[eidx] > 4 ) vars::missed_shots[eidx] = 0;
  120.             else vars::missed_shots[eidx]++;
  121.             vars::shot = false;
  122.  
  123.         } else if ( g_pGlobals->curtime <= predTime[eidx] && vars::hit[eidx] )
  124.             vars::shot = false;
  125.     } else
  126.         init[eidx] = true;
  127.  
  128.     vars::hit[eidx] = false;
  129. }
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