SA-MP Forums Archive
Array must be indexed error. - 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: Array must be indexed error. (/showthread.php?tid=558154)



Array must be indexed error. - X|Dragon|X - 16.01.2015

Код:
error 033: array must be indexed (variable "PlayerName")
This is the line, help please.
pawn Код:
if(strcmp(VehicleOwner[vehicleid], PlayerName(playerid) == 0)



Re: Array must be indexed error. - ATGOggy - 16.01.2015

show where you defined 'VehicleOwner'


Re: Array must be indexed error. - Rudy_ - 16.01.2015

pawn Код:
if(strcmp(VehicleOwner[vehicleid], PlayerName(playerid) == 0))



Re: Array must be indexed error. - X|Dragon|X - 16.01.2015

pawn Код:
new VehicleOwner[MAX_VEHICLES][MAX_PLAYER_NAME];
EDIT: SAME errors rudy.


Re: Array must be indexed error. - ATGOggy - 16.01.2015

Is PlayerName a custom function or variable?


Re: Array must be indexed error. - X|Dragon|X - 16.01.2015

pawn Код:
stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}
There it is. **


Re: Array must be indexed error. - ATGOggy - 16.01.2015

Try this:
PHP код:
if(strcmp(VehicleOwner[vehicleid], PlayerName(playerid)) == 0



Re: Array must be indexed error. - X|Dragon|X - 16.01.2015

Yep, thank you.

I'll REP you in abit. :*


Re: Array must be indexed error. - ATGOggy - 16.01.2015

You're welcome and thank you for rep.