Quote:
Originally Posted by Fry!
lol? Did you forget that last human is always killed not infected this is not a cs:source.
|
Quote:
Originally Posted by doroemon
I know,but I want last human can Decrease Armor after Decrease HP...
|
This should work:
PHP Code:
/*================================================================================
[ZP] Addon: Last Human Armor Re-Enabler
Copyright (C) 2009 by meTaLiCroSS, Viņa del Mar, Chile
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
In addition, as a special exception, the author gives permission to
link the code of this program with the Half-Life Game Engine ("HL
Engine") and Modified Game Libraries ("MODs") developed by Valve,
L.L.C ("Valve"). You must obey the GNU General Public License in all
respects for all of the code used other than the HL Engine and MODs
from Valve. If you modify this file, you may extend this exception
to your version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement from your
version.
=================================================================================*/
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <zombieplague>
// Sounds
new const sound_armorhit[] = "player/bhit_helmet-1.wav"
// Cvar pointers
new cvar_lasthumanarmor
// Plug info.
#define PLUG_VERSION "0.1"
#define PLUG_AUTH "meTaLiCroSS"
/*================================================================================
[Init and Precache]
=================================================================================*/
public plugin_init()
{
// Plugin info
register_plugin("[ZP] Addon: Last Human Armor Re-Enabler", PLUG_VERSION, PLUG_AUTH)
// Cvars
cvar_lasthumanarmor = register_cvar("zp_last_human_armor", "1")
static szCvar[30]
formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUG_VERSION, PLUG_AUTH)
register_cvar("zp_addon_lharmor", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
}
public plugin_precache()
{
// Hamsandwich Forwards
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
// Sounds
precache_sound(sound_armorhit)
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
{
// Non-player damage or self damage
if (victim == attacker || !is_user_connected(attacker))
return HAM_IGNORED;
// Does last human armor need to be reduced before infecting?
if (get_pcvar_num(cvar_lasthumanarmor) && zp_get_user_last_human(victim) && !zp_get_user_zombie(victim))
{
// Get victim armor
static Float:flArmor
flArmor = entity_get_float(victim, EV_FL_armorvalue)
// Block the attack if he has some
if (flArmor > 0.0)
{
emit_sound(victim, CHAN_BODY, sound_armorhit, 1.0, ATTN_NORM, 0, PITCH_NORM)
entity_set_float(victim, EV_FL_armorvalue, floatmax(0.0, flArmor - damage))
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED
}
__________________