SA-MP Forums Archive
Multi-Dimensional Arrays - 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: Multi-Dimensional Arrays (/showthread.php?tid=528920)



Multi-Dimensional Arrays - venomlivno8 - 30.07.2014

pawn Код:
new DialogTexts[][] =
{
    "Text",
   
    "text",

    "text"
};
It gives me
Код:
error 001: expected token: ";", but found "-identifier-"



Re: Multi-Dimensional Arrays - Cannary2048 - 30.07.2014

add "," or ";" in the last "text"


Re: Multi-Dimensional Arrays - thefatshizms - 30.07.2014

EDIT: nvm I didn't read the code properly

Quote:
Originally Posted by Cannary2048
Посмотреть сообщение
add "," or ";" in the last "text"
No. You don't add a comma on the last element of the array.


Re: Multi-Dimensional Arrays - venomlivno8 - 30.07.2014

If I use DialogTexts[] instead of DialogTexts[][] then it's not a multidimensional array and I tried that it still gives the same error


Re: Multi-Dimensional Arrays - thefatshizms - 30.07.2014

Can you show the line it has errors on?


Re: Multi-Dimensional Arrays - venomlivno8 - 30.07.2014

Forgot to add the ; after closing brace.


Re: Multi-Dimensional Arrays - Cannary2048 - 30.07.2014

Try
pawn Код:
new DialogTexts[3][64] =
{
    "Text",
   
    "text",

    "text"
};



Re: Multi-Dimensional Arrays - sammp - 30.07.2014

pawn Код:
new Dialogs[][144] = {
        "LoL123Ahahahaha",
        "Lol123Ahaahahah",
        "Lol123Aahahahah"
    };
That works.