foreach loop preferencing id0 over anyone else?
#1

so I've got a loop in a function on a 300ms timer, the timer gets called, it checks if the player has a Boolean set to true, if it does, it checks some math with their vehicle, now if i'm player 1 and player 0 has the Boolean to false, it works fine. but the second ID0 gets into the loop, it iterates id0 about 15 times before i'm lucky to see myself checked through.

before I post all my lengthy code for all prying eyes to steal my work, does anyone have any idea what could be causing this? Here's the start where it prints off if the player got an iteration done

pawn Код:
public FuncName()
{
    foreach(new i : Player)
    {
        if(!IsPlayerConnected(i)) continue;
        if(!PlayerStats[i][Boolean])
        {
            new str[80];
            format(str,sizeof(str),"THIS GUY WAS FALSE:%i",i);
            SendClientMessageToAll(ORANGE,str);
            continue;
        }
        else
        {
            new str[80];
            format(str,sizeof(str),"DRIFT TICK FOR PLAYERID %i",i);
            SendClientMessageToAll(ORANGE,str);
Код:
[15:15:28] DRIFT TICK FOR PLAYERID 0

[15:15:28] DRIFT TICK FOR PLAYERID 0

[15:15:28] DRIFT TICK FOR PLAYERID 0

[15:15:29] DRIFT TICK FOR PLAYERID 0

[15:15:29] DRIFT TICK FOR PLAYERID 0

[15:15:29] DRIFT TICK FOR PLAYERID 0

[15:15:30] DRIFT TICK FOR PLAYERID 0

[15:15:30] DRIFT TICK FOR PLAYERID 1

[15:15:30] DRIFT TICK FOR PLAYERID 0

[15:15:30] DRIFT TICK FOR PLAYERID 1

[15:15:30] DRIFT TICK FOR PLAYERID 0

[15:15:30] DRIFT TICK FOR PLAYERID 1

[15:15:31] DRIFT TICK FOR PLAYERID 0

[15:15:31] DRIFT TICK FOR PLAYERID 1

[15:15:31] DRIFT TICK FOR PLAYERID 0

[15:15:31] DRIFT TICK FOR PLAYERID 0

[15:15:31] DRIFT TICK FOR PLAYERID 0

[15:15:32] DRIFT TICK FOR PLAYERID 0

[15:15:32] DRIFT TICK FOR PLAYERID 0

[15:15:32] DRIFT TICK FOR PLAYERID 0

[15:15:33] DRIFT TICK FOR PLAYERID 0

[15:15:33] DRIFT TICK FOR PLAYERID 0

[15:15:33] DRIFT TICK FOR PLAYERID 0

[15:15:34] DRIFT TICK FOR PLAYERID 0

[15:15:34] DRIFT TICK FOR PLAYERID 0

[15:15:34] DRIFT TICK FOR PLAYERID 0

[15:15:35] DRIFT TICK FOR PLAYERID 0

[15:15:35] DRIFT TICK FOR PLAYERID 0

[15:15:35] DRIFT TICK FOR PLAYERID 0

[15:15:35] DRIFT TICK FOR PLAYERID 0

[15:15:36] DRIFT TICK FOR PLAYERID 0

[15:15:36] DRIFT TICK FOR PLAYERID 0

[15:15:36] DRIFT TICK FOR PLAYERID 0

[15:15:37] DRIFT TICK FOR PLAYERID 0

[15:15:37] DRIFT TICK FOR PLAYERID 0

[15:15:37] DRIFT TICK FOR PLAYERID 0

[15:15:38] DRIFT TICK FOR PLAYERID 0

[15:15:38] DRIFT TICK FOR PLAYERID 0

[15:15:38] DRIFT TICK FOR PLAYERID 1
I also have Slices timerfix warning me that the function took between 13ms and 60ms on occasion, but it doesn't seem to warn me that it's going higher so I assumed 300ms was a fine limit.
Reply


Messages In This Thread
foreach loop preferencing id0 over anyone else? - by Hoborific - 30.01.2014, 06:09
Re: foreach loop preferencing id0 over anyone else? - by Patrick - 30.01.2014, 06:35
Re: foreach loop preferencing id0 over anyone else? - by Hoborific - 30.01.2014, 06:38
Re: foreach loop preferencing id0 over anyone else? - by Threshold - 30.01.2014, 10:18
Re: foreach loop preferencing id0 over anyone else? - by Hoborific - 30.01.2014, 10:25

Forum Jump:


Users browsing this thread: 2 Guest(s)