Raised This Month: $ Target: $400
 0% 

Enum bits for menu options


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 09-08-2019 , 12:47   Re: Enum bits for menu options
Reply With Quote #9

You could do it in a different way:

PHP Code:
#define bit(%1) (1<<%1)

enum _:option_enum
{
    
OPTION_1,
  
OPTION_2,
  
OPTION_3
}

new const 
option_list[option_enum][] =
{
  
"Option 1",
  
"Option 2",
  
"Option 3"
}

new 
g_client_options[33]

// Check if player has the option
for(new 0option_enumi++)
{
  if( 
g_client_optionsclient] & bit(i) )
  {
  
  }
}

// Add option to player
g_client_options[client] |= bitOption_%
It's been a long time, so not sure "Option_1" can be actually "zero".
But you get the point.
__________________
Retired.

Last edited by Xalus; 09-08-2019 at 14:59.
Xalus 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 17:29.


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