-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventemitter.hpp
84 lines (67 loc) · 2.07 KB
/
eventemitter.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include "valve_sdk/csgostructs.hpp";
#include "cheats/Misc/Misc.hpp"
#include "cheats/Visuals/Visuals.hpp"
#include "menu.hpp"
bool Settings::Misc::Sounds::HitSound::Enabled = false;
int Settings::Misc::Sounds::HitSound::Sound = 0;
static constexpr const char* hitSounds[4]{
"play physics/metal/metal_solid_impact_bullet2",
"play buttons/arena_switch_press_02",
"play training/timer_bell",
"play physics/glass/glass_impact_bullet1"
};
class EventListener : public IGameEventListener2
{
public:
EventListener(std::vector<const char*> events)
{
for (auto& it : events)
g_GameEvents->AddListener(this, it, false);
}
~EventListener()
{
g_GameEvents->RemoveListener(this);
}
void FireGameEvent(IGameEvent * ev)
{
NameStealer::FireGameEvent(ev);
BulletShots(ev);
if (Settings::Misc::Sounds::HitSound::Enabled) {
if (strstr(ev->GetName(), "player_hurt"))
{
C_BasePlayer* attacker = C_BasePlayer::GetPlayerByUserId(ev->GetInt("attacker"));
if (attacker == g_LocalPlayer)
g_EngineClient->ClientCmd_Unrestricted(hitSounds[Settings::Misc::Sounds::HitSound::Sound]);
}
}
if (Settings::Misc::FUCK)
{
if (strstr(ev->GetName(), "player_death"))
{
C_BasePlayer* dead = C_BasePlayer::GetPlayerByUserId(ev->GetInt("userid"));
if (dead == g_LocalPlayer)
g_EngineClient->ClientCmd_Unrestricted("say FUCK");
}
if (strstr(ev->GetName(), "round_end"))
{
int team = ev->GetInt("winner");
if (team != g_LocalPlayer->m_iTeamNum())
g_EngineClient->ClientCmd_Unrestricted("say FUCK");
}
}
if (strstr(ev->GetName(), "game_init") || strstr(ev->GetName(), "game_start") || strstr(ev->GetName(), "round_start") || strstr(ev->GetName(), "game_newmap")) {
ConVar* skyname = g_CVar->FindVar("sv_skyname");
Nightmode::Get().currentSkyName = skyname->GetString();
if (Settings::Visuals::Nightmode::Enabled)
Nightmode::Get().Execute();
if (Settings::Visuals::WorldColour::Enabled)
WorldColour::Execute();
selectedP = -1;
}
}
int GetEventDebugID() override
{
return EVENT_DEBUG_ID_INIT;
}
};