So, I want to make a plugin where the armor is depleted before health in cs 1.6. I have made this:
PHP Code:
#include <amxmodx>
#include <csx>
#include <fun>
public plugin_init()
{
register_plugin("Deplete armor before health", "1.0", "Jelle")
}
public client_damage(attacker, victim, damage)
{
client_print(victim, print_chat, "client_damage forward has run")
//if damage is bigger than armor
new armor = get_user_armor(victim)
if ( damage > armor )
{
client_print(victim, print_chat, "Damage is now bigger than armor")
//first calculate how much life to deplete
new depleteHealth = damage - armor
//set armor to 0
set_user_armor(victim, 0)
//then deplete the life
set_user_health(victim, get_user_health(victim) - depleteHealth)
}
//if armor is bigger than damage
else if ( armor > damage )
{
client_print(victim, print_chat, "Damage is now lower than armor")
//deplete armor with the damage taken
set_user_armor(victim, armor - damage)
//remember to give the health back
set_user_health(victim, get_user_health(victim) + damage)
}
//any other case
else
{
//do nothing
return
}
}
The reason why I am asking here is because it works very well for me (not on fall damage since client_damage doesn't run on fall damage apparently), but the bots I am playing with on my server, they just die instantly once I shoot them. Is this just a problem with the bots or my code?
As you can see I have added a few client_print for debugging (I forgot get_user_health() in set_user_health so it would set the damage as health).
Anyone?
__________________