From e63bfe7772628bc4b3d091ca8040d3e9a40a971a Mon Sep 17 00:00:00 2001 From: dogan Date: Fri, 7 Aug 2020 19:30:56 +0200 Subject: [PATCH] ZombieManager: minor fixes for mzombie flag --- ZombieManager/scripting/ZombieManager.sp | 28 +++++++++--------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/ZombieManager/scripting/ZombieManager.sp b/ZombieManager/scripting/ZombieManager.sp index 22659456..c877d72d 100644 --- a/ZombieManager/scripting/ZombieManager.sp +++ b/ZombieManager/scripting/ZombieManager.sp @@ -45,7 +45,6 @@ public void OnPluginStart() HookEvent("round_start", OnRoundStart); HookEvent("player_spawn", OnClientSpawn); - HookEvent("player_team", OnPlayerTeam); HookEvent("player_hurt", OnPlayerHurt); ConVar cvar; @@ -203,11 +202,6 @@ public void OnRoundStart(Event hEvent, const char[] sName, bool bDontBroadcast) } } -public void ZR_OnClientHumanPost(int client, bool respawn, bool protect) -{ - g_bMotherZM[client] = false; -} - public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn) { if(g_bTestRound) @@ -235,9 +229,15 @@ public Action ZR_OnClientMotherZombieEligible(int client) public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) { - g_bMotherZM[client] = motherInfect; - g_iZHPMax[client] = GetClientHealth(client); + + if(g_bMotherZM[client]) //Motherzombies that die and respawn + { + g_bMotherZM[client] = true; + return; + } + + g_bMotherZM[client] = motherInfect; } public Action ZR_OnInfectCountdown() @@ -253,14 +253,6 @@ public void OnClientSpawn(Event hEvent, const char[] sName, bool bDontBroadcast) int client = GetClientOfUserId(hEvent.GetInt("userid")); g_iZShield[client] = 0; - g_bMotherZM[client] = false; -} - -public Action OnPlayerTeam(Event event, const char[] name, bool dontBroadcast) -{ - int client = GetClientOfUserId(GetEventInt(event, "userid")); - - g_bMotherZM[client] = false; } public Action OnPlayerHurt(Event event, const char[] name, bool dontBroadcast) @@ -285,7 +277,7 @@ public bool Filter_Motherzombies(const char[] sPattern, Handle hClients, int cli { for(int i = 1; i <= MaxClients; i++) { - if(IsClientInGame(i) && !IsFakeClient(i)) + if(IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(client) == CS_TEAM_T) { if(g_bMotherZM[i]) PushArrayCell(hClients, i); @@ -302,7 +294,7 @@ public Action Command_DisplayMotherzombies(int client, int args) for(int i = 1; i <= MaxClients; i++) { - if(IsClientInGame(i) && !IsFakeClient(i)) + if(IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(client) == CS_TEAM_T) { if(g_bMotherZM[i]) {