Nested enums with arrays (or something similar))
#1

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;
    }

Reply
#2

This
Reply
#3

Man, but how does that help with my issue?
Reply
#4

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

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

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"));

Reply
#7

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

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

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)