This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved stop losing hp of victim?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XINLEI
me too
Join Date: Jun 2011
Location: Colombian Coffee storage
Old 08-05-2017 , 18:50   Re: stop losing hp of victim?
Reply With Quote #1

This is done in ZP 5.0:
PHP Code:
// Ham Take Damage Forward
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_alive(attacker))
        return 
HAM_IGNORED;
    
    
// Zombie attacking human...
    
if (zp_core_is_zombie(attacker) && !zp_core_is_zombie(victim))
    {
        
// Ignore damage coming from a HE grenade (bugfix)
        //if (damage_type & DMG_HEGRENADE)
        //    return HAM_HANDLED;
        
        // Does human armor need to be reduced before infecting/damaging?
        
if (!get_pcvar_num(cvar_human_armor_protect))
            return 
HAM_IGNORED;
        
        
// Should armor protect against nemesis attacks?
        
if (LibraryExists(LIBRARY_NEMESISLibType_Library) && !get_pcvar_num(cvar_armor_protect_nemesis) && zp_class_nemesis_get(attacker))
            return 
HAM_IGNORED;
        
        
// Should armor protect survivor too?
        
if (LibraryExists(LIBRARY_SURVIVORLibType_Library) && !get_pcvar_num(cvar_survivor_armor_protect) && zp_class_survivor_get(victim))
            return 
HAM_IGNORED;
        
        
// Get victim armor
        
static Float:armor
        pev
(victimpev_armorvaluearmor)
        
        
// If he has some, block damage and reduce armor instead
        
if (armor 0.0)
        {
            
emit_sound(victimCHAN_BODYg_sound_armor_hit1.0ATTN_NORM0PITCH_NORM)
            
            if (
armor damage 0.0)
                
set_pev(victimpev_armorvaluearmor damage)
            else
                
cs_set_user_armor(victim0CS_ARMOR_NONE)
            
            
// Block damage, but still set the pain shock offset
            
set_pdata_float(victimOFFSET_PAINSHOCK0.5)
            return 
HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED;

XINLEI is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode