Try something like this.
PHP Code:
#include < amxmodx >
#include < engine >
#include < fakemeta >
const Float:INTERVAL = 2.0; // every 2 seconds
const HEAL = 2; // +2 hp each heal
const m_flDelay = 34;
new g_iTriggerHurt;
public plugin_init( ) {
register_plugin( "Auto Healer", "1.0", "xPaw" );
new iEntity = create_entity( "trigger_hurt" );
if( is_valid_ent( iEntity ) ) {
new szDamage[ 16 ];
num_to_str( ( HEAL * -1 ), szDamage, 15 );
DispatchKeyValue( iEntity, "classname", "trigger_hurt" );
DispatchKeyValue( iEntity, "damagetype", "1024" );
DispatchKeyValue( iEntity, "dmg", szDamage );
DispatchKeyValue( iEntity, "origin", "0 0 0" );
DispatchSpawn( iEntity );
entity_set_size( iEntity, Float:{ -4096.0, -4096.0, -4096.0 }, Float:{ 4096.0, 4096.0, 4096.0 } );
entity_set_int( iEntity, EV_INT_solid, SOLID_TRIGGER );
g_iTriggerHurt = iEntity;
register_touch( "player", "trigger_hurt", "FwdPlayerHurt" );
}
}
public FwdPlayerHurt( client, iEntity ) {
if( iEntity == g_iTriggerHurt ) {
set_pdata_float( iEntity, m_flDelay, get_gametime( ) + INTERVAL );
}
}
__________________