SA-MP Forums Archive
About arrys - 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: About arrys (/showthread.php?tid=298950)



About arrys - juraska - 23.11.2011

Hi there. Got a question about arrys

alright, I've think how to do arrys variables that they save some numbers, data and I will be able to change it around


something like this
Код:
new modelnumbers[][]=
{

     {400},
     {500}
};
And like if I'd press newkeys == key_up will change modelnumbers variable to 500 if again 400 you know everything will replay, spin around again


Re: About arrys - Pharrel - 23.11.2011

pawn Код:
new modelnumbers[] =
{
     {400},//this is modelnumbers[0]
     {500}//and this is modelnumbers[1]
};

//so you can do that:

modelnumbers[0] = 300;
modelnumbers[1] = 400;



Re: About arrys - juraska - 23.11.2011

error 008: must be a constant expression; assumed zero

didn't array structure should be [][]?


Re: About arrys - MP2 - 23.11.2011

There's no need for a second dimension.

pawn Код:
new modelnumbers[]=
{
     400,
     500
};



Re: About arrys - Pharrel - 23.11.2011

only when you have something like that:

pawn Код:
modelnumbers[][] =
{
    {1,2},//modelnumbers[0][0] = 1 | modelnumbers[0][1] = 2
    {3,4}//modelnumbers[1][0] = 3 | modelnumbers[1][1] = 4
};
at least in theory :/


Re: About arrys - juraska - 23.11.2011

And how did change variable to next with key_up when I try like that modelnumbers[0][0]++; I've got error