SA-MP Forums Archive
Two dimensional array within an enum - 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: Two dimensional array within an enum (/showthread.php?tid=604383)



Two dimensional array within an enum - DTV - 04.04.2016

I was just wondering if it was possible to have a two dimensional array within an enum, something like

pawn Code:
enum info
{
    Example[][],
    Example2[][]
};
new Stat[MAX_PLAYERS][info]; //Not sure if this line would be right, but that's why I'm asking :P



Re: Two dimensional array within an enum - -CaRRoT - 04.04.2016

No it's not possible as that would make it a 4 dimensional array and they're not supported.

You'll have to define it separately.

Code:
new Example[MAX_PLAYERS][][];
This is correct tho.
Code:
new Stat[MAX_PLAYERS][info];



Re: Two dimensional array within an enum - Misiur - 04.04.2016

Zeex's compiler supports 4d arrays. But, you would need to specify array sizes from the beginning


Re: Two dimensional array within an enum - introzen - 04.04.2016

Most commonly there are really no need for a 4D array. State your intentions and we might figure out a way to work around it.


Re: Two dimensional array within an enum - DTV - 04.04.2016

An inventory system where the first array would be the slot number and the second array would be the amount number.

pawn Code:
Example[1][5] //That would be in slot 1 and the amount in that slot would be 5, if my explaining isn't good :P



Re: Two dimensional array within an enum - AndySedeyn - 04.04.2016

https://sampforum.blast.hk/showthread.php?tid=541426


Re: Two dimensional array within an enum - Black Axe - 04.04.2016

Wrong post/thread.


Re: Two dimensional array within an enum - -CaRRoT - 04.04.2016

Quote:
Originally Posted by DTV
View Post
An inventory system where the first array would be the slot number and the second array would be the amount number.

pawn Code:
Example[1][5] //That would be in slot 1 and the amount in that slot would be 5, if my explaining isn't good :P
Then you should use my method.

Code:
new Example[MAX_PLAYERS][][];
You could even link it to an enum, here's an example.

Code:
new Inventory[MAX_PLAYERS][MAX_SLOTS][InvVars];

enum InvVars
{
	Var1,
        Var2
};



Re: Two dimensional array within an enum - DTV - 04.04.2016

Alright, I think I understand what I can do now. Thanks to all of you