SA-MP Forums Archive
3d 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 3d array. (/showthread.php?tid=65550)



3d array. - kazimieras - 13.02.2009

Is there any way to make one? Or to atleast achieve the same effect?
Please help. Thanks.


Re: 3d array. - Nero_3D - 13.02.2009

pawn Код:
new array[1][1][1];
Or what you mean ?

At 4 dimensions the compiler complain


Re: 3d array. - Daren_Jacobson - 13.02.2009

here is something i use on connect so i don't have to keep getting names
pawn Код:
new pName[MAX_PLAYERS][MAX_PLAYER_NAME];
that is 2d and if you want 3d

pawn Код:
enum InventoryItems
{
Drugs
Mats
}
new pInventory[MAX_PLAYERS][InventoryItems][100] //99 drugs or mats allowed



Re: 3d array. - kazimieras - 15.02.2009

it works with [1][1][1]... but if you type try to make the 3rd dimension atleast 2 slots deep, you get an error. Please help... I need to save a string as a player flag. There can be 200 players and 300 flags for each one, so I end up with:

new flags[200][300][128];

but that gives an error.


Re: 3d array. - Backwardsman97 - 15.02.2009

Pawn only supports up to two-dimensional arrays.


Re: 3d array. - Streetplaya - 15.02.2009

Try it with an enum


Re: 3d array. - kazimieras - 15.02.2009

I think there's no way to walk around this with enums... If you think there is, please give me an idea of how to do it...


Re: 3d array. - kazimieras - 15.02.2009

Sorry for double post... not intended to do that.


Re: 3d array. - Pghpunkid - 15.02.2009

3d arrays are possible if i remember right, i have done this in pawn during the 0.2.2 days and will see if i can find the code when i get home.


Re: 3d array. - Nero_3D - 15.02.2009

Quote:
Originally Posted by KANiS6111
it works with [1][1][1]... but if you type try to make the 3rd dimension atleast 2 slots deep, you get an error. Please help... I need to save a string as a player flag. There can be 200 players and 300 flags for each one, so I end up with:

new flags[200][300][128];

but that gives an error.
No error for me :S - Picture

And I self use some 3d arrays in a gm, wanted a 4d but no chance agains the programm :S