I'm struggling and i can't seem to make it. I've been trying something like this:
PHP Code:
new Float:gametime[33]
gametime[id] = get_gametime() //When a player buys a potion
and then I've checked like millions of combinations, but nothing seems to work...
PHP Code:
if(get_gametime() > gametime + 20.0)
if(get_gametime() < gametime + 20.0)
if(gametime > get_gametime() + 20.0)
//And so on...
Either the potion never stops working, or it just stops the same second as i buy it...
And when i to do the check as you told me
PHP Code:
public MinorPot(id)
{
id -= 15031
if(gametime[id] - 20.0 < get_gametime())
{
set_user_health(id, get_user_health(id) + 1)
set_task(0.2, "MinorPot", id + 15031)
}
}
This also never stops working. But I've done the math well. If gametime[id] was 2:40 and - 20.0 will make it 2:20, so basically its going to check and should stop for 20 seconds, when gametime[id] and get_gametime is 2:20, and stops working completely after get_gametime goes under 2:20. But the problem is its going to work forever, even after the round ends, until the map is changed...
I'm going to keep trying various combinations until someone answers back with a solution, or when i actually make it by myself
Thanks guys
__________________