SA-MP Forums Archive
gTeam[playerid] - undefined symbol? - 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: gTeam[playerid] - undefined symbol? (/showthread.php?tid=457263)



gTeam[playerid] - undefined symbol? - zaider - 10.08.2013

Hello,

I am quite new at scripting and strings are new for me. I am wondering why it says [playerid] is an undefined symbol, when i'm using the same if line at other parts of the script, and it works just fine.

pawn Код:
new gTeam[MAX_PLAYERS]; //At top of the script

forward SendGroveMessage(color, string[]);
public SendGroveMessage(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(gTeam[playerid] == TEAM_GROVE) // LINE 468
            {
                SendClientMessage(i, color, string);
            }
        }
    }
}
pawn Код:
C:\Users\admin\TDM-server\gamemodes\ZTDM.pwn(468) : error 017: undefined symbol "playerid"
I don't want anyone to script it for me, but I would like to understand what's wrong

Thanks in advance!


Respuesta: gTeam[playerid] - undefined symbol? - xeon_inside - 10.08.2013

change if(gTeam[playerid] == TEAM_GROVE) to if(gTeam[i] == TEAM_GROVE)

You're using a loop with "i"


Re: gTeam[playerid] - undefined symbol? - zaider - 10.08.2013

Yeah I just figured out, but thanks anyway! I should probably have browsed the forum better before posting. Repped anyway though!