I think the easiest way is to determine the damage/reduction values for health and armor (based on a % of damage passed to TakeDamage) and set the users health/armor accordingly and then return HAM_SUPERCEDE so the actual damage passed in HamTakeDamage does not affect the player. The damage passed to TakeDamage, as you probably already know, is total damage without factoring armor so altering the value (SetHamParamFloat()) doesn't give you any control over how it is distributed by the engine (inflicted to hp or armor).
Something like this, untested.
PHP Code:
public fw_HamTakeDamage( iVictim , iInflictor , iAttacker , Float:fDamage , iDmgBits )
{
new iDmgHP = floatround( fDamage * 0.3 );
new iDmgArmor = floatround( ( fDamage * 0.7 ) * 0.5 ); //or 0.35
new iHealth = get_user_health( iVictim );
set_user_armor( iVictim , clamp( get_user_armor( iVictim ) - iDmgArmor , 0 , 100 ) );
( ( iHealth - iDmgHP ) <= 0 ) ? user_kill( iVictim ) : set_user_health( iVictim , iHealth - iDmgHP );
return HAM_SUPERCEDE;
}
or
public fw_HamTakeDamage( iVictim , iInflictor , iAttacker , Float:fDamage , iDmgBits )
{
new iDmgHP = floatround( fDamage * 0.3 );
new iDmgArmor = floatround( ( fDamage * 0.7 ) * 0.5 ); //or 0.35
new iHealth = get_user_health( iVictim );
if ( ( iHealth - iDmgHP ) <= 0 )
{
//enough damage to kill player so a deathmsg is displayed
SetHamParamFloat( 4 , 500.0 );
return HAM_HANDLED;
}
else
{
set_user_health( iVictim , iHealth - iDmgHP );
set_user_armor( iVictim , clamp( get_user_armor( iVictim ) - iDmgArmor , 0 , 100 ) );
return HAM_SUPERCEDE;
}
}
__________________