Quote:
Originally Posted by RAW_192
If i add this plugin all the players will get hp per kill right?
|
Yes.
Quote:
Originally Posted by RAW_192
I want to add it such as when i call this plugin like /health then it starts working ..
Also how can i limit the max health given to a player?
|
PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < engine >
#define HP_LIMIT 150
const hp_value = 30
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;
}
__________________