Raised This Month: $ Target: $400
 0% 

[INC] Customflags 0.6 Beta


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-17-2012 , 11:43   Re: [INC] Customflags 0.6 Beta
Reply With Quote #5

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(adminIdAdmin_Generictrue
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.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-23-2012 at 15:01.
Powerlord is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode