How would i compare a user's origin (checking to see if they haven't moved) within a task.
I have this code....but it isn't working.
PHP Code:
public task_giveHealth(in[])
{
new id = str_to_num(in)
client_print(id, print_chat, "Health Task....")
new now[3], then[3]
get_user_origin(id, now)
if(!healthOrigin[id][0])
{
for(new i = 0; i < 3; i++)
healthOrigin[id][i] = now[i]
}
healthOrigin[id] = then
if(compareOrigin(now, then) && healthGain[id] < 40)
{
client_print(id, print_chat, "Health Given")
new health = get_user_health(id) + 3
set_user_health(id, health)
healthGain[id]+= 3
}
else
remove_task(1)
}
// @RETURNS: 1 if equal; -[index] if not equal
stock compareOrigin(now[3], then[3])
{
if(now[0] != then[0])
return 0
else if(now[1] != then[1])
return -1
else if(now[2] != then[2])
return -2
return 1
}
__________________