Advertisement
Guest User

LAGCOMAPSION ORGINALKA

a guest
Jan 20th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. #include "LagComp.h"
  2. using namespace SDK;
  3. void BackTrack::Update(int tick_count)
  4. {
  5. latest_tick = tick_count;
  6. for (int i = 0; i < 64; i++)
  7. {
  8. UpdateRecord(i);
  9. }
  10. }
  11.  
  12. bool BackTrack::IsTickValid(int tick)
  13. {
  14. int delta = latest_tick - tick;
  15. float deltaTime = delta * Interfaces::GlobalVars()->interval_per_tick;
  16. return (fabs(deltaTime) <= 0.2f);
  17. }
  18.  
  19. void BackTrack::UpdateRecord(int i)
  20. {
  21. CBaseEntity* pEntity = (CBaseEntity*)Interfaces::EntityList()->GetClientEntity(i);
  22. if (pEntity && !pEntity->IsDead() && !pEntity->IsDormant())
  23. {
  24. float lby = pEntity->GetLowerBodyYaw();
  25. if (lby != records[i].lby)
  26. {
  27. records[i].tick_count = latest_tick;
  28. records[i].lby = lby;
  29. records[i].headPosition = pEntity->GetHitboxPosition(0);
  30. }
  31. }
  32. else
  33. {
  34. records[i].tick_count = 0;
  35. }
  36. }
  37.  
  38. bool BackTrack::RunLBYBackTrack(int i, CUserCmd* cmd, Vector& aimPoint)
  39. {
  40. if (IsTickValid(records[i].tick_count))
  41. {
  42. aimPoint = records[i].headPosition;
  43. cmd->tick_count = records[i].tick_count;
  44. return true;
  45. }
  46. return false;
  47. }
  48.  
  49. void BackTrack::legitBackTrack(CUserCmd* cmd)
  50. {
  51. if (Settings::Aimbot::aim_Backtrack)
  52. {
  53. int bestTargetIndex = -1;
  54. float bestFov = FLT_MAX;
  55. CBaseEntity* pLocal = (CBaseEntity*)Interfaces::EntityList()->GetClientEntity(Interfaces::Engine()->GetLocalPlayer());
  56. PlayerInfo info;
  57. if (pLocal->IsDead())
  58. return;
  59.  
  60. for (int i = 0; i < Interfaces::Engine()->GetMaxClients(); i++)
  61. {
  62. auto entity = (CBaseEntity*)Interfaces::EntityList()->GetClientEntity(i);
  63.  
  64. if (!entity || !pLocal)
  65. continue;
  66.  
  67. if (entity == pLocal)
  68. continue;
  69.  
  70. if (!Interfaces::Engine()->GetPlayerInfo(i, &info))
  71. continue;
  72.  
  73. if (entity->IsDormant())
  74. continue;
  75.  
  76. if (entity->GetTeam() == pLocal->GetTeam())
  77. continue;
  78.  
  79. if (!entity->IsDead())
  80. {
  81.  
  82. float simtime = entity->GetSimTime();
  83. Vector hitboxPos = entity->GetHitboxPosition(0);
  84.  
  85. headPositions[i][cmd->command_number % 13] = backtrackData{ simtime, hitboxPos };
  86. Vector ViewDir = angle_vector(cmd->viewangles + (pLocal->GetAimPunchAngle() * 2.f));
  87. float FOVDistance = distance_point_to_line(hitboxPos, pLocal->GetEyePosition(), ViewDir);
  88.  
  89. if (bestFov > FOVDistance)
  90. {
  91. bestFov = FOVDistance;
  92. bestTargetIndex = i;
  93. }
  94. }
  95. }
  96.  
  97. float bestTargetSimTime;
  98. if (bestTargetIndex != -1)
  99. {
  100. float tempFloat = FLT_MAX;
  101. Vector ViewDir = angle_vector(cmd->viewangles + (pLocal->GetAimPunchAngle() * 2.f));
  102. for (int t = 0; t < Settings::Aimbot::aim_Backtracktickrate; ++t)
  103. {
  104. float tempFOVDistance = distance_point_to_line(headPositions[bestTargetIndex][t].hitboxPos, pLocal->GetEyePosition(), ViewDir);
  105. if (tempFloat > tempFOVDistance && headPositions[bestTargetIndex][t].simtime > pLocal->GetSimTime() - 1)
  106. {
  107. tempFloat = tempFOVDistance;
  108. bestTargetSimTime = headPositions[bestTargetIndex][t].simtime;
  109. }
  110. }
  111.  
  112. cmd->tick_count = TIME_TO_TICKS(bestTargetSimTime);
  113. }
  114. }
  115. }
  116.  
  117. BackTrack* backtracking = new BackTrack();
  118. backtrackData headPositions[64][12];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement