SA-MP Forums Archive
invalid subscript - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: invalid subscript (/showthread.php?tid=265926)



invalid subscript - willsuckformoney - 03.07.2011

This my first time seeing this error so I don't know how to fix it. If anyone knows how to fix it would please post so I can get past this error and continue scripting?

Код:
error 028: invalid subscript (not an array or too many subscripts): "Pet"



Re: invalid subscript - Laronic - 03.07.2011

Im not really sure, but you maybe did some thing like

pawn Код:
PlayerInfo[playerid][Pet]] = 1; // an extra ]
if so change it to
pawn Код:
PlayerInfo[playerid][Pet] = 1;



Re: invalid subscript - willsuckformoney - 03.07.2011

This is what I have:
pawn Код:
dini_IntSet(File,"Weight",Pet[playerid][Weight]);



Re: invalid subscript - Laronic - 03.07.2011

Look in your enum and look for an extra ] or [
If that is not the problem then idk, sry


Re: invalid subscript - =WoR=Varth - 03.07.2011

Do you have:
pawn Код:
Pet[MAX_PLAYERS] ["Your enum name"]



Re: invalid subscript - willsuckformoney - 03.07.2011

Yes i do.
pawn Код:
enum PlayerPets
{
    Pet[24],
    Name[24],
    Level,
    Size[24],
    Weight,
    HasPet
};
new Pets[MAX_PLAYERS][PlayerPets];
Thats what i have


Re: invalid subscript - willsuckformoney - 03.07.2011

Fixed it. I feel dumb now.


AW: invalid subscript - Babul - 03.07.2011

try
Код:
dini_IntSet(File,"Weight",Pets[playerid][Weight]);
you were trying to retrieve an enmum-inside value like a regular array. the Pets[] is the "parent" of the enum.
edit: nvm ^^