Raised This Month: $ Target: $400
 0% 

Cvar by Strings (Or Flags)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 05-19-2010 , 10:49   Re: Cvar by Strings (Or Flags)
Reply With Quote #1

Quote:
Originally Posted by Bugsy View Post
Why do you want to have a + in the flags? Why not just use a list of flags like used for admin flags. You can then use read_flags and bit flags for each option.
I Don't Know How,if this dont's works...

Quote:
Originally Posted by unnyquee View Post
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..

I will read the admin.sma

btw Thanks!
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Reply



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