The problem with the given example is that it ignores anything other plugins are doing. For example, if another plugin does this:
PHP Code:
SetAdminFlag(adminId, Admin_Generic, true)
your plugin will never set their IS_ADMIN flag and your plugin's idea of what the users admin flags are would be wrong.
This is the same problem you'd have if you called GetConVarSomething in OnAllPluginsLoaded or OnConfigsExecuted rather than when you actually need the value... something else may change it first.
For that matter, to check if a flag is present, you can already just do this:
PHP Code:
new flags;
...
// Add the HAS_MESSAGE flag
flags |= HAS_MESSAGE
// Remove the HAS_MESSAGE flag
flags &= ^HAS_MESSAGE
// Check the HAS_MESSAGE flag
if (flags & HAS_MESSAGE)
{
// They have a message
}
(Edit: Adjusted code for removing flags)
You're limited to 32 flags because that's how many bits you have in a cell.
__________________