From 49b1e6eed446d7f4e41615eddda6ebacd5792dda Mon Sep 17 00:00:00 2001 From: zaCade Date: Mon, 3 Dec 2018 16:55:17 +0100 Subject: [PATCH] hlstatsx: update ZE module. Seems the ZR native's require people to actually be alive?? --- hlstatsx/scripting/hlstatsx_ze.sp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/hlstatsx/scripting/hlstatsx_ze.sp b/hlstatsx/scripting/hlstatsx_ze.sp index a14a39e..3998cf4 100644 --- a/hlstatsx/scripting/hlstatsx_ze.sp +++ b/hlstatsx/scripting/hlstatsx_ze.sp @@ -22,6 +22,8 @@ Handle g_tMinimalRoundDuration = INVALID_HANDLE; int g_iKillCount[MAXPLAYERS+1] = 0; /* BOOLEANS */ +bool g_bIsHuman[MAXPLAYERS+1] = false; +bool g_bIsZombie[MAXPLAYERS+1] = false; bool g_bMotherZM[MAXPLAYERS+1] = false; //---------------------------------------------------------------------------------------------------- @@ -93,11 +95,23 @@ public Action OnRoundMinimalDuration(Handle timer) g_tMinimalRoundDuration = INVALID_HANDLE; } +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void ZR_OnClientHumanPost(int client, bool respawn, bool protect) +{ + g_bIsHuman[client] = true; + g_bIsZombie[client] = false; + g_bMotherZM[client] = false; +} + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) { + g_bIsHuman[client] = false; + g_bIsZombie[client] = true; g_bMotherZM[client] = motherInfect; } @@ -113,14 +127,14 @@ public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast { if (IsValidClient(client)) { - if (bAwardHumans && ZR_IsClientHuman(client)) + if (bAwardHumans && g_bIsHuman[client]) { char sPlayerEvent[32]; Format(sPlayerEvent, sizeof(sPlayerEvent), "ze_h_win_%d", g_cvarDifficultyHuman.IntValue); LogPlayerEvent(client, "triggered", sPlayerEvent); } - else if (bAwardZombies && ZR_IsClientZombie(client)) + else if (bAwardZombies && g_bIsZombie[client]) { if (g_bMotherZM[client]) { @@ -179,14 +193,14 @@ public void EndKillStreak(int client) if (g_iKillCount[client] > g_cvarMaximumStreak.IntValue) g_iKillCount[client] = g_cvarMaximumStreak.IntValue; - if (ZR_IsClientHuman(client)) + if (g_bIsHuman[client]) { char sPlayerEvent[32]; Format(sPlayerEvent, sizeof(sPlayerEvent), "ze_h_kill_streak_%d", RoundToFloor(float(g_iKillCount[client]) / float(g_cvarStreakInterval.IntValue)) * g_cvarStreakInterval.IntValue); LogPlayerEvent(client, "triggered", sPlayerEvent); } - else if (ZR_IsClientZombie(client)) + else if (g_bIsZombie[client]) { if (g_bMotherZM[client]) { @@ -213,8 +227,10 @@ public void EndKillStreak(int client) //---------------------------------------------------------------------------------------------------- stock void ResetClient(int client) { + g_bIsHuman[client] = true; + g_bIsZombie[client] = false; + g_bMotherZM[client] = false; g_iKillCount[client] = 0; - g_bMotherZM[client] = false; } //----------------------------------------------------------------------------------------------------