SA-MP Forums Archive
enum avoid TagMismatch - 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: enum avoid TagMismatch (/showthread.php?tid=455411)



enum avoid TagMismatch - saamp - 01.08.2013

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


Re: enum avoid TagMismatch - Yashas - 01.08.2013

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


Re: enum avoid TagMismatch - saamp - 01.08.2013

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


AW: enum avoid TagMismatch - Kwashiorkor - 01.08.2013

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


Re: enum avoid TagMismatch - Alexis1999 - 01.08.2013

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



AW: enum avoid TagMismatch - BigETI - 01.08.2013

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

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