@@ -42,6 +42,41 @@ void scripting_OnClientDisconnect(const OnClientDisconnect *e)
4242 }
4343}
4444
45+ void scripting_PlayerDeath (const PlayerDeath *e)
46+ {
47+ CPlayerSlot slot = e->pEvent ->GetPlayerSlot (" userid" );
48+ CPlayerSlot attacker = e->pEvent ->GetPlayerSlot (" attacker" );
49+ CPlayerSlot assister = e->pEvent ->GetPlayerSlot (" assister" );
50+ bool assistedflash = e->pEvent ->GetBool (" assistedflash" );
51+ std::string weapon = e->pEvent ->GetString (" weapon" );
52+ bool headshot = e->pEvent ->GetBool (" headshot" );
53+ short dominated = e->pEvent ->GetInt (" dominated" );
54+ short revenge = e->pEvent ->GetInt (" revenge" );
55+ short wipe = e->pEvent ->GetInt (" wipe" );
56+ short penetrated = e->pEvent ->GetInt (" penetrated" );
57+ bool noreplay = e->pEvent ->GetBool (" noreplay" );
58+ bool noscope = e->pEvent ->GetBool (" noscope" );
59+ bool thrusmoke = e->pEvent ->GetBool (" thrusmoke" );
60+ bool attackerblind = e->pEvent ->GetBool (" attackerblind" );
61+ float distance = e->pEvent ->GetFloat (" distance" );
62+ short dmg_health = e->pEvent ->GetInt (" dmg_health" );
63+ short dmg_armor = e->pEvent ->GetInt (" dmg_armor" );
64+ short hitgroup = e->pEvent ->GetInt (" hitgroup" );
65+
66+ for (uint32 i = 0 ; i < plugins.size (); i++)
67+ {
68+ Plugin *plugin = plugins[i];
69+ if (plugin->IsPluginLoaded ())
70+ {
71+ void *plugin_OnPlayerDeath = plugin->FetchFunction (" Internal_OnPlayerDeath" );
72+ if (plugin_OnPlayerDeath)
73+ {
74+ reinterpret_cast <Plugin_OnPlayerDeath>(plugin_OnPlayerDeath)(slot.Get (), attacker.Get (), assister.Get (), assistedflash, weapon.c_str (), headshot, dominated, revenge, wipe, penetrated, noreplay, noscope, thrusmoke, attackerblind, distance, dmg_health, dmg_armor, hitgroup);
75+ }
76+ }
77+ }
78+ }
79+
4580void scripting_OnClientSpawn (const OnPlayerSpawn *e)
4681{
4782 CBasePlayerController *controller = (CBasePlayerController *)e->pEvent ->GetPlayerController (" userid" );
@@ -522,6 +557,7 @@ void PluginsComponent::RegisterGameEvents()
522557 gameevents::on<BombExploded>(scripting_BombExploded);
523558 gameevents::on<BombDropped>(scripting_BombDropped);
524559 gameevents::on<BombPickup>(scripting_BombPickup);
560+ gameevents::on<PlayerDeath>(scripting_PlayerDeath);
525561
526562 hooks::on<OnMapLoad>(scripting_OnMapLoad);
527563 hooks::on<OnMapUnload>(scripting_OnMapUnload);
0 commit comments