SA-MP Forums Archive
Nested enums with arrays (or something similar)) - 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: Nested enums with arrays (or something similar)) (/showthread.php?tid=625980)



Nested enums with arrays (or something similar)) - michalmonday - 08.01.2017

Hi, I've read that it's possible to use enum as a variable, is it possible then to create an array of this variable within another enum?

Here's what I'd like to achieve:

PHP код:
enum MUSCLE_ENUM
{
    
bool:IS_TENSED;
    
STRENGTH,
    
FLEXIBILITY,
    
ENDURANCE
}
enum BODY
{
    
bool:IS_MOVING,
    
bool:IS_SLEEPING,
    
MUSCLE_ENUM:MUSCLE[3000//that's the key line
}
new 
organism_data[BODY];
TenseAllTheMuscles()
{
    new 
i;
    for(
i=0;i<3000;i++)
    {
        
organism_data[MUSCLE][i][IS_TENSED] = true//that's the exact line I'd like to use
        //or something like:
        
organism_data[MUSCLE[i]][IS_TENSED] = true;
    }




Respuesta: Nested enums with arrays (or something similar)) - Whillyrez - 08.01.2017

This


Re: Nested enums with arrays (or something similar)) - michalmonday - 08.01.2017

Man, but how does that help with my issue?


Respuesta: Nested enums with arrays (or something similar)) - Whillyrez - 08.01.2017

Sorry, I had misunderstood.
You want to relation those enums?


Re: Nested enums with arrays (or something similar)) - michalmonday - 08.01.2017

Actually my point was to merge 2 enums, just like on the example I posted, but I think I'll just use normal arrays within single enum, thanks anway


Re: Nested enums with arrays (or something similar)) - CutX - 08.01.2017

Quote:
Originally Posted by michalmonday
Посмотреть сообщение
Actually my point was to merge 2 enums, just like on the example I posted, but I think I'll just use normal arrays within single enum, thanks anway
if you still wanna do it with 2 enums, here's an example

PHP код:
#include <a_samp>
enum FIRST
{
    
bool:this,
    
bool:is
}
enum SECOND
{
    
bool:that,
    
isThis[FIRST]
}
main()
{
    new 
arr[SECOND];
    
arr[isThis][is]=true;
    
printf("%s"arr[isThis][is] ? ("YES") : ("NO"));




Re: Nested enums with arrays (or something similar)) - michalmonday - 08.01.2017

thanks but how to make an array out of "isThis[FIRST]"?


Re: Nested enums with arrays (or something similar)) - Lordzy - 09.01.2017

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


Re: Nested enums with arrays (or something similar)) - michalmonday - 09.01.2017

thanks