ZombieManager: prevent zombies from drowning
This commit is contained in:
parent
92d540b1c8
commit
ea6d2ee85b
@ -3,6 +3,7 @@
|
|||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
|
#include <sdkhooks>
|
||||||
#include <multicolors>
|
#include <multicolors>
|
||||||
#include <zombiereloaded>
|
#include <zombiereloaded>
|
||||||
#include <AFKManager>
|
#include <AFKManager>
|
||||||
@ -22,6 +23,7 @@ Handle g_hZombieSpawnSound = null;
|
|||||||
int g_iZHPMax[MAXPLAYERS + 1];
|
int g_iZHPMax[MAXPLAYERS + 1];
|
||||||
int g_iZShield[MAXPLAYERS + 1];
|
int g_iZShield[MAXPLAYERS + 1];
|
||||||
bool g_bShield;
|
bool g_bShield;
|
||||||
|
bool g_bZombieDrown;
|
||||||
|
|
||||||
bool g_Plugin_entWatch;
|
bool g_Plugin_entWatch;
|
||||||
|
|
||||||
@ -32,7 +34,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 = "3.0.0",
|
version = "3.1.0",
|
||||||
url = ""
|
url = ""
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,13 +52,15 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
HookEvent("round_start", OnRoundStart);
|
HookEvent("round_start", OnRoundStart);
|
||||||
HookEvent("player_spawn", OnClientSpawn);
|
HookEvent("player_spawn", OnClientSpawn);
|
||||||
HookEvent("player_hurt", OnPlayerHurt);
|
HookEvent("player_hurt", OnPlayerHurt, EventHookMode_Pre);
|
||||||
|
|
||||||
ConVar cvar;
|
ConVar cvar;
|
||||||
HookConVarChange((cvar = CreateConVar("sm_player_afk_time", "120", "AFK Time in seconds after which a player won't turn into a motherzombie")), Cvar_AFKTime);
|
HookConVarChange((cvar = CreateConVar("sm_player_afk_time", "120", "AFK Time in seconds after which a player won't turn into a motherzombie")), Cvar_AFKTime);
|
||||||
g_iAFKTime = cvar.IntValue;
|
g_iAFKTime = cvar.IntValue;
|
||||||
HookConVarChange((cvar = CreateConVar("sm_zombieshield", "1", "1 = Zombie Shield activated, 0 = Zombie Shield deactivated", FCVAR_NONE, true, 0.0, true, 1.0)), Cvar_ZombieShield);
|
HookConVarChange((cvar = CreateConVar("sm_zombieshield", "1", "1 = Zombie Shield activated, 0 = Zombie Shield deactivated", FCVAR_NONE, true, 0.0, true, 1.0)), Cvar_ZombieShield);
|
||||||
g_bShield = cvar.BoolValue;
|
g_bShield = cvar.BoolValue;
|
||||||
|
HookConVarChange((cvar = CreateConVar("sm_zombiedrown", "1", "1 = Zombie Drown Protection active, 0 = Zombie Drown Protection not active", FCVAR_NONE, true, 0.0, true, 1.0)), Cvar_ZombieDrown);
|
||||||
|
g_bZombieDrown = cvar.BoolValue;
|
||||||
delete cvar;
|
delete cvar;
|
||||||
|
|
||||||
/*RegConsoleCmd("sm_zhp", OnToggleZHP, "Toggle blocking Zombie HP and Shield display");
|
/*RegConsoleCmd("sm_zhp", OnToggleZHP, "Toggle blocking Zombie HP and Shield display");
|
||||||
@ -73,6 +77,12 @@ public void OnPluginStart()
|
|||||||
AddMultiTargetFilter("@mzombie", Filter_Motherzombies, "Current Mother Zombies", false);
|
AddMultiTargetFilter("@mzombie", Filter_Motherzombies, "Current Mother Zombies", false);
|
||||||
RegConsoleCmd("sm_mzombie", Command_DisplayMotherzombies, "Original + Current Mother Zombies");
|
RegConsoleCmd("sm_mzombie", Command_DisplayMotherzombies, "Original + Current Mother Zombies");
|
||||||
RegConsoleCmd("sm_mzombies", Command_DisplayMotherzombies, "Original + Current Mother Zombies");
|
RegConsoleCmd("sm_mzombies", Command_DisplayMotherzombies, "Original + Current Mother Zombies");
|
||||||
|
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i))
|
||||||
|
OnClientPutInServer(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAllPluginsLoaded()
|
public void OnAllPluginsLoaded()
|
||||||
@ -155,6 +165,11 @@ public void OnClientCookiesCached(int client)
|
|||||||
g_bZombieSpawnSound[client] = false;
|
g_bZombieSpawnSound[client] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnClientPutInServer(int client)
|
||||||
|
{
|
||||||
|
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
|
||||||
|
}
|
||||||
|
|
||||||
public void OnClientDisconnect(int client)
|
public void OnClientDisconnect(int client)
|
||||||
{
|
{
|
||||||
//g_bZHP[client] = false;
|
//g_bZHP[client] = false;
|
||||||
@ -284,6 +299,11 @@ public void Cvar_ZombieShield(ConVar convar, const char[] oldValue, const char[]
|
|||||||
g_bShield = convar.BoolValue;
|
g_bShield = convar.BoolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Cvar_ZombieDrown(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||||
|
{
|
||||||
|
g_bZombieDrown = convar.BoolValue;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
@ -395,6 +415,18 @@ public Action OnPlayerHurt(Event event, const char[] name, bool dontBroadcast)
|
|||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
|
||||||
|
{
|
||||||
|
if(!g_bZombieDrown)
|
||||||
|
return Plugin_Continue;
|
||||||
|
|
||||||
|
if(!ZR_IsClientZombie(victim) || damagetype != DMG_DROWN)//Zombie taking damage from drowning
|
||||||
|
return Plugin_Continue;
|
||||||
|
|
||||||
|
damage = 0.0;
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Filter_Motherzombies(const char[] sPattern, Handle hClients, int client)
|
public bool Filter_Motherzombies(const char[] sPattern, Handle hClients, int client)
|
||||||
{
|
{
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user