Quote:
Originally Posted by edon1337
Yes.
PHP Code:
#include < amxmodx > #include < hamsandwich > #include < engine >
#define HP_LIMIT 150.0
const Float:hp_value = 30.0
new bool:g_Enabled[ 33 ];
public plugin_init( ) {
register_plugin( "Extra HP", "1.0", "DoNii" );
register_clcmd( "say /health", "enable_plugin" );
RegisterHam( Ham_Killed, "player", "fw_HamKilledPost", 1 ); }
public enable_plugin(id) {
g_Enabled[ id ] = true }
public fw_HamKilledPost( victim, attacker, shouldgib ) {
if( g_Enabled[ attacker ] ) {
new Float:health = entity_get_float( attacker, EV_FL_health )
if( health > HP_LIMIT ) { return HAM_IGNORED; } entity_set_float( attacker, EV_FL_health, health + hp_value ) }
return HAM_IGNORED; }
|
Attacker health can be more than the limit
Check again
PHP Code:
if( g_Enabled[ attacker ] ) {
new Float:health = entity_get_float( attacker, EV_FL_health ) + hp_value
if( health > HP_LIMIT ) {
health = HP_LIMIT
}
entity_set_float( attacker, EV_FL_health, health)
}
__________________