y_timers for per-player timers.
#1

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)