diff --git a/PlayerRankings/scripting/PlayerRankings.sp b/PlayerRankings/scripting/PlayerRankings.sp index e79b2c7f..9ca6afb1 100644 --- a/PlayerRankings/scripting/PlayerRankings.sp +++ b/PlayerRankings/scripting/PlayerRankings.sp @@ -44,7 +44,7 @@ public Plugin myinfo = name = "Player Rankings", author = "Neon & zaCade", description = "Show Top Defenders & Infections after each round", - version = "1.0.0" + version = "1.1.0" }; //---------------------------------------------------------------------------------------------------- @@ -88,6 +88,7 @@ public void OnPluginStart() HookEvent("round_end", OnRoundEnding); HookEvent("player_hurt", OnClientHurt); HookEvent("player_spawn", OnClientSpawn); + HookEvent("player_death", OnClientDeath); SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Player Rankings"); } @@ -825,6 +826,26 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo g_iPlayerInfections[attacker] += 1; } +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast) +{ + int killer = GetClientOfUserId(hEvent.GetInt("attacker")); + int victim = GetClientOfUserId(hEvent.GetInt("userid")); + + char weapon[32]; + hEvent.GetString("weapon", weapon, sizeof(weapon)); + + if (killer < 1 || killer > MaxClients || victim < 1 || victim > MaxClients) + return; + + if (killer == victim || (IsPlayerAlive(killer) && ZR_IsClientHuman(killer)) || StrEqual(weapon, "zombie_claws_of_death", true)) + return; + + g_iPlayerInfections[killer] += 1; +} + //---------------------------------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------------------------------