Raised This Month: $ Target: $400
 0% 

Enum arrays inside of an enum


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xd346
Junior Member
Join Date: Aug 2019
Old 01-29-2021 , 16:35   Enum arrays inside of an enum
Reply With Quote #1

Is it possible to have an array of enum A inside of enum B?
xd346 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-29-2021 , 16:41   Re: Enum arrays inside of an enum
Reply With Quote #2

Like this? Explain a real world example of what you're trying to do instead of talking in code.
PHP Code:
#include <amxmodx>

enum EnumA
{
    
Item1a,
    
EnumB:Item2a
}

enum EnumB
{
    
Item2b,
    
Item2b
}

new 
MyArrayEnumA ];

public 
plugin_init() 
{
    
MyArrayItem2a ] = Item2b;


__________________

Last edited by Bugsy; 01-29-2021 at 16:41.
Bugsy is offline
xd346
Junior Member
Join Date: Aug 2019
Old 01-29-2021 , 16:48   Re: Enum arrays inside of an enum
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Like this? Explain a real world example of what you're trying to do instead of talking in code.
PHP Code:
#include <amxmodx>

enum EnumA
{
    
Item1a,
    
EnumB:Item2a
}

enum EnumB
{
    
Item2b,
    
Item2b
}

new 
MyArrayEnumA ];

public 
plugin_init() 
{
    
MyArrayItem2a ] = Item2b;


Something like this i guess

PHP Code:
enum _:EnumA
{
    
Item1a,
    
Item2a[10][EnumB]
}

enum _:EnumB
{
    
Item1b,
    
Item2b
}

new 
MyArray[10][ EnumA ]; 
xd346 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-29-2021 , 17:26   Re: Enum arrays inside of an enum
Reply With Quote #4

I think what you have would work, have you tried?
__________________
Bugsy is offline
xd346
Junior Member
Join Date: Aug 2019
Old 01-29-2021 , 17:33   Re: Enum arrays inside of an enum
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
I think what you have would work, have you tried?
Yeah i get ERROR [7]: expected token: "}", but found "[" on line Item2a[10][EnumB]
xd346 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-29-2021 , 17:37   Re: Enum arrays inside of an enum
Reply With Quote #6

Ok I think this may be a compiler issue where it can't handle 3d array sized this way.

But if you explain your objective it may be doable another way.
__________________
Bugsy is offline
xd346
Junior Member
Join Date: Aug 2019
Old 01-29-2021 , 17:43   Re: Enum arrays inside of an enum
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
Ok I think this may be a compiler issue where it can't handle 3d array sized this way.

But if you explain your objective it may be doable another way.
Basically I want to have a class enum with some class data like its name. Each class can be leveled up so I wanted to make it so the class enum has an array of a class level enum which contains the stuff like hp and current level model.

Last edited by xd346; 01-29-2021 at 17:44.
xd346 is offline
xd346
Junior Member
Join Date: Aug 2019
Old 01-29-2021 , 17:52   Re: Enum arrays inside of an enum
Reply With Quote #8

Seems like this works:
PHP Code:
enum _:EnumA
{
    
Item1a,
    
EnumB:Item2a[10]
}

enum _:EnumB
{
    
Item1b,
    
Item2b
}

new 
MyArray[10][ EnumA 

Last edited by xd346; 01-29-2021 at 17:53.
xd346 is offline
Old 01-30-2021, 13:43
Black Rose
This message has been deleted by Black Rose. Reason: my bad
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode