enum avoid TagMismatch
#1

I have an enum:
pawn Код:
enum EM( += 2 )
{
    x, // 0
    y, // 2
    z // 4
}
And I want to print them values:

pawn Код:
printf("%d %d %d", EM:x, EM:y, EM:z);
But I get warning Tag Mismatch.

One way to do not get this warning is:

pawn Код:
printf("%d %d %d", _:x, _:y, _:z);
But I don't like this... Is there any other way rather that this?
Thanks
Reply
#2

o.O "But I don't like this... Is there any other way rather that this?" - LOL

Using defines or global variables
new x=0,2,z=4;
at the top of ur script or even better
#define x 0
#define y 2
#define z 4

And use them directly
Reply
#3

I want to use ENUM, not simple variables. Stay cool
Reply
#4

you don't need to use a specific tag, enum { x,y,z } also works
Reply
#5

Try this

pawn Код:
enum EM( += 2 )
{
    x, // 0
    y, // 2
    z // 4
}

new TB[EM];

printf("%d %d %d", TB[x], TB[y],TB[z]);
Reply
#6

pawn Код:
enum _:EM( += 2 ) // Ignores the tag
{
    x,
    y,
    z
}

printf("%d %d %d", x, y, z);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)