Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.53 KB | None | 0 0
  1. if (!c_config::get().aimbot_resolver)
  2. return;
  3.  
  4. auto local_player = Globals::LocalPlayer;
  5.  
  6. if (!local_player)
  7. return;
  8.  
  9. if (!player)
  10. return;
  11.  
  12. if (player->GetTeam() == Globals::LocalPlayer->GetTeam())
  13. return;
  14.  
  15. bool is_local_player = player == local_player;
  16. bool is_teammate = local_player->GetTeam() == player->GetTeam() && !is_local_player;
  17.  
  18. if (is_local_player)
  19. return;
  20.  
  21. if (is_teammate)
  22. return;
  23.  
  24. if (player->GetHealth() <= 0)
  25. return;
  26.  
  27.  
  28. if (local_player->GetHealth() <= 0)
  29. return;
  30.  
  31. auto idx = player->EntIndex();
  32. auto state = player->GetBasePlayerAnimState();
  33. auto lby = player->GetLowerBodyYaw();
  34. static float oldSimtimeShot[65];
  35. static float storedSimtimeShot[65];
  36. static float OldStoredLby[65];
  37. static float StoredLby[65];
  38. static float ShotTime[65];
  39. bool shot = false;
  40.  
  41. bool ShotCounterWithFalseAndTrue;
  42. bool CounterSHot;
  43. static bool jittering[65];
  44. static float oldSimtime[65];
  45. static float storedSimtime[65];
  46. static float SideTime[65][3];
  47. static int LastDesyncSide[65];
  48. static bool Delaying[1];
  49. static AnimationLayer StoredLayers[64][30];//15
  50. static C_AnimState * StoredAnimState[65];
  51. static float StoredPosParams[65][48];//24
  52. static Vector oldEyeAngles[65];
  53. static float oldGoalfeetYaw[65];
  54. float* PosParams = (float*)((uintptr_t)player + 0x2774);
  55. bool update = false;
  56. auto player_animation_state = player->AnimState();
  57.  
  58. auto RemapVal = [](float val, float A, float B, float C, float D) -> float
  59. {
  60. if (A == B)
  61. return val >= B ? D : C;
  62. return C + (D - C) * (val - A) / (B - A);
  63. };
  64.  
  65. resolver_record _player[64];
  66. auto& record = _player[idx];
  67.  
  68. if (state)
  69. {
  70. state->m_flEyeYaw = player->GetEyeAnglesXY()->y;
  71. state->m_flEyePitch = player->GetEyeAnglesXY()->x;
  72. player->setAnimationState(state);
  73. }
  74.  
  75. if (state && state->speed_2d > 0.1f || fabs(state->flUpVelocity) > 100.0f)
  76. {
  77. state->m_flGoalFeetYaw = approach_angle(state->m_flEyeYaw, state->m_flGoalFeetYaw,
  78. ((state->m_flUnknownFraction * 20.0f) + 30.0f) * state->m_flLastClientSideAnimationUpdateTime);
  79. player->setAnimationState(state);
  80. }
  81. else
  82. {
  83. if (state)
  84. {
  85. state->m_flGoalFeetYaw = approach_angle(lby, state->m_flGoalFeetYaw,
  86. state->m_flLastClientSideAnimationUpdateTime * 100.0f);
  87. player->setAnimationState(state);
  88. }
  89. }
  90.  
  91. record.current_tick.eyes = player->GetEyeAnglesXY()->y;
  92.  
  93. if (record.current_tick.last_lby == FLT_MAX)
  94. {
  95. record.current_tick.last_lby = lby;
  96. }
  97.  
  98. bool one = false;
  99. bool two = false;
  100.  
  101. record.current_tick.lby_delta = record.current_tick.last_lby - lby;
  102. record.current_tick.eye_lby_delta = lby - record.current_tick.eyes;
  103.  
  104. if (record.current_tick.last_lby != FLT_MAX)
  105. {
  106.  
  107. if (record.current_tick.last_lby == 979) // the current layer must be triggering 979
  108. {
  109. if (record.current_tick.lby_delta == 979) // the previous layer must be trigerring 979
  110. {
  111. // we can tell now that he is surely breaking lby in some sort
  112.  
  113. if (record.current_tick.last_lby != record.current_tick.lby_delta)
  114. {
  115. float
  116. flAnimTime = record.current_tick.lby_delta,
  117. flSimTime = player->GetSimulationTime();
  118.  
  119.  
  120. record.current_tick.last_lby = player->GetLowerBodyYaw() - 180.f; // for the resolver it's enough here to just flip him, because we will backtrack him
  121. }
  122. else if (player->GetVelocity().Length2D() > 0.1f) // breaking lby with delta < 120; can fakewalk here aswell
  123. {
  124. if (record.current_tick.last_lby != lby)
  125. record.current_tick.last_lby = lby;
  126.  
  127. one = false, two = false;
  128. }
  129. }
  130. }
  131. else
  132. {
  133. record.current_tick.lby_delta = record.current_tick.last_lby - lby;
  134.  
  135.  
  136. if (record.current_tick.last_lby != lby)
  137. {
  138. if (solve_desync_simple(player))
  139. {
  140. if (delta_58(record.current_tick.last_lby, lby))
  141. {
  142. record.current_tick.low_delta = true;
  143. record.current_tick.high_delta = false;
  144. }
  145. else
  146. {
  147. record.current_tick.low_delta = false;
  148. record.current_tick.high_delta = true;
  149. }
  150.  
  151. if (delta_58(lby, record.current_tick.eyes) && delta_58(record.current_tick.last_lby, record.current_tick.eyes))
  152. {
  153. if (!one || !two)
  154. record.current_tick.jitter_desync = false;
  155.  
  156. if (one && two)
  157. record.current_tick.jitter_desync = true;
  158. }
  159.  
  160. if (record.current_tick.low_delta && !delta_58(record.current_tick.last_lby, record.current_tick.eyes))
  161. {
  162. if (!one)
  163. one = true;
  164.  
  165. if (!two && one)
  166. two = true;
  167.  
  168. if (one && two)
  169. record.current_tick.jitter_desync = true;
  170. }
  171.  
  172. // else
  173. // record.current_tick.low_delta = true;
  174. }
  175. else
  176. record.current_tick.static_desync = true;
  177. }
  178. else
  179. {
  180. if (!solve_desync_simple(player))
  181. {
  182. one = false, two = false;
  183.  
  184. record.current_tick.static_desync = true;
  185. record.current_tick.jitter_desync = false;
  186.  
  187. }
  188. else
  189. {
  190. if (!delta_58(record.current_tick.last_lby, record.current_tick.eyes))
  191. {
  192. record.current_tick.low_delta = false;
  193. record.current_tick.high_delta = true;
  194. record.current_tick.jitter_desync = true;
  195. }
  196. else
  197. {
  198. record.current_tick.low_delta = true;
  199. record.current_tick.high_delta = false;
  200. record.current_tick.jitter_desync = true;
  201. }
  202. }
  203. }
  204.  
  205. }
  206. }
  207. auto slow_walking = [&player]() -> bool
  208. {
  209. bool s = g_Resolver.enemy_is_slow_walking(player);
  210.  
  211. if (s)
  212. {
  213. if (!(player->GetFlags() & FL_DUCKING))
  214. {
  215. g_Resolver.enemy_slowwalk = true;
  216. return true;
  217. }
  218. else
  219. {
  220. g_Resolver.enemy_slowwalk = false;
  221. return false;
  222. }
  223. }
  224. else
  225. return false;
  226. };
  227. if (slow_walking() && Globals::MissedShots[player->EntIndex()] >= 1)
  228. {
  229. Globals::enemyslow[player->EntIndex()] = true;
  230. }
  231. auto max_rotate = max_desync_angle(player);
  232. auto delta = angle_difference(player->GetEyeAnglesXY()->y, player->AnimState()->m_flCurrentFeetYaw);
  233.  
  234.  
  235. if (record.current_tick.low_delta && !record.current_tick.jitter_desync && record.current_tick.lby_delta < 58.f)
  236. {
  237. player->GetEyeAnglesXY()->y = record.current_tick.last_lby;
  238. Globals::rmode[player->EntIndex()] = 4;
  239. }
  240.  
  241. else if (record.current_tick.jitter_desync && (!record.current_tick.high_delta || record.current_tick.low_delta))
  242. {
  243. // record.current_tick.eye_lby_delta
  244.  
  245. player->GetEyeAnglesXY()->y = lby + (-record.current_tick.eye_lby_delta);
  246. Globals::rmode[player->EntIndex()] = 5;
  247. }
  248.  
  249. else if (record.current_tick.jitter_desync && record.current_tick.high_delta)
  250. {
  251. player->GetEyeAnglesXY()->y = record.current_tick.last_lby;
  252. Globals::rmode[player->EntIndex()] = 6;
  253. }
  254.  
  255. else if (record.current_tick.low_delta && record.current_tick.jitter_desync)
  256. {
  257. player->GetEyeAnglesXY()->y = lby - record.current_tick.lby_delta;
  258. Globals::rmode[player->EntIndex()] = 7;
  259. }
  260.  
  261. else
  262. {
  263.  
  264. const auto player_animation_state = player->AnimState();
  265.  
  266. if (!player_animation_state)
  267. return;
  268.  
  269. float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
  270.  
  271. auto v48 = 0.f;
  272.  
  273. if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  274. {
  275. v48 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 1.0f);
  276. }
  277. else
  278. {
  279. v48 = 0.0f;
  280. }
  281.  
  282. float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
  283.  
  284. float flYawModifier = v49 + 1.0;
  285.  
  286. if (player_animation_state->m_fDuckAmount > 0.0)
  287. {
  288. float v53 = 0.0f;
  289.  
  290. if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  291. {
  292. v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  293. }
  294. else
  295. {
  296. v53 = 0.0f;
  297. }
  298. }
  299.  
  300. float flMaxYawModifier = player_animation_state->pad10[516] * flYawModifier;
  301. float flMinYawModifier = player_animation_state->pad10[512] * flYawModifier;
  302.  
  303. float newFeetYaw = 0.f;
  304.  
  305. auto eyeYaw = player_animation_state->m_flEyeYaw;
  306.  
  307. auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
  308.  
  309. float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  310.  
  311. if (eye_feet_delta <= flMaxYawModifier)
  312. {
  313. if (flMinYawModifier > eye_feet_delta)
  314. {
  315. newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  316. }
  317. }
  318. else
  319. {
  320. newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  321. }
  322.  
  323. float v136 = fmod(newFeetYaw, 360.0);
  324.  
  325. if (v136 > 180.0)
  326. {
  327. v136 = v136 - 360.0;
  328. }
  329.  
  330. if (v136 < 180.0)
  331. {
  332. v136 = v136 + 360.0;
  333. }
  334.  
  335. player_animation_state->m_flGoalFeetYaw = v136;
  336.  
  337. }
  338.  
  339. float DesyncFix = 0;
  340. float Resim = 0;
  341. for (size_t i = 0; i < player->NumOverlays(); i++)
  342. {
  343. auto layer = player->get_anim_overlay_index(i);
  344. if (!layer)
  345. continue;
  346.  
  347. if (player->get_sequence_act(layer->m_nSequence) == 979)
  348. {
  349. if (layer->m_flCycle != layer->m_flPrevCycle) {
  350.  
  351. float Brute = player->GetLowerBodyYaw();
  352.  
  353. float Delta = NormalizeYaw180(NormalizeYaw180(Brute - NormalizeYaw180(NormalizeYaw180(player_animation_state->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60))) + Resim));
  354.  
  355. if (Delta > 58.f)
  356. Delta = randomintcalc;
  357. if (Delta < -58.f)
  358. Delta = -randomintcalc;
  359.  
  360. Resim += Delta;
  361. DesyncFix += Delta;
  362. }
  363. }
  364. }
  365.  
  366.  
  367. float Equalized = NormalizeYaw180(NormalizeYaw180(player_animation_state->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -58, 58)) + Resim);
  368.  
  369. float JitterDelta = fabs(NormalizeYaw180(oldEyeAngles[player->EntIndex()].y - player->GetEyeAngles().y));
  370.  
  371. if (JitterDelta >= 70.f && !shot)
  372. jittering[player->EntIndex()] = true;
  373.  
  374. if (player != Globals::LocalPlayer && player->GetTeam() != Globals::LocalPlayer->GetTeam() && (player->GetFlags() & FL_ONGROUND) && c_config::get().aimbot_resolver)
  375. {
  376. if (jittering[player->EntIndex()])
  377. player_animation_state->m_flGoalFeetYaw = NormalizeYaw180(player->GetEyeAngles().y + DesyncFix);
  378. else
  379. player_animation_state->m_flGoalFeetYaw = Equalized;
  380.  
  381. player->SetLowerBodyYaw(player_animation_state->m_flGoalFeetYaw);
  382. }
  383.  
  384. StoredAnimState[player->EntIndex()] = player_animation_state;
  385.  
  386. oldEyeAngles[player->EntIndex()] = player->GetEyeAngles();
  387.  
  388. oldSimtime[player->EntIndex()] = storedSimtime[player->EntIndex()];
  389.  
  390. storedSimtime[player->EntIndex()] = player->GetSimulationTime();
  391.  
  392. update = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement