From b66e93451c5da1f8b0a347a44b8e6c0364a2aa16 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Wed, 20 Jan 2010 17:48:13 -0800 Subject: [PATCH] Fixed zr_damage_suicide_human not working when enabled. --- src/zr/damage.inc | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/zr/damage.inc b/src/zr/damage.inc index e264db9..7e66334 100644 --- a/src/zr/damage.inc +++ b/src/zr/damage.inc @@ -364,7 +364,7 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama } /** - * Command callback (kill, jointeam, spectate) + * Command callback (kill, spectate, jointeam, joinclass) * Block command if plugin thinks they are trying to commit suicide. * * @param client The client index. @@ -398,31 +398,37 @@ public Action:DamageSuicideIntercept(client, argc) // 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) + // If client is a mother zombie, and suicide intercept is enabled for mother zombies zombies, then block command. + if (g_bDamageMotherZombie[client] && suicidezombiemother) { - return Plugin_Continue; + // Tell client their command has been intercepted, and log. + TranslationPrintToChat(client, "Damage suicide intercept"); + LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client); + + return Plugin_Handled; } - // If client is a mother zombie, and suicide intercept is disabled for mother zombies, then let command go. - if (g_bDamageMotherZombie[client] && !suicidezombiemother) + // If client is a zombie, and suicide intercept is enabled for zombies, then block command. + if (!g_bDamageMotherZombie[client] && suicidezombie) { - return Plugin_Continue; + // Tell client their command has been intercepted, and log. + TranslationPrintToChat(client, "Damage suicide intercept"); + LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client); + + return Plugin_Handled; } } - // If client is a human, and suicide intercept is disabled for humans, then let command go. - if (InfectIsClientHuman(client) && !suicidehuman) + // If client is a human, and suicide intercept is enabled for humans, then block command. + if (InfectIsClientHuman(client) && suicidehuman) { - return Plugin_Continue; + // Tell client their command has been intercepted, and log. + TranslationPrintToChat(client, "Damage suicide intercept"); + LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client); + + return Plugin_Handled; } - // Tell client their command has been intercepted. - TranslationPrintToChat(client, "Damage suicide intercept"); - - // Log suicide interception - LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_Damage, "Suicide Intercept", "Player \"%L\" attempted suicide.", client); - - // Block command. - return Plugin_Handled; + // Allow command. + return Plugin_Continue; }