SA-MP Forums Archive
y_timers for per-player 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: y_timers for per-player timers. (/showthread.php?tid=578421)



y_timers for per-player timers. - b3nz - 19.06.2015

Let's assume I have this code:

pawn Код:
new currentValue [MAX_PLAYERS], Timer:playerTimer[MAX_PLAYERS];

public OnPlayerConnect (playerid)
{
    playerTimer[playerid] = repeat exampleTimer(playerid);

    return (true);
}

timer exampleTimer[1000](playerid)
{
    currentValue [playerid] ++;

    if (currentValue [playerid] == 10)
        stop playerTimer[playerid];

    return (true);
}
Everything seems to be fine, but the line which calls the timer when a player connects gives some errors:

Код:
error 076: syntax error in the expression, or invalid function call
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
So, what is the right syntax? Or the include is not really suitable for per-player timers?


EDIT: fixed, if anybody will need this, make sure you don't have any unnecessary spaces, for example:

pawn Код:
repeat UpdateProgressBarValue(playerid); - this is good.
repeat UpdateProgressBarValue (playerid); - this is wrong