View Single Post
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-29-2009 , 09:42   Re: [HELP]About last human
Reply With Quote #4

Quote:
Originally Posted by Fry! View Post
lol? Did you forget that last human is always killed not infected this is not a cs:source.
Quote:
Originally Posted by doroemon View Post
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_VERSIONPLUG_AUTH)
    
    
// Cvars
    
cvar_lasthumanarmor register_cvar("zp_last_human_armor""1")
    
    static 
szCvar[30]
    
formatex(szCvarcharsmax(szCvar), "v%s by %s"PLUG_VERSIONPLUG_AUTH)
    
register_cvar("zp_addon_lharmor"szCvarFCVAR_SERVER|FCVAR_SPONLY
}

public 
plugin_precache()
{
    
// Hamsandwich Forwards
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
    
// Sounds
    
precache_sound(sound_armorhit)
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_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(victimEV_FL_armorvalue)
        
        
// Block the attack if he has some
        
if (flArmor 0.0)
        {
            
emit_sound(victimCHAN_BODYsound_armorhit1.0ATTN_NORM0PITCH_NORM)
            
entity_set_float(victimEV_FL_armorvaluefloatmax(0.0flArmor damage))
            return 
HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline