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