/* Plugin generated by AMXX-Studio */
#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#define PLUGIN " Real Armor "
#define VERSION " 1.0 "
#define AUTHOR " Silent "
public plugin_init () {
register_plugin( PLUGIN , VERSION , AUTHOR ) ;
RegisterHam ( Ham_TakeDamage , "player" , "Ham_TakeDamagePre" , 0 ) ;
}
public Ham_TakeDamagePre ( this , idinflictor , idattacker , Float:damage , damagebits )
{
new armor = pev ( idinflictor , pev_armorvalue ) ;
if ( armor >= 1 )
{
new diff = armor - floatround ( damage , floatround_round ) ;
if ( diff )
{
new rounddamage = floatround( damage , floatround_round ) ;
set_pev ( idinflictor, pev_armorvalue, armor - rounddamage ) ;
SetHamParamFloat ( 4 , 0.0 ) ;
return HAM_SUPERCEDE ;
}
else
{
set_pev ( idinflictor, pev_armorvalue, 0 ) ;
new adiff = abs ( diff ) ;
new Float:fadiff = float ( adiff ) ;
SetHamParamFloat ( 4 , fadiff ) ;
}
}
return HAM_IGNORED ;
}