ZombieManager: prevent afk motherzombies
This commit is contained in:
parent
27724ad370
commit
2d1617b59a
@ -9,12 +9,14 @@ bool g_bTestRound;
|
|||||||
bool g_bAdminTestRound;
|
bool g_bAdminTestRound;
|
||||||
bool g_bMotherZM[MAXPLAYERS + 1] = { false, ...};
|
bool g_bMotherZM[MAXPLAYERS + 1] = { false, ...};
|
||||||
|
|
||||||
|
int g_iAFKTime;
|
||||||
|
|
||||||
public Plugin myinfo =
|
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.1.0",
|
version = "1.2.0",
|
||||||
url = ""
|
url = ""
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -31,6 +33,11 @@ public void OnPluginStart()
|
|||||||
HookEvent("player_spawn", OnClientSpawn);
|
HookEvent("player_spawn", OnClientSpawn);
|
||||||
HookEvent("player_team", OnPlayerTeam);
|
HookEvent("player_team", OnPlayerTeam);
|
||||||
|
|
||||||
|
ConVar cvar;
|
||||||
|
HookConVarChange((cvar = CreateConVar("sm_player_afk_time", "180", "AFK Time in seconds after which a player won't turn into a motherzombie")), Cvar_AFKTime);
|
||||||
|
g_iAFKTime = cvar.IntValue;
|
||||||
|
delete cvar;
|
||||||
|
|
||||||
AddMultiTargetFilter("@mzombie", Filter_Motherzombies, "Mother Zombies", false);
|
AddMultiTargetFilter("@mzombie", Filter_Motherzombies, "Mother Zombies", false);
|
||||||
RegConsoleCmd("sm_mzombie", Command_DisplayMotherzombies, "Current Mother Zombies");
|
RegConsoleCmd("sm_mzombie", Command_DisplayMotherzombies, "Current Mother Zombies");
|
||||||
}
|
}
|
||||||
@ -40,6 +47,11 @@ public void OnPluginEnd()
|
|||||||
RemoveMultiTargetFilter("@mzombie", Filter_Motherzombies);
|
RemoveMultiTargetFilter("@mzombie", Filter_Motherzombies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Cvar_AFKTime(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||||
|
{
|
||||||
|
g_iAFKTime = convar.IntValue;
|
||||||
|
}
|
||||||
|
|
||||||
public void OnRoundStart(Event hEvent, const char[] sName, bool bDontBroadcast)
|
public void OnRoundStart(Event hEvent, const char[] sName, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
g_bTestRound = false;
|
g_bTestRound = false;
|
||||||
@ -58,7 +70,7 @@ public void ZR_OnClientHumanPost(int client, bool respawn, bool protect)
|
|||||||
|
|
||||||
public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn)
|
public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn)
|
||||||
{
|
{
|
||||||
if(g_bTestRound)
|
if(g_bTestRound || (GetClientIdleTime(client) > g_iAFKTime && motherInfect))
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
|
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user