sometimes it gives 500 health or more instead of 250 if the user spawn too fast.. How do i fix this?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#define PLUGIN "Bonus Health"
#define VERSION "1.0"
#define AUTHOR "cstrike37"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "Spawn", 1)
}
public Spawn(id)
{
new model[32]
cs_get_user_model(id, model, charsmax(model))
if (equal(model, "gign"))
set_task(1.0, "setbonushp", id)
}
public setbonushp(id)
{
remove_task(0)
set_user_health(id, get_user_health(id) + 250)
}