Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. void MissedShots(IGameEvent* pEvent)
  2. {
  3. if (!Fire)
  4. return;
  5.  
  6. if (!g_LocalPlayer)
  7. return;
  8.  
  9. if (!g_LocalPlayer->IsAlive())
  10. return;
  11.  
  12. if (strstr(pEvent->GetName(), "player_hurt"))
  13. {
  14. auto UID = g_EngineClient->GetPlayerForUserID(pEvent->GetInt("attacker"));
  15.  
  16. if (UID == g_LocalPlayer->EntIndex())
  17. Fire = false;
  18. }
  19.  
  20. if (!Fire)
  21. return;
  22.  
  23. if (strstr(pEvent->GetName(), "bullet_impact") && Fire)
  24. {
  25. Vector Position = Vector(pEvent->GetInt("x"), pEvent->GetInt("y"), pEvent->GetInt("z"));
  26. auto UID = g_EngineClient->GetPlayerForUserID(pEvent->GetInt("userid"));
  27.  
  28. if (UID != g_LocalPlayer->EntIndex())
  29. Fire = false;
  30.  
  31. float DmgToPosition = Autowall::GetVecDamage(Position);
  32. int CurrentTarget = ct;
  33.  
  34. if (CurrentTarget < 1 || CurrentTarget > 65)
  35. Fire = false;
  36.  
  37. C_BasePlayer* p = C_BasePlayer::GetPlayerByIndex(CurrentTarget);
  38.  
  39. if (!p || !p->IsPlayer() || !p->IsAlive())
  40. Fire = false;
  41.  
  42. uint8_t LClr[4] = { 0, 128, 255, 255 };
  43. uint8_t TClr[4] = { 255, 255, 255, 255 };
  44.  
  45. if (DmgToPosition > g_Options.rbot_mindamage_visible)
  46. {
  47. bool ResolverMiss = Backtracked[p->EntIndex()] >= std::fabs(p->m_flOldSimulationTime() - p->m_flSimulationTime());
  48. std::string reason = ResolverMiss ? " Resolver" : " Fakelag Fix";
  49.  
  50. g_CVar->ConsoleColorPrintf(TClr, "[");
  51. g_CVar->ConsoleColorPrintf(LClr, "Sharken.pw");
  52. g_CVar->ConsoleColorPrintf(TClr, "] Missed shot due to ");
  53. g_CVar->ConsoleColorPrintf(LClr, reason.c_str());
  54.  
  55. g_Event.Add("Missed shot due to" + reason, Color::White);
  56. }
  57. else
  58. {
  59.  
  60. g_CVar->ConsoleColorPrintf(TClr, "[");
  61. g_CVar->ConsoleColorPrintf(LClr, "Sharken.pw");
  62. g_CVar->ConsoleColorPrintf(TClr, "] Missed shot due to ");
  63. g_CVar->ConsoleColorPrintf(LClr, "Spread");
  64.  
  65. g_Event.Add("Missed shot due to spread", Color::White);
  66. }
  67.  
  68. Fire = false;
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement