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



Array must be indexed - Callum98 - 03.06.2015

I am getting this error:
pawn Код:
rror 033: array must be indexed (variable "nameSplit")
Here is my code:
pawn Код:
stock IsValidRpNameUsed(playerid)
{
    new
        name[MAX_PLAYER_NAME],
        nameSplit[2][MAX_PLAYER_NAME];
   
    GetPlayerName(playerid, name, sizeof name);
    split(name, nameSplit, '_');
   
    if (strfind(name, "_") != -1)
    {
        if (nameSplit[0] >= 'A' && nameSplit[0] <= 'Z' && nameSplit[1] >= 'A' && nameSplit[1] <= 'Z') return 1;
    }
    return 0;
}
Anyone know what I am doing wrong?


AW: Array must be indexed - Kaliber - 03.06.2015

Write it like this:

Код:
if ((nameSplit[0][0] >= 'A' && nameSplit[0][0] <= 'Z') && (nameSplit[1][0] >= 'A' && nameSplit[1][0] <= 'Z')) return 1;
Greekz


Re: AW: Array must be indexed - Callum98 - 03.06.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Write it like this:

Код:
if ((nameSplit[0][0] >= 'A' && nameSplit[0][0] <= 'Z') && (nameSplit[1][0] >= 'A' && nameSplit[1][0] <= 'Z')) return 1;
Greekz
Cheers