Code:
/*AMXMODX script, made out of pure randomeness*/
#include <amxmodx>
#include <engine>
#include <fun>
public plugin_init()
{
register_plugin("Realregen","1.0","Dave")
register_event("ResetHUD", "HealthOn", "be")
}
public HealthOn(id)
{
set_task(10.0,"Heal",id,"",0,"b")
return PLUGIN_CONTINUE
}
public Heal(id)
{
if(!is_user_alive(id))
{
return PLUGIN_HANDLED
}
new health = get_user_health(id)
if(health>=100)
{
return PLUGIN_HANDLED
}
new speed = get_speed(id)
if(speed>=250)
{
new newhealths = health + 1
set_user_health(id,newhealths)
return PLUGIN_HANDLED
}
if(speed>25 && speed<250)
{
new newhealthm = health + 2
set_user_health(id,newhealthm)
return PLUGIN_HANDLED
}
else
{
new newhealthf = health + 3
set_user_health(id,newhealthf)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
This plugin is made so a certain user gets the set ammount of HP every 10 seconds, depending on movement speed etc. etc.
The problem is, for some reason, when a user dies and respawns, the HP will regain 'TWICE' the speed.
For example,
User 1 gets hit, he receives a regeneration bonus of 3 hp per 10 seconds for standing still (resting)
User 1 dies even with the health regen.
User 1 respawns, plays some more and gets hit again...
He receives a regeneration bonus of 3 hp per 5 seconds for standing still, and 3 hp more after another 5 seconds.
Anyone know how to fix the problem? I tried adding a bool function, but as usual it freaked out on me -.-;
Thanks in advance,
Dave
On a side note, this has no rush at all. I know how to do it so it actually works, but I wanna try stuff this way.
__________________