SA-MP Forums Archive
A little question about timers - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A little question about timers (/showthread.php?tid=450063)



A little question about timers - stokdam - 11.07.2013

which of theese is less laggy?

pawn Код:
new timerid[MAX_PLAYERS];
forward function[playerid];

public OnPlayerConnect(playerid)
{
timerid[playerid]=SetTimerEx("Function",150,1,"d",playerid);
return 1;
}

public Function(playerid)
{
//Something here
return 1;
}
pawn Код:
new timerid;
forward Function();

public OnGameModeInit()
{
timerid=SetTimer("Function",150,1);
return 1;
}

public Function()
{
    for (new playerid=0; playerid<MAX_PLAYERS; playerid++)
    {
    //Something here
    }
return 1;
}



Re: A little question about timers - Konstantinos - 11.07.2013

What about in general? I would also like to know if it's better to use timers per player or timers which loop through players (foreach). But not on that kind of interval, just 1000-60000.