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



Array Must be indexed, text - Larry123 - 03.03.2012

pawn Код:
public OnPlayerText(playerid, text[])
{
    if( text == NumberToWrite )
    {
         }
         return 1;
}
Error
Код:
array must be indexed (variable "text")



Re: Array Must be indexed, text - Walsh - 03.03.2012

Код:
==
Is for comparisons on integer values, in this case text is a string, not an integer.

You would use strcmp.
pawn Код:
public OnPlayerText(playerid, text[])
{
    if( strcmp(text,NumberToWrite,true) == 0 )
    {
         }
         return 1;
}



Re: Array Must be indexed, text - DarkScripter - 03.03.2012

pawn Код:
text = string/array.
Use: printf(text);// show the text in to console.

NumberToWrite = Interator/Nunber
Use: printf("This is number 1: %d", 1);
you can make:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(strfind(text, "50", true) != -1)
    {
          printf("I find the 50!!");
    }
    return 1;
}



Re: Array Must be indexed, text - Larry123 - 03.03.2012

DELETE; no errors anymore

Thanks for you guys