What did I do wrong?
#1

pawn Код:
public OnPlayerText(playerid, text[])
{
    if (strval(text) == MathQuizAnswer && MathQuizAnswer != -1)
    {
        MathQuizAnswered = 1;
        MathQuizAnswer = -1;
        SetTimer("MessageDelay", 500, false);
    }
    return 1;
}

forward MessageDelay(playerid);
public MessageDelay(playerid)
{
    new randomprice = 2500 + (random(10) * 500);
    new string[64+MAX_PLAYER_NAME+1];
    new name[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s has answered the Math Quiz correctly and has won %d$!", name, randomprice);
    SendClientMessageToAll(COLOR_LIGHTBLUE, string);
    print(string);
    GivePlayerMoney(playerid, randomprice);
    PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] + randomprice;
}
When I answered it, it said another player had won the quiz (who didn't even answer anything).
What did I do wrong?
Reply
#2

You're using a global timer (without parameters) on a function which needs input parameters.

Use SetTimerEx instead to put the needed parameters (playerid).
Reply
#3

Thanks, that fixed it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)