Changed default for suicide intercept, also added an option to only block mother zombies.
This commit is contained in:
parent
b4789dc5ef
commit
061954fdc2
@ -324,12 +324,16 @@ zr_damage_block_blast "1"
|
||||
// Suicide Intercept
|
||||
|
||||
// Intercept suicide commands attempted by zombies.
|
||||
// Default: "0"
|
||||
zr_damage_suicide_zombie "0"
|
||||
|
||||
// Intercept suicide commands attempted by mother zombies.
|
||||
// Default: "1"
|
||||
zr_damage_suicide_zombie "1"
|
||||
zr_damage_suicide_mzombie "1"
|
||||
|
||||
// Intercept suicide commands attempted by humans.
|
||||
// Default: "1"
|
||||
zr_damage_suicide_human "1"
|
||||
// Default: "0"
|
||||
zr_damage_suicide_human "0"
|
||||
|
||||
// List of client commands to intercept as suicide attempts. [Delimiter: ", "]
|
||||
// Default: "kill, spectate, jointeam"
|
||||
|
@ -73,6 +73,7 @@ enum CvarsList
|
||||
Handle:CVAR_DAMAGE_BLOCK_FF,
|
||||
Handle:CVAR_DAMAGE_BLOCK_BLAST,
|
||||
Handle:CVAR_DAMAGE_SUICIDE_ZOMBIE,
|
||||
Handle:CVAR_DAMAGE_SUICIDE_MZOMBIE,
|
||||
Handle:CVAR_DAMAGE_SUICIDE_HUMAN,
|
||||
Handle:CVAR_DAMAGE_SUICIDE_CMDS,
|
||||
Handle:CVAR_SAYHOOKS_QUIET,
|
||||
@ -307,8 +308,9 @@ CvarsCreate()
|
||||
g_hCvarsList[CVAR_DAMAGE_BLOCK_BLAST] = CreateConVar("zr_damage_block_blast", "1", "Block blast damage inflicted on self or teammates.");
|
||||
|
||||
// Suicide Intercept
|
||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE] = CreateConVar("zr_damage_suicide_zombie", "1", "Intercept suicide commands attempted by zombies.");
|
||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN] = CreateConVar("zr_damage_suicide_human", "1", "Intercept suicide commands attempted by humans.");
|
||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE] = CreateConVar("zr_damage_suicide_zombie", "0", "Intercept suicide commands attempted by zombies.");
|
||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_MZOMBIE] = CreateConVar("zr_damage_suicide_mzombie", "1", "Intercept suicide commands attempted by mother zombies.");
|
||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN] = CreateConVar("zr_damage_suicide_human", "0", "Intercept suicide commands attempted by humans.");
|
||||
g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam", "List of client commands to intercept as suicide attempts. [Delimiter: \", \"]");
|
||||
|
||||
|
||||
|
@ -48,6 +48,11 @@ new g_iDamageTraceAttackHookID[MAXPLAYERS + 1] = {-1, ...};
|
||||
*/
|
||||
new g_iDamageOnTakeDamageHookID[MAXPLAYERS + 1] = {-1, ...};
|
||||
|
||||
/**
|
||||
* Array to keep track of normal/mother zombies.
|
||||
*/
|
||||
new bool:g_bDamageMotherZombie[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Hook commands related to damage here.
|
||||
*/
|
||||
@ -106,6 +111,18 @@ DamageOnClientDisconnect(client)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A client was infected.
|
||||
*
|
||||
* @param client The client index.
|
||||
* @param motherinfect True if the zombie is mother, false if not.
|
||||
*/
|
||||
DamageOnClientInfected(client, bool:motherinfect)
|
||||
{
|
||||
// Update if client is a mother zombie or not.
|
||||
g_bDamageMotherZombie[client] = motherinfect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook: TraceAttack
|
||||
* Called right before the bullet enters a client.
|
||||
@ -317,18 +334,29 @@ public Action:DamageSuicideIntercept(client, argc)
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
// Get zombie flag on client.
|
||||
new bool:clientzombie = InfectIsClientInfected(client);
|
||||
|
||||
// Get cvar values for suicide interception.
|
||||
new bool:suicidezombie = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE]);
|
||||
new bool:suicidezombiemother = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_SUICIDE_MZOMBIE]);
|
||||
new bool:suicidehuman = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN]);
|
||||
|
||||
// Determine whether to block suicide based off of the client's zombie flag and cvar values.
|
||||
new bool:blocksuicide = clientzombie ? suicidezombie : suicidehuman;
|
||||
// Check if client is a zombie.
|
||||
if (InfectIsClientInfected(client))
|
||||
{
|
||||
// If client is a normal zombie, and suicide intercept is disabled for zombies, then let command go.
|
||||
if (!g_bDamageMotherZombie[client] && !suicidezombie)
|
||||
{
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
// If client is a mother zombie, and suicide intercept is disabled for mother zombies, then let command go.
|
||||
if (g_bDamageMotherZombie[client] && !suicidezombiemother)
|
||||
{
|
||||
return Plugin_Continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If cvar for this team is disabled, then stop.
|
||||
if (!blocksuicide)
|
||||
// If client is a human, and suicide intercept is disabled for humans, then let command go.
|
||||
if (InfectIsClientHuman(client) && !suicidehuman)
|
||||
{
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
@ -669,6 +669,7 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
|
||||
// Forward event to modules.
|
||||
ClassOnClientInfected(client, motherinfect);
|
||||
RoundEndOnClientInfected();
|
||||
DamageOnClientInfected(client, motherinfect);
|
||||
SEffectsOnClientInfected(client);
|
||||
ZTeleOnClientInfected(client);
|
||||
ZHPOnClientInfected(client);
|
||||
|
Loading…
Reference in New Issue
Block a user