Array must be indexed
#1

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?
Reply
#2

Write it like this:

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

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)