Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. #include "Resolver.h"
  2. #define SETANGLE 180
  3. int Globals::Shots = 0;
  4. bool Globals::change;
  5. CUserCmd* Globals::UserCmd;
  6. int Globals::TargetID;
  7. IClientEntity* Globals::Target;
  8.  
  9. bool Globals::AutoBody = false;
  10.  
  11. bool Globals::DrawLBY = false;
  12. bool Globals::LBYUpdated = false;
  13.  
  14. static float oldlowerbodyyaw [65];
  15.  
  16. int shots[65];
  17.  
  18. float get_average_lby_standing_update_delta(IClientEntity* player) {
  19. static float last_update_time[64];
  20. static float second_laste_update_time[64];
  21. static float oldlowerbody[64];
  22. float lby = static_cast<int>(fabs(player->EyeAnglesPointer()->y - player->GetLowerBodyYaw()));
  23.  
  24. if (lby != oldlowerbody[player->GetIndex()]) {
  25. second_laste_update_time[player->GetIndex()] = last_update_time[player->GetIndex()];
  26. last_update_time[player->GetIndex()] = Interfaces::Globals->curtime;
  27. oldlowerbody[player->GetIndex()] = lby;
  28. }
  29.  
  30. return last_update_time[player->GetIndex()] - second_laste_update_time[player->GetIndex()];
  31. }
  32.  
  33. bool lby_keeps_updating() {
  34. return get_average_lby_standing_update_delta;
  35. }
  36.  
  37. bool IsMovingOnGround(IClientEntity* pEntity) {
  38. //Check if player has a velocity greater than 0 (moving) and if they are onground.
  39. return pEntity->GetVelocity().Length2D() > 0.1f && *pEntity->GetFlags() & FL_ONGROUND;
  40. }
  41.  
  42. //Used to tell if a player is fake walking
  43. bool IsFakeWalking(IClientEntity* pEntity) {
  44. //Check if a player is moving, but at below a velocity of 36
  45. return IsMovingOnGround(pEntity) && pEntity->GetVelocity().Length2D() < 35.0f;
  46. }
  47.  
  48.  
  49. void LuigiKMS::Resolve()
  50. {
  51. IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  52. DWORD eyeangles = NetVar.GetNetVar(0xBFEA4E7B);
  53. for (int i = 0; i < Interfaces::Engine->GetMaxClients(); ++i)
  54. {
  55. IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
  56. if (!pEntity || pEntity->IsDormant() || !pEntity->IsAlive())
  57. continue;
  58.  
  59. player_info_t pTemp;
  60. if (!Interfaces::Engine->GetPlayerInfo(i, &pTemp))
  61. continue;
  62.  
  63. int index = pEntity->GetIndex();
  64. Vector* eyeAngles = pEntity->EyeAnglesPointer();
  65.  
  66.  
  67. if (Menu::Window.RageBotTab.AccuracyResolveYaw.GetState() == 1)
  68. {
  69. // InterpolationList = InterpolationFix kinda weird
  70. //static auto InterpolationList = *(uintptr_t*)(Utilities::Memory::FindPattern("client.dll", ((PBYTE)"\x39\x9F\xB6"), "xxx") + 0xA);
  71. //if (InterpolationList)
  72. //{
  73. // *reinterpret_cast<uintptr_t*>(static_cast<uintptr_t>(InterpolationList) + 18) = 0;
  74. // *reinterpret_cast<uintptr_t*>(static_cast<uintptr_t>(InterpolationList) + 12) = 0xFFFF;
  75. //}
  76. static float last_moving_lby[64];
  77. float interpellslationrationz = Interfaces::CVar->FindVar(XorStr("cl_interp_ratio"))->fValue;
  78. float updaterlaterrater = Interfaces::CVar->FindVar(XorStr("cl_updaterate"))->fValue;
  79. int skeet = interpellslationrationz / updaterlaterrater;
  80. const bool is_moving = pEntity->GetVelocity().Length2D() > 0.1;
  81. float ismoving = pEntity->GetVelocity().Length2D() > 0.1f;
  82. float isstanding = pEntity->GetVelocity().Length2D() <= 0.0f;
  83. static float lastlby[65];
  84. static float last_moving_time[65];
  85. float servercalc = Interfaces::Globals->curtime * Interfaces::Globals->tickcount;
  86.  
  87. float bodyeyedelta = eyeAngles->y - pEntity->GetLowerBodyYaw();
  88. float lby = pEntity->GetLowerBodyYaw();
  89.  
  90. Vector attarget = (pLocal->GetEyePos(), pLocal->GetEyePos());
  91.  
  92. if (ismoving) {
  93. eyeAngles->y = lby;
  94. }
  95. if (IsFakeWalking) {
  96. eyeAngles->y - lby >= lby + 180;
  97. }
  98. else if (is_moving && !IsFakeWalking)
  99. {
  100. last_moving_lby[pEntity->GetIndex()] = pEntity->GetLowerBodyYaw();
  101. lastlby[pEntity->GetIndex()] = last_moving_lby[pEntity->GetIndex()];
  102. last_moving_time[pEntity->GetIndex()] = Interfaces::Globals->curtime;
  103. *(float*)((DWORD)pEntity + eyeangles) = pEntity->GetLowerBodyYaw();
  104. }
  105. else if (isstanding)
  106. {
  107. if (lby_keeps_updating() < 35) {
  108. switch (shots[Globals::TargetID] % 2) {
  109. case 0:
  110. pEntity->GetAbsOrigin(), pLocal->GetAbsOrigin().y + 35;
  111. break;
  112. case 1:
  113. pEntity->GetAbsOrigin(), pLocal->GetAbsOrigin().y - 170;
  114. break;
  115. }
  116. }
  117. else if (lby_keeps_updating() > 35) {
  118. switch (shots[Globals::TargetID] % 2) {
  119. case 0:
  120. pEntity->GetAbsOrigin(), lby;
  121. break;
  122. case 1:
  123. pEntity->GetAbsOrigin(), pLocal->GetAbsOrigin().y - rand() % 35;
  124. break;
  125. }
  126. }
  127. else if (lby_keeps_updating() > 2.2f) {
  128. static_cast<DWORD>(eyeAngles->y = eyeAngles->y + 180);
  129. }
  130. }
  131. //test
  132. else if (skeet) {
  133. if (lby_keeps_updating() >= 35) {
  134. eyeAngles->y - lby >= lby + 180;
  135. }
  136. }
  137. else
  138. {
  139. switch (Globals::Shots % 3)
  140. {
  141. case 0: *(float*)((DWORD)pEntity + eyeangles) = last_moving_lby[pEntity->GetIndex()] + 90; break;
  142. case 1: *(float*)((DWORD)pEntity + eyeangles) = last_moving_lby[pEntity->GetIndex()] - 90; break;
  143. case 2: *(float*)((DWORD)pEntity + eyeangles) = last_moving_lby[pEntity->GetIndex()] + 180; break;
  144. }
  145. }
  146. }
  147. }
  148. }
  149. void LuigiKMS::FSN(IClientEntity* pEntity, ClientFrameStage_t stage)
  150. {
  151. if (stage == ClientFrameStage_t::FRAME_NET_UPDATE_POSTDATAUPDATE_START)
  152. {
  153. for (int i = 1; i < Interfaces::Engine->GetMaxClients(); i++)
  154. {
  155.  
  156. pEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(i);
  157.  
  158. if (!pEntity || pEntity == hackManager.pLocal() || pEntity->IsDormant() || !pEntity->IsAlive())
  159. continue;
  160.  
  161. LuigiKMS::Resolve();
  162. }
  163. }
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement