ZombieManager: protect item owners

This commit is contained in:
Dogan 2019-11-23 14:25:04 +01:00
parent 6c299cb81e
commit 0f49ba4f01

View File

@ -5,11 +5,14 @@
#include <multicolors>
#include <zombiereloaded>
#include <AFKManager>
#tryinclude <entWatch_core>
bool g_bTestRound;
bool g_bAdminTestRound;
bool g_bMotherZM[MAXPLAYERS + 1] = { false, ...};
bool g_Plugin_entWatch;
int g_iAFKTime;
public Plugin myinfo =
@ -17,7 +20,7 @@ public Plugin myinfo =
name = "Zombie Manager",
author = "Dogan",
description = "Tools to manage testround and zombies",
version = "1.2.0",
version = "1.3.0",
url = ""
};
@ -46,6 +49,23 @@ public void OnPluginStart()
RegConsoleCmd("sm_mzombies", Command_DisplayMotherzombies, "Current Mother Zombies");
}
public void OnAllPluginsLoaded()
{
g_Plugin_entWatch = LibraryExists("entWatch-core");
}
public void OnLibraryAdded(const char[] name)
{
if(StrEqual(name, "entWatch-core"))
g_Plugin_entWatch = true;
}
public void OnLibraryRemoved(const char[] name)
{
if(StrEqual(name, "entWatch-core"))
g_Plugin_entWatch = false;
}
public void OnPluginEnd()
{
RemoveMultiTargetFilter("@mzombie", Filter_Motherzombies);
@ -82,10 +102,16 @@ public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect,
public Action ZR_OnClientMotherZombieEligible(int client)
{
if(GetClientIdleTime(client) > g_iAFKTime || IsFakeClient(client))
return Plugin_Handled;
bool bHasItem;
#if defined entWatch_core_included
if(g_Plugin_entWatch)
bHasItem = EW_ClientHasItem(client);
#endif
return Plugin_Continue;
if(GetClientIdleTime(client) > g_iAFKTime || IsFakeClient(client) || bHasItem)
return Plugin_Handled;
return Plugin_Continue;
}
public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)