Two dimensional array within an enum
#1

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
Reply
#2

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];
Reply
#3

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

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.
Reply
#5

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
Reply
#6

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

Wrong post/thread.
Reply
#8

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
};
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)