08.01.2015, 22:01
Example, using two cases.
I've a variable, to identify somethings about my personality on the game.
And I've mapped it on 2 bits, the 1st bit indicates that I'm an admin player, the 2nd bit indicates that I'm a vip player.
So, I can create macros for indentify the difference between vp and ap:
And I can set it, just using:
Now I set myself as an administrator.
to verify, you can use AND bit operator:
I've a variable, to identify somethings about my personality on the game.
Код:
new person[MAX_PLAYERS];
So, I can create macros for indentify the difference between vp and ap:
pawn Код:
#define ADMIN_P 0b01
#define VIP_P 0b10
pawn Код:
person[playerid] |= ADMIN_P;
to verify, you can use AND bit operator:
pawn Код:
if (person[playerid] & ADMIN_P) //indicates that I'm an Administrator
if (person[playerid] & VIP_P) //indicates that I'm a vip player, but it will return false (01 & 10 = 00)