Must be assigned to an array -
Negrosoo - 22.08.2009
Hi all..
This is the code..
And the error..
Can you help me?
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/prigione1", cmdtext, true, 10) == 0)
{
stato[playerid]="prigione1";
return 1;
}
if (strcmp("/prigione2", cmdtext, true, 10) == 0)
{
stato[playerid]="prigione2";
return 1;
}
if (strcmp("/base1", cmdtext, true, 10) == 0)
{
stato[playerid]="base1";
return 1;
}
if (strcmp("/base2", cmdtext, true, 10) == 0)
{
stato[playerid]="base2";
return 1;
}
return 0;
}
C:\DOCUME~1\Gugli0\Desktop\ZOMBIE~1\FILTER~1\limit i.pwn(4
![Cool](images/smilies/cool.gif)
: error 006: must be assigned to an array
C:\DOCUME~1\Gugli0\Desktop\ZOMBIE~1\FILTER~1\limit i.pwn(53) : error 006: must be assigned to an array
C:\DOCUME~1\Gugli0\Desktop\ZOMBIE~1\FILTER~1\limit i.pwn(5
![Cool](images/smilies/cool.gif)
: error 006: must be assigned to an array
C:\DOCUME~1\Gugli0\Desktop\ZOMBIE~1\FILTER~1\limit i.pwn(63) : error 006: must be assigned to an array
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: Must be assigned to an array -
Surmek - 22.08.2009
Код:
new stato[MAX_PLAYERS][128];
Re: Must be assigned to an array -
Negrosoo - 23.08.2009
And why this code?
Re: Must be assigned to an array -
dice7 - 23.08.2009
because "base1" is a string and strings are stored in arrays
Re: Must be assigned to an array -
radhakr - 23.08.2009
Quote:
Originally Posted by ssǝן‾ʎ
I count 10 characters max there, why do you need an array of size 128 to store 10 characters - what are the other 118 cells for?
|
Would this be an improvement?
Код:
new stato[MAX_PLAYERS][10];
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/prigione1", cmdtext, true, 10) == 0) return stato[playerid]="prigione1";
if (strcmp("/prigione2", cmdtext, true, 10) == 0) return stato[playerid]="prigione2";
if (strcmp("/base1", cmdtext, true, 10) == 0) return stato[playerid]="base1";
if (strcmp("/base2", cmdtext, true, 10) == 0) return stato[playerid]="base2";
return 0;
}
Re: Must be assigned to an array -
radhakr - 23.08.2009
Ok, thanks. I saw some other code like that a few days ago and wasn't sure if it was correct.