16.07.2013, 08:46
So, I've got a loop in which every 5secs it checks wanted level, and lowers it by 1. The thing is, it will only work for the lowest ID having the wanted level, for others it won't.
So for example
ID 0: Wanted level 6 (will go -)
ID 1: Wanted level 6 (will stay 6, but will go - after ID 0 is 0)
Why does this happen?
So for example
ID 0: Wanted level 6 (will go -)
ID 1: Wanted level 6 (will stay 6, but will go - after ID 0 is 0)
Why does this happen?
pawn Код:
public LowerWanted()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerWantedLevel(i) >= 6)
{
SetPlayerWantedLevel(i, 5);
return 1;
}
else if(GetPlayerWantedLevel(i) == 5)
{
SetPlayerWantedLevel(i, 4);
return 1;
}
else if(GetPlayerWantedLevel(i) == 4)
{
SetPlayerWantedLevel(i, 3);
return 1;
}
else if(GetPlayerWantedLevel(i) == 3)
{
SetPlayerWantedLevel(i, 2);
return 1;
}
else if(GetPlayerWantedLevel(i) == 2)
{
SetPlayerWantedLevel(i, 1);
return 1;
}
else if(GetPlayerWantedLevel(i) == 1)
{
SetPlayerWantedLevel(i, 0);
}
}
return 1;
}