Hello,
I am doing Basebuilder mod and i have problem with regeneration.
Code:
public plugin_init()
{
RegisterHam(Ham_Spawn, "player", "zaciatok_kola", 1 )
}
Code:
public zaciatok_kola(id)
{
set_task(1.5,"Task_HPRegenLoop",0,_,_,"b")
}
Code:
public Task_HPRegenLoop(id)
{
log_amx("It works") // this is only test that this function is executed.
new addhealth = 10;
if (!addhealth)
return;
if (get_user_health(id) < MaxHP[id] && g_item_reg[id] && cs_get_user_team(id) == CS_TEAM_CT)
{
set_user_health(id, get_user_health(id) + addhealth);
}
else
{
if (get_user_health(id) < MaxHP[id] && g_item_reg[id] && get_user_team(id) & 2)
{
remove_task(id);
}
}
}
it simply does not add healths