Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Hurt(IGameEvent* event)
- {
- if (Options.Visuals.VisualsMisc.bHitMarker)
- {
- if (Interfaces.pEngine->GetPlayerForUserID(event->GetInt("attacker")) == Interfaces.pEngine->GetLocalPlayer())
- {
- Global::hitmarkerAlpha = 1.f;
- switch (Options.Visuals.VisualsMisc.iHitsound)
- {
- case 0: break;
- case 1: PlaySoundA(rawData, NULL, SND_ASYNC | SND_MEMORY); break; // Default
- case 2: PlaySoundA(pew, NULL, SND_ASYNC | SND_MEMORY); break; // Anime
- case 3: PlaySoundA(roblox, NULL, SND_ASYNC | SND_MEMORY); break; // Roblox
- case 4: PlaySoundA(hitler_wav, NULL, SND_ASYNC | SND_MEMORY); break; // German
- }
- }
- }
- }
- void HitSound(IGameEvent* event)
- {
- if (Options.Visuals.VisualsMisc.bHitMarker)
- {
- if (Interfaces.pEngine->GetPlayerForUserID(event->GetInt("attacker")) == Interfaces.pEngine->GetLocalPlayer())
- {
- switch (Options.Visuals.VisualsMisc.iKillsound)
- {
- case 0: break;
- case 1: PlaySoundA(rawData, NULL, SND_ASYNC | SND_MEMORY); break; // Default
- case 2: PlaySoundA(pew, NULL, SND_ASYNC | SND_MEMORY); break; // Anime
- case 3: PlaySoundA(roblox, NULL, SND_ASYNC | SND_MEMORY); break; // Roblox
- case 4: PlaySoundA(hitler_wav, NULL, SND_ASYNC | SND_MEMORY); break; // German
- }
- }
- }
- }
- class CGameEventListener : public IGameEventListener2
- {
- private:
- std::string eventName;
- Fucntion Call;
- bool server;
- public:
- CGameEventListener() : eventName(""), Call(nullptr), server(false)
- {
- }
- CGameEventListener(const std::string& gameEventName, const Fucntion Func, bool Server) : eventName(gameEventName), Call(Func), server(Server)
- {
- this->RegListener();
- }
- virtual void FireGameEvent(IGameEvent* event)
- {
- this->Call(event);
- }
- virtual int IndicateEventHandling(void)
- {
- return 0x2A;
- }
- void RegListener(void)
- {
- static bool first = true;
- if (!first)
- return;
- if (Interfaces.g_GameEventMgr->AddListener(this, this->eventName.c_str(), server))
- Hacks.listeners.push_back(this);
- }
- };
- #define REG_EVENT_LISTENER(p, e, n, s) p = new CGameEventListener(n, e, s)
- CGameEventListener* Hurts;
- CGameEventListener* HitSounds;
- void Init()
- {
- REG_EVENT_LISTENER(Hurts, &Hurt, "player_hurt", false);
- REG_EVENT_LISTENER(HitSounds, &HitSound, "player_death", false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement