Advertisement
Guest User

dsadsa

a guest
Dec 12th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. int AntiAim::LBYUpdate()
  2. {
  3.  
  4.  
  5. static int choked = 0;
  6. static bool wasMoving = true;
  7. static bool firstBreak = false;
  8. static bool preBreak = false;
  9. static bool shouldBreak = false;
  10. static bool brokeThisTick = false;
  11. static bool preBreakNeeded = true;
  12. static float lastLBY = 0;
  13.  
  14. double curtime = g_GlobalVars->curtime; //AimRage::Get().GetTickbase() * g_GlobalVars->interval_per_tick;
  15. bool bIsMoving = false;
  16.  
  17. //if (checks::is_bad_ptr(Animation::Get().GetPlayerAnimationInfo(g_LocalPlayer->EntIndex()).m_playerAnimState))
  18. //use anim state velocity for more accurate result
  19. //bIsMoving = Animation::Get().GetPlayerAnimationInfo(g_LocalPlayer->EntIndex()).m_playerAnimState->m_flVelocity() >= 0.1f;
  20. bIsMoving = g_LocalPlayer->GetPlayerAnimState()->m_flVelocity() >= 0.1f;
  21.  
  22.  
  23. auto nci = g_EngineClient->GetNetChannelInfo();
  24.  
  25. if (g_LocalPlayer->m_flLowerBodyYawTarget() != lastLBY)
  26. {
  27. Global::LastLBYUpdate = curtime;
  28. lastLBY = g_LocalPlayer->m_flLowerBodyYawTarget();
  29. }
  30.  
  31. if (Global::bSendPacket)
  32. {
  33. brokeThisTick = false;
  34. choked = g_ClientState->chokedcommands - Global::prevchoked;
  35.  
  36. if (bIsMoving && (g_LocalPlayer->m_fFlags() & FL_ONGROUND) && !(g_InputSystem->IsButtonDown(g_Options.misc_fakewalk_bind) && g_Options.misc_fakewalk))
  37. {
  38. m_flNextBodyUpdate = curtime + 0.22;
  39. Global::NextLBYUpdate = curtime + 0.22;
  40. wasMoving = true;
  41. firstBreak = true;
  42. }
  43. else
  44. {
  45. if (wasMoving && curtime - Global::LastLBYUpdate >= 0.22)
  46. {
  47. wasMoving = false;
  48. firstBreak = false;
  49. shouldBreak = true;
  50. m_flNextBodyUpdate = curtime + 1.1;
  51. Global::NextLBYUpdate = curtime + 1.1;
  52. }
  53. else if (curtime - Global::LastLBYUpdate >= 1.1 - TICKS_TO_TIME(choked))
  54. {
  55. shouldBreak = true;
  56. firstBreak = false;
  57. m_flNextBodyUpdate = curtime + 1.1;
  58. Global::NextLBYUpdate = curtime + 1.1;
  59. }
  60. else if (curtime - Global::LastLBYUpdate >= 1.1 - (TICKS_TO_TIME(choked) + g_GlobalVars->interval_per_tick * 2) && !firstBreak)
  61. {
  62. preBreak = true;
  63. }
  64. /*
  65. else if (abs(Math::ClampYaw(oldlby - g_LocalPlayer->m_flLowerBodyYawTarget())) > 1 && abs(Math::ClampYaw(m_flLowerBodyTarget - g_LocalPlayer->m_flLowerBodyYawTarget())) > 10)
  66. {
  67. m_flNextBodyUpdate = server_time + g_GlobalVars->interval_per_tick + 1.1;
  68. oldCurtime = server_time + nci->GetLatency(FLOW_INCOMING);
  69. //if (abs(Math::ClampYaw(target_pre - g_LocalPlayer->m_flLowerBodyYawTarget())) < 1) oldCurtime += pre_delay;
  70. m_flNextBodyUpdate = server_time + 1.1;
  71. firstBreak = true;
  72. }
  73. */
  74. }
  75. }
  76. else
  77. {
  78. static float last_last_update = 0;
  79. if (preBreak)
  80. {
  81. preBreak = false;
  82. return 2;
  83. }
  84. else if (shouldBreak)
  85. {
  86. shouldBreak = false;
  87. Global::LastLBYUpdate = curtime;
  88. last_last_update = curtime;
  89. preBreakNeeded = true;
  90. return 1;
  91. }
  92. else
  93. {
  94. if (Global::LastLBYUpdate != last_last_update && abs(Global::LastLBYUpdate - last_last_update) < 1.f)
  95. {
  96. firstBreak = true;
  97. last_last_update = Global::LastLBYUpdate;
  98. }
  99. else if (abs(Math::ClampYaw(GetYaw() - g_LocalPlayer->m_flLowerBodyYawTarget())) < 50)
  100. {
  101. preBreakNeeded = false;
  102. }
  103.  
  104. return 0;
  105. }
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement