SA-MP Forums Archive
error 033: 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 033: array must be indexed (/showthread.php?tid=229330)



error 033: array must be indexed - DaneAMattie - 21.02.2011

Hey i get this error when compiling:

Код:
error 033: array must be indexed (variable "tmpCName")
Код:
tmpCName = "Sniper ";
tmpCName = tmpCName & pClass4;



Re: error 033: array must be indexed - DaneAMattie - 21.02.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
You can't "AND" a string, only numbers.
thanks, i fixed it with format, but now i have the same error on another code:

Код:
if(PlayerInfo[playerid][Class1] == "1")
{
tmpCName = "[Assault]";
}



Re: error 033: array must be indexed - DaneAMattie - 21.02.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
Have you read ANY of the documents on PAWN? It seems you are trying to make up your own language which isn't PAWN at all...
huh wut?


Re: error 033: array must be indexed - Jochemd - 21.02.2011

You can't just do new string[50] = "blablah"... use format.


Re: error 033: array must be indexed - Calgon - 21.02.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
You can't just do new string[50] = "blablah"... use format.
It looks like you need to read the documentation as well.


Re: error 033: array must be indexed - DaneAMattie - 21.02.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
You can't just do new string[50] = "blablah"... use format.
no man, the error is in the if statement, the new string = bla just works


Re: error 033: array must be indexed - Jochemd - 21.02.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
It looks like you need to read the documentation as well.
You understood me wrong (as I explained wrong). I meant you can't just do 'new strng[50] = "blahblah";'. If you do that, the string you enter needs to be exactly the size you declared as [50]...

Код:
if(PlayerInfo[playerid][Class1] == "1")
And about that statement... Use strcmp.

pawn Код:
if(!strcmp(PlayerInfo[playerid][Class1],"1",false))



Re: error 033: array must be indexed - DaneAMattie - 21.02.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
You understood me wrong (as I explained wrong). I meant you can't just do 'new strng[50] = "blahblah";'. If you do that, the string you enter needs to be exactly the size you declared as [50]...

Код:
if(PlayerInfo[playerid][Class1] == "1")
And about that statement... Use strcmp.

pawn Код:
if(!strcmp(PlayerInfo[playerid][Class1],"1",false))
Thanks man, if(!strcmp(PlayerInfo[playerid][Class1],"1",false)) worked


Re: error 033: array must be indexed - Jochemd - 21.02.2011

No problem, you're welcome