SA-MP Forums Archive
Multiple instances of an enum inside 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: Multiple instances of an enum inside an enum (/showthread.php?tid=444711)



Multiple instances of an enum inside an enum - Enforcer501 - 17.06.2013

Alright, experimenting a bit but not really sure where to start. I'm wanting to create 5 instances of an enum inside of another enum for the sake of being organized.

Per-example, this is what I'm wanting to do. Now I know this naturally should return an error but bear in mind, this was only written as an example to help you understand the idea.
Code:
enum IDs_Enum // The enum I'd like to duplicate
{
	MyID,
	YourID,
	OtherGuysID
}
enum Base_Enum
{
	IDs_Enum[5], // Duplicating the enum 5 times per each Base_Enum instance
	OtherData,
	MoreData
}
new B_Enum[15][Base_Enum]

-------------------------------
error 021: symbol already defined: "IDs_Enum"
So whats the souce for this recipe guys?


Respuesta: Multiple instances of an enum inside an enum - JustBored - 18.06.2013

I think that you can't do what you want to do. I mean i think that it's imposible.


Re: Multiple instances of an enum inside an enum - Enforcer501 - 18.06.2013

Well, that's what I've been told but it doesn't hurt to poke around a bit. Who knows, someone might have something clever up their sleeve.


Re: Multiple instances of an enum inside an enum - Enforcer501 - 18.06.2013

Page 5, throwing this back into circulation.


Re: Multiple instances of an enum inside an enum - ReVo_ - 18.06.2013

You want something like this:
Code:
enum IDs_Enum // The enum I'd like to duplicate
{
	MyID,
	YourID,
	OtherGuysID
}
enum Base_Enum
{
	we[IDs_Enum][5], // Duplicating the enum 5 times per each Base_Enum instance
	OtherData,
	MoreData
}
new B_Enum[15][Base_Enum];
but you cant,
B_Enum[0][we][MyID][0] = 5;
will be a 4-D array and you can have at max 3d arrays.

Code:
enum Base_Enum
{
	we[IDs_Enum], // Duplicating the enum 5 times per each Base_Enum instance
	OtherData,
	MoreData
}
is valid.