Array must be indexed.
#1

so, i've got a problem here.

Код:
new pclan[20][MAX_PLAYERS];
CMD:f (playerid,params[])
{
if (logged[playerid] == 1 && pclan[playerid] != "Nessuno")
{
new str[60], s[256];
if(sscanf(params,"s[60]",str)) return SendClientMessage(playerid,GREY,"USO: /f [testo]");
format(s,sizeof(s),"[F-OOC] %s : %s",GetName(playerid),str);
for (new i=0; i<MAX_PLAYERS;i++)
{
SendClientMessage(i,ORANGE,s);
}
else
{
SendClientMessage(playerid,RED,"Non sei in un clan/non sei loggato.");
}
}
return 1;
}
I got an error on this line:
if (logged[playerid] == 1 && pclan[playerid] != "Nessuno")

Error:
prison.pwn(205 : error 033: array must be indexed (variable "pclan")
Reply
#2

You have something like:

new pclan[20][MAX_PLAYERS];

So, in that line you didn't include that [20]. I don't know what's the use if it, but check this out.
Reply
#3

I use [20] because I give to this variable a string, so I must do it.
So.. how can I fix this?
Reply
#4

Change

new pclan[20][MAX_PLAYERS];

to

new pclan[MAX_PLAYERS][20];

Should work fine.
Reply
#5

that is a string you cant check it that way.
pawn Код:
if (logged[playerid] == 1 && strcmp(!pclan[playerid], "Nessuno"))
Reply
#6

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
that is a string you cant check it that way.
pawn Код:
if (logged[playerid] == 1 && strcmp(!pclan[playerid], "Nessuno"))
Thanks, my dear. :>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)