Undefined Symbol
#4

Ok, not really sure how well I'll explain this but I'll give it a shot XD

So first, a variable called "winner" is set as -1.

Then this for loop is searching every players variables to see if they have won the lotto.
pawn Код:
new winner = -1; //Winners ID variable
    for(new i; i<MAX_PLAYERS; i++) //checks through all players
    {
        if(!IsPlayerConnected(i)) continue; //Players not connected
        if(GetPVarInt(i, "LottoNumber") == Lnum) winner = i; //If the players number is the winning number
        SetPVarInt(i, "LottoNumber", 0); //Resets the number
    }
So when the loop finds a player that HAS a winning ticket, it will set 'winner' as the player's ID.

So if I'm ID 5 and I won the lotto, 'winner' will be set as 5.

In this case, 'winner' is the same as your 'playerid'.

So the code you had was:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
But because 'winner' is the real ID of the player that won the lotto, we need to replace playerid with 'winner'
pawn Код:
SetPlayerScore(winner, GetPlayerScore(playerid) + 5);
Reply


Messages In This Thread
Undefined Symbol - by RedbullGD - 04.04.2014, 16:52
Re: Undefined Symbol - by EiresJason - 04.04.2014, 17:05
Re: Undefined Symbol - by RedbullGD - 04.04.2014, 17:20
Re: Undefined Symbol - by EiresJason - 04.04.2014, 17:34
Re: Undefined Symbol - by Konstantinos - 04.04.2014, 17:38
Re: Undefined Symbol - by EiresJason - 04.04.2014, 17:46

Forum Jump:


Users browsing this thread: 1 Guest(s)