SA-MP Forums Archive
Help: error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo" - 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: Help: error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo" (/showthread.php?tid=452087)



Help: error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo" - gnoomen2 - 20.07.2013

I don't know why i get this, so i need your help. After a long break from scripting, i just dont get it :P

This is my enums:

pawn Код:
enum PlayerInfo
{
    pHello
}
new pInfo[MAX_PLAYERS][PlayerInfo];
This is the only "new" line of anything with "PlayerInfo" in.

My Command:

The error is on this line:
pawn Код:
PlayerInfo[playerid][pHello] = 1;
pawn Код:
if (strcmp("/Hello", cmdtext, true, 10) == 0)
    {
        PlayerInfo[playerid][pHello] = 1;
    }
    return 1;
Also, i have always used the zcmd include when making commands, so i am not sure if this is the correct way to use "PlayerInfo" in a command like this. Theres probably a easy way to fix this :P Well thanks for your time!


Re: Help: error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo" - ThePhenix - 20.07.2013

Change to:

PHP код:
pInfo[playerid][pHello] = 1



Re: Help: error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo" - morocco - 20.07.2013

You can use that

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
Change to:

PHP код:
pInfo[playerid][pHello] = 1
or change

pawn Код:
enum PlayerInfo
{
    pHello
}
new pInfo[MAX_PLAYERS][PlayerInfo];
To

pawn Код:
enum pInfo
{
    pHello
}
new PlayerInfo[MAX_PLAYERS][pInfo];