AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   True armor (https://forums.alliedmods.net/showthread.php?t=157018)

Doc-Holiday 05-15-2011 05:00

True armor
 
Not sure why but for some reason this works like this. It deducts the right about of armor. but armor hits 0 it dosent start to damage the health.

PHP Code:

public PlayerHurt(vicinfattFloat:dmgdamagebits)
{
    if(
vic == g_iVIPid)
    {
        new 
CsArmorType:iPlayerArmorType;
        new 
Float:armor float(cs_get_user_armor(viciPlayerArmorType));
        new 
Float:new_armor armor dmg;
        
        if(
new_armor <= 0)
        {
            
cs_set_user_armor(vic0CS_ARMOR_NONE);
            
SetHamParamFloat(4dmg armor);
            return 
HAM_SUPERCEDE;
        }
        else
        {
            
cs_set_user_armor(vicfloatround(new_armorfloatround_round), CS_ARMOR_VESTHELM);
            
SetHamParamFloat(40.0);
            return 
HAM_SUPERCEDE;
        }
        
        return 
HAM_IGNORED;
    }



Exolent[jNr] 05-15-2011 05:15

Re: True armor
 
PHP Code:

public PlayerHurt(vicinfattFloat:dmgdamagebits)
{
    if(
vic == g_iVIPid)
    {
        new 
CsArmorType:iPlayerArmorType;
        new 
Float:armor float(get_user_armor(viciPlayerArmorType));
        if(
armor 0)
        {
            new 
Float:new_armor armor dmg;
            
            if(
new_armor 0)
            {
                
cs_set_user_armor(vic0CS_ARMOR_NONE);
                
SetHamParamFloat(4dmg armor);
            }
            else
            {
                
cs_set_user_armor(vicfloatround(new_armorfloatround_round), CS_ARMOR_VESTHELM);
                
SetHamParamFloat(40.0);
            }
            
            return 
HAM_HANDLED;
        }
    }
    return 
HAM_IGNORED;



Doc-Holiday 05-15-2011 05:26

Re: True armor
 
Thanks will try it out. But i left out the cs on cs_get_user_armor on the Float:armor variable.

:)

EDIT: Worked like a charm LOVE YA!!!!


All times are GMT -4. The time now is 04:20.

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