SA-MP Forums Archive
multi array - 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 array (/showthread.php?tid=538740)



multi array - Hirsw0w - 23.09.2014

hey all

I have multi array like that:

array[5][5] and i want to do something like that :

array[5][5] = {-1,...) and all the array be -1 example

array[0][3] == -1;
array[2][3] == -1;
array[4][1] == -1;

all will be -1 if someone can send me how that be very good


Re: multi array - MellowHammer - 23.09.2014

Код:
for(new i = 0; i < 5; i++)
{
  for(new j = 0; j < 5; j++)
  {
    array[i][j] = -1;
  }
}



Re: multi array - Hirsw0w - 23.09.2014

Quote:
Originally Posted by MellowHammer
Посмотреть сообщение
Код:
for(new i = 0; i < 5; i++)
{
  for(new j = 0; j < 5; j++)
  {
    array[i][j] = -1;
  }
}
have another way?


Re: multi array - Jefff - 24.09.2014

pawn Код:
new array[5][5] = {{-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}};
but if you got huge arrays its bad idea


Re: multi array - Hirsw0w - 24.09.2014

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new array[5][5] = {{-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}};
but if you got huge arrays its bad idea
[MAX_VEHICLE][4] its huge?


Re: multi array - XStormiest - 24.09.2014

Considering that are:
2000 MAX VEHICLE set , i think yeah.... is kinda big...


Re: multi array - Hirsw0w - 24.09.2014

Quote:
Originally Posted by XStormiest
Посмотреть сообщение
Considering that are:
2000 MAX VEHICLE set , i think yeah.... is kinda big...
so what the best option to do that.


Re: multi array - Jefff - 25.09.2014

Its ok because you need write only 4 times {-1, ...}, {-1, ...} not 2000 times, for example

[4][MAX_VEHICLE] = { {-1, ...}, {-1, ...}, and 1998 times this xd};