I'm trying to manipulate the damage absorption towards the armor. I'm going to base it around how Natural Selection Armor system works. (Here's the site about the Armor System in NS
http://www.unknownworlds.com/ns/stat...rmorSystem.htm)
I'm going for a 70% damage absorption with a 50% damage negation. This is my code so far...
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <fun>
public plugin_init()
{
register_plugin("Tester ", "1.0", "Mazza")
RegisterHam(Ham_TakeDamage,"player", "bacon_takedamage")
}
public bacon_takedamage(victim, inflictor, attacker, Float:Damage, damagetype)
{
if(damagetype & DMG_GENERIC || victim == attacker || !is_user_alive(victim) || !is_user_connected(attacker))
return HAM_IGNORED
new CurrentHealth = get_user_health(victim)
new CsArmorType: ArmorType, CurrentArmor = cs_get_user_armor(victim, ArmorType)
if(CurrentArmor)
{
new Float: DamageAbsorption, Float: DamageNegation
DamageAbsorption = CurrentArmor - (Damage * 0.7)
DamageNegation = CurrentHealth - (DamageAbsorption * 0.5)
if(DamageAbsorption < 0)
Damage += CurrentArmor
if(DamageNegation < 0)
Damage += CurrentHealth
cs_set_user_armor(victim, clamp(CurrentArmor, 0, 255), ArmorType)
set_user_health(victim, clamp(CurrentHealth, 0, 255))
SetHamParamFloat(4, Damage)
client_print(attacker, print_chat, "[Test] Damage: %f Armor Damage: %f, Heatlh Damage, %f", Damage, DamageAbsorption, DamageNegation)
}
return HAM_IGNORED
}
__________________