Quote:
Originally Posted by cikjam
tested them both, they both go back to 100
|
I just tested it too and it works fine. Must be something else in your code or another plugin that is causing the problem.
In chat, do the following:
say "blah" - nothing should happen
now injure yourself to any degree besides killing yourself. use a grenade on yourself or something
say "blah" - your health should now be 100
say "blah" - nothing should happen, health still at 100
say "hp" - your health should now go to 110
say "blah" - your health should now go to 255
say "blah" - nothing should happen, health still at 255
PHP Code:
#include <amxmodx>
#include <fun>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "bugsy"
new Float: gfNextHealTime[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd( "say hp" , "hp" );
register_clcmd( "say blah" , "blah" );
}
public hp(id)
{
set_user_health( id , get_user_health( id ) + 10 );
}
public blah( id )
{
if ( get_gametime() >= gfNextHealTime[id] )
{
static iHealth; iHealth = get_user_health( id );
if ( ( iHealth == 100 ) || ( iHealth == 255 ) )
return PLUGIN_HANDLED;
set_user_health( id , ( iHealth < 100 ) ? 100 : 255 );
gfNextHealTime[id] = get_gametime() + 0.5;
}
return PLUGIN_HANDLED;
}
__________________