katursis / Pawn.CMD

🚀 Plugin-powered command processor for SA:MP server
MIT License
119 stars 13 forks source link

Flags not working #4

Closed Arose-Niazi closed 7 years ago

Arose-Niazi commented 7 years ago

I tried setting a flag ANIMATIONS and it won't work, the enum for it is

enum { ANIMATIONS }

IstuntmanI commented 7 years ago

Because the first value of an enumerator is 0 (0 is basically no flag, as bits are bitwise, and 0 means that there's no flag set), so for it to work you would need to do, at least:

enum
{
    ANIMATIONS = 1
}

If you plan to add more flags in the future in that enumerator, it is recommended to do

enum ( <<= 1 )
{
    ANIMATIONS = 1,
    FLAG_2,
    FLAG_3,
}

So the first flag (ANIMATIONS) will have the value 0b1, the next will be 0b10, then the next will be 0b100.

Arose-Niazi commented 7 years ago

Thanks for the info and help :)

It's fixed now.