Advertisement
weebwaredotnet

21321321321

Sep 20th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. void Hurt(IGameEvent* event)
  2. {
  3. if (Options.Visuals.VisualsMisc.bHitMarker)
  4. {
  5. if (Interfaces.pEngine->GetPlayerForUserID(event->GetInt("attacker")) == Interfaces.pEngine->GetLocalPlayer())
  6. {
  7. Global::hitmarkerAlpha = 1.f;
  8. switch (Options.Visuals.VisualsMisc.iHitsound)
  9. {
  10. case 0: break;
  11. case 1: PlaySoundA(rawData, NULL, SND_ASYNC | SND_MEMORY); break; // Default
  12. case 2: PlaySoundA(pew, NULL, SND_ASYNC | SND_MEMORY); break; // Anime
  13. case 3: PlaySoundA(roblox, NULL, SND_ASYNC | SND_MEMORY); break; // Roblox
  14. case 4: PlaySoundA(hitler_wav, NULL, SND_ASYNC | SND_MEMORY); break; // German
  15. }
  16.  
  17. }
  18. }
  19. }
  20.  
  21. void HitSound(IGameEvent* event)
  22. {
  23. if (Options.Visuals.VisualsMisc.bHitMarker)
  24. {
  25. if (Interfaces.pEngine->GetPlayerForUserID(event->GetInt("attacker")) == Interfaces.pEngine->GetLocalPlayer())
  26. {
  27. switch (Options.Visuals.VisualsMisc.iKillsound)
  28. {
  29. case 0: break;
  30. case 1: PlaySoundA(rawData, NULL, SND_ASYNC | SND_MEMORY); break; // Default
  31. case 2: PlaySoundA(pew, NULL, SND_ASYNC | SND_MEMORY); break; // Anime
  32. case 3: PlaySoundA(roblox, NULL, SND_ASYNC | SND_MEMORY); break; // Roblox
  33. case 4: PlaySoundA(hitler_wav, NULL, SND_ASYNC | SND_MEMORY); break; // German
  34. }
  35. }
  36. }
  37. }
  38.  
  39. class CGameEventListener : public IGameEventListener2
  40. {
  41. private:
  42. std::string eventName;
  43. Fucntion Call;
  44. bool server;
  45.  
  46. public:
  47. CGameEventListener() : eventName(""), Call(nullptr), server(false)
  48. {
  49. }
  50.  
  51. CGameEventListener(const std::string& gameEventName, const Fucntion Func, bool Server) : eventName(gameEventName), Call(Func), server(Server)
  52. {
  53. this->RegListener();
  54. }
  55.  
  56. virtual void FireGameEvent(IGameEvent* event)
  57. {
  58. this->Call(event);
  59. }
  60.  
  61. virtual int IndicateEventHandling(void)
  62. {
  63. return 0x2A;
  64. }
  65.  
  66. void RegListener(void)
  67. {
  68. static bool first = true;
  69. if (!first)
  70. return;
  71. if (Interfaces.g_GameEventMgr->AddListener(this, this->eventName.c_str(), server))
  72. Hacks.listeners.push_back(this);
  73. }
  74. };
  75.  
  76. #define REG_EVENT_LISTENER(p, e, n, s) p = new CGameEventListener(n, e, s)
  77. CGameEventListener* Hurts;
  78. CGameEventListener* HitSounds;
  79. void Init()
  80. {
  81. REG_EVENT_LISTENER(Hurts, &Hurt, "player_hurt", false);
  82. REG_EVENT_LISTENER(HitSounds, &HitSound, "player_death", false);
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement