Raised This Month: $ Target: $400
 0% 

Cvar by Strings (Or Flags)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 05-19-2010 , 10:14   Re: Cvar by Strings (Or Flags)
Reply With Quote #7

PHP Code:
#include <amxmodx>

#define ACCESS_WHATEVER_1 (1<<0) // a
#define ACCESS_WHATEVER_2 (1<<1) // b
#define ACCESS_WHATEVER_3 (1<<2) // c
// and so on..

new g_cFlags;

public 
plugin_init()
{
      
register_plugin("Flags?""0.0""#8 SickneSS");
      
      
g_cFlags register_cvar("plugin_flags""abc");
}

public 
your_public(/* args */)
{
      static 
szFlags[32];
      
      
get_pcvar_string(g_cFlagsszFlagscharsmax(szFlags));
      
      if(
read_flags(szFlags) & ACCESS_WHATEVER_1)
      {
            
// got the flag 'a'
      
}
      
      if(
read_flags(szFlags) & ACCESS_WHATEVER_2)
      {
            
// got the flag 'b'
      
}

      if(
read_flags(szFlags) & ACCESS_WHATEVER_3)
      {
            
// got the flag 'c'
      
}
      
      
// and so on again..

__________________

Last edited by unnyquee; 05-19-2010 at 10:18.
unnyquee 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 03:51.


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