08.01.2015, 22:02
Practical use for this is to store multiple (up to 32) boolean variables (true/false, on/off, yes/no) into one single integer variable. In your case this would probably translate to permissions, so for example:
You can write macros or functions for this so you don't have to remember all the | and & things.
pawn Код:
enum (<<= 1) // don't forget to add this
{
CAN_ADD_OBJECT = 1, // set this to 1 otherwise everything will be 0 and the whole thing breaks
CAN_EDIT_OBJECT,
CAN_REMOVE_OBJECT,
// etc
}
new editorPermissions[MAX_PLAYERS];
// somewhere
editorPermissions[playerid] |= CAN_ADD_OBJECT; // player can now add objects
editorPermissions[playerid] &= ~CAN_ADD_OBJECT; // player can no longer add objects