Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.59 KB | None | 0 0
  1. namespace LegitBacktracking
  2. {
  3. std::deque<BacktrackingRecord>PlayerRecords[65];
  4. void CM(void)
  5. {
  6. float bestFov = FLT_MAX;
  7. int bestbacktracktarget = -1;
  8. for (int x = 1; x < I::Globals->maxClients; x++)
  9. {
  10. auto Enemy = I::ClientEntList->GetClientEntity(x);
  11. if (!Enemy || Enemy == G::LocalPlayer || !Enemy->IsPlayer() || !Enemy->GetAlive() || Enemy->GetDormant() || Enemy->GetImmune() || Enemy->GetTeam() == G::LocalPlayer->GetTeam())
  12. {
  13. if (PlayerRecords[x].size() > 0)
  14. PlayerRecords[x].clear();
  15.  
  16. continue;
  17. }
  18. while (true)
  19. {
  20. if (PlayerRecords[x].size() > static_cast<size_t>(Vars.Legitbot.Aimbot.Ticks))
  21. {
  22. PlayerRecords[x].pop_back();
  23. }
  24. else
  25. {
  26. break;
  27. }
  28. }
  29. if (PlayerRecords[x].empty() || PlayerRecords[x].front().Tick != G::UserCmd->tick_count)
  30. {
  31.  
  32. matrix3x4_t Matrix[MAXSTUDIOBONES];
  33. if (!Enemy->SetupBones2(Matrix, MAXSTUDIOBONES, BONE_USED_BY_HITBOX, I::Globals->curtime))
  34. {
  35. static auto& enable_bone_cache_invalidation = **reinterpret_cast<bool**>(uint32_t(U::FindPattern("client_panorama.dll", "C6 05 ? ? ? ? ? 89 47 70")) + 2);
  36. const auto old_invalidation = enable_bone_cache_invalidation;
  37. G::EnableBones = Enemy->GetClientSideAnimation() = true;
  38. *(Vector*)((uintptr_t)Enemy + 0xA0) = Enemy->GetOrigin();
  39. *(int*)((uintptr_t)Enemy + 0xA68) = 0;
  40. *(int*)((uintptr_t)Enemy + 0xA30) = 0;
  41. Enemy->SetupBones2(Matrix, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::Globals->curtime);
  42. G::EnableBones = false;
  43. Enemy->UpdateClientSideAnimation();
  44. Enemy->GetClientSideAnimation() = false;
  45. enable_bone_cache_invalidation = old_invalidation;
  46. }
  47. Vector vPoint;
  48. if (Vars.Ragebot.Enabled && G::RageHitBox != -1)
  49. {
  50. vPoint = Enemy->GetHitboxPos(G::RageHitBox, Matrix);
  51. }
  52. else if (Vars.Legitbot.Aimbot.Enabled)
  53. {
  54. vPoint = Enemy->GetHitboxPos(Vars.Legitbot.Aimbot.Hitbox, Matrix);
  55. }
  56. else
  57. {
  58. vPoint = Enemy->GetHitboxPos(HITBOX_HEAD, Matrix);
  59. }
  60. auto CurRecord = BacktrackingRecord(G::UserCmd->tick_count, vPoint, Matrix);
  61. if (CurRecord.ValidTick())
  62. {
  63. PlayerRecords[x].insert(PlayerRecords[x].begin(), CurRecord);
  64. }
  65. QAngle CalcAngled = M::CalcAngle(G::LocalPlayer->GetEyePosition(), vPoint);
  66. CalcAngled -= G::LocalPlayer->GetPunch() * 2.f;
  67. float fov = M::GetFov(G::UserCmd->viewangles, CalcAngled);
  68. if (fov < bestFov)
  69. {
  70. bestFov = fov;
  71. bestbacktracktarget = x;
  72. }
  73. }
  74. }
  75. if (bestbacktracktarget != -1)
  76. {
  77. if (PlayerRecords[bestbacktracktarget].size() > 0)
  78. {
  79. float tempFloat = FLT_MAX;
  80. for (auto tick : PlayerRecords[bestbacktracktarget])
  81. {
  82. QAngle CalcAngled = M::CalcAngle(G::LocalPlayer->GetEyePosition(), tick.Position);
  83. CalcAngled -= G::LocalPlayer->GetPunch() * 2.f;
  84. float fov = M::GetFov(G::UserCmd->viewangles, CalcAngled);
  85. if (fov < tempFloat)
  86. {
  87. tempFloat = fov;
  88. if (G::UserCmd->buttons & IN_ATTACK)
  89. {
  90. G::UserCmd->tick_count = tick.Tick + U::GetLerpTime();
  91. }
  92. }
  93. }
  94. }
  95. }
  96. }
  97. void PT(void)
  98. {
  99. for (int x = 1; x < 65; x++)
  100. {
  101. auto Enemy = I::ClientEntList->GetClientEntity(x);
  102. if (PlayerRecords[x].empty() || !Enemy)
  103. continue;
  104. auto pStudioModel = I::ModelInfo->GetStudioModel(Enemy->GetModel());
  105. if (!pStudioModel)
  106. continue;
  107. if (!G::LocalPlayer->GetAlive())
  108. continue;
  109. if (Enemy == G::LocalPlayer)
  110. continue;
  111. if (!Enemy->IsPlayer())
  112. continue;
  113. if (!Enemy->GetAlive())
  114. continue;
  115. if (Enemy->GetImmune())
  116. continue;
  117. if (Enemy->GetDormant())
  118. continue;
  119. if (Enemy->GetTeam() == G::LocalPlayer->GetTeam())
  120. continue;
  121. for (auto tick : PlayerRecords[x])
  122. {
  123. for (int i = 0; i < pStudioModel->numbones; i++)
  124. {
  125. auto pBone = pStudioModel->GetBone(i);
  126. if (!pBone || !(pBone->flags & 256) || pBone->parent == -1)
  127. continue;
  128. Vector vBonePos1;
  129. if (!M::WorldToScreen(Vector(tick.Matrix[i][0][3], tick.Matrix[i][1][3], tick.Matrix[i][2][3]), vBonePos1))
  130. continue;
  131. Vector vBonePos2;
  132. if (!M::WorldToScreen(Vector(tick.Matrix[pBone->parent][0][3], tick.Matrix[pBone->parent][1][3], tick.Matrix[pBone->parent][2][3]), vBonePos2))
  133. continue;
  134. D::DrawLine((int)vBonePos1.x, (int)vBonePos1.y, (int)vBonePos2.x, (int)vBonePos2.y, Color(0, 255, 255, 24));//12 brightness p
  135. }
  136. }
  137. }
  138. }
  139. }
  140.  
  141. namespace LegitBacktracking2
  142. {
  143. std::deque<BacktrackingRecord2>PlayerRecords2[65];
  144. bool ValidTick2(int tick)
  145. {
  146. float correct = 0.f;
  147. static auto sv_maxunlag = I::Cvar->FindVar("sv_maxunlag");
  148. correct += I::Engine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING);
  149. correct += I::Engine->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
  150. correct += U::GetLerpTime();
  151. correct = U::Clamp(correct, 0.f, sv_maxunlag->GetFloat());
  152. float deltaTime = correct - (I::Globals->curtime - tick);
  153. if (fabsf(deltaTime) > 0.2f)
  154. {
  155. return true;
  156. }
  157. return false;
  158. }
  159. void CM2(void)
  160. {
  161. float bestFov2 = FLT_MAX;
  162. int bestbacktracktarget2 = -1;
  163. for (int x = 1; x < I::Globals->maxClients; x++)
  164. {
  165. auto Enemy2 = I::ClientEntList->GetClientEntity(x);
  166. if (!Enemy2 || Enemy2 == G::LocalPlayer || !Enemy2->IsPlayer() || !Enemy2->GetAlive() || Enemy2->GetDormant() || Enemy2->GetImmune() || Enemy2->GetTeam() == G::LocalPlayer->GetTeam())
  167. {
  168. if (PlayerRecords2[x].size() > 0)
  169. PlayerRecords2[x].clear();
  170.  
  171. continue;
  172. }
  173. while (true)
  174. {
  175. if (PlayerRecords2[x].size() > static_cast<size_t>(Vars.Legitbot.Aimbot.Ticks))
  176. {
  177. PlayerRecords2[x].pop_back();
  178. }
  179. else
  180. {
  181. break;
  182. }
  183. }
  184. if (!PlayerRecords2[x].empty())
  185. {
  186. if (PlayerRecords2[x].front().Tick2 == G::UserCmd->tick_count)
  187. {
  188. continue;
  189. }
  190. }
  191. if (PlayerRecords2[x].size() > 0)
  192. {
  193. for (int tick = 0; tick < PlayerRecords2[x].size(); tick++)
  194. {
  195. if (!ValidTick2(PlayerRecords2[x].at(tick).Tick2))
  196. {
  197. PlayerRecords2[x].erase(PlayerRecords2[x].begin() + tick);
  198. continue;
  199. }
  200. }
  201. }
  202. matrix3x4_t Matrix2[MAXSTUDIOBONES];
  203. static auto& enable_bone_cache_invalidation2 = **reinterpret_cast<bool**>(uint32_t(U::FindPattern("client_panorama.dll", "C6 05 ? ? ? ? ? 89 47 70")) + 2);
  204. const auto old_invalidation2 = enable_bone_cache_invalidation2;
  205. G::EnableBones = Enemy2->GetClientSideAnimation() = true;
  206. *(Vector*)((uintptr_t)Enemy2 + 0xA0) = Enemy2->GetOrigin();
  207. *(int*)((uintptr_t)Enemy2 + 0xA68) = 0;
  208. *(int*)((uintptr_t)Enemy2 + 0xA30) = 0;
  209. Enemy2->SetupBones2(Matrix2, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::Globals->curtime);
  210. G::EnableBones = false;
  211. Enemy2->UpdateClientSideAnimation();
  212. Enemy2->GetClientSideAnimation() = false;
  213. enable_bone_cache_invalidation2 = old_invalidation2;
  214. Vector vPoint2 = Enemy2->GetHitboxPos(HITBOX_HEAD, Matrix2);
  215. auto CurRecord2 = BacktrackingRecord2(G::UserCmd->tick_count, vPoint2, Matrix2);
  216. PlayerRecords2[x].insert(PlayerRecords2[x].begin(), CurRecord2);
  217. QAngle CalcAngled2 = M::CalcAngle(G::LocalPlayer->GetEyePosition(), vPoint2);
  218. CalcAngled2 -= G::LocalPlayer->GetPunch() * 2.f;
  219. float fov2 = M::GetFov(G::UserCmd->viewangles, CalcAngled2);
  220. if (fov2 < bestFov2)
  221. {
  222. bestFov2 = fov2;
  223. bestbacktracktarget2 = x;
  224. }
  225. }
  226. if (bestbacktracktarget2 != -1)
  227. {
  228. if (PlayerRecords2[bestbacktracktarget2].size() > 0)
  229. {
  230. float tempFloat2 = FLT_MAX;
  231. for (auto tick : PlayerRecords2[bestbacktracktarget2])
  232. {
  233. QAngle CalcAngled2 = M::CalcAngle(G::LocalPlayer->GetEyePosition(), tick.Position2);
  234. CalcAngled2 -= G::LocalPlayer->GetPunch() * 2.f;
  235. float fov2 = M::GetFov(G::UserCmd->viewangles, CalcAngled2);
  236. if (fov2 < tempFloat2)
  237. {
  238. tempFloat2 = fov2;
  239. if (G::UserCmd->buttons & IN_ATTACK)
  240. {
  241. G::UserCmd->tick_count = tick.Tick2 + U::GetLerpTime();
  242. }
  243. }
  244. }
  245. }
  246. }
  247. }
  248. void PT2(void)
  249. {
  250. for (int x = 1; x < 65; x++)
  251. {
  252. auto Enemy = I::ClientEntList->GetClientEntity(x);
  253. if (PlayerRecords2[x].empty() || !Enemy)
  254. continue;
  255. auto pStudioModel = I::ModelInfo->GetStudioModel(Enemy->GetModel());
  256. if (!pStudioModel)
  257. continue;
  258. if (!G::LocalPlayer->GetAlive())
  259. continue;
  260. if (Enemy == G::LocalPlayer)
  261. continue;
  262. if (!Enemy->IsPlayer())
  263. continue;
  264. if (!Enemy->GetAlive())
  265. continue;
  266. if (Enemy->GetImmune())
  267. continue;
  268. if (Enemy->GetDormant())
  269. continue;
  270. if (Enemy->GetTeam() == G::LocalPlayer->GetTeam())
  271. continue;
  272. for (auto tick : PlayerRecords2[x])
  273. {
  274. for (int i = 0; i < pStudioModel->numbones; i++)
  275. {
  276. auto pBone = pStudioModel->GetBone(i);
  277. if (!pBone || !(pBone->flags & 256) || pBone->parent == -1)
  278. continue;
  279. Vector vBonePos1;
  280. if (!M::WorldToScreen(Vector(tick.Matrix2[i][0][3], tick.Matrix2[i][1][3], tick.Matrix2[i][2][3]), vBonePos1))
  281. continue;
  282. Vector vBonePos2;
  283. if (!M::WorldToScreen(Vector(tick.Matrix2[pBone->parent][0][3], tick.Matrix2[pBone->parent][1][3], tick.Matrix2[pBone->parent][2][3]), vBonePos2))
  284. continue;
  285. D::DrawLine((int)vBonePos1.x, (int)vBonePos1.y, (int)vBonePos2.x, (int)vBonePos2.y, Color(0, 255, 255, 24));//12 brightness p
  286. }
  287. }
  288. }
  289. }
  290. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement