Raised This Month: $ Target: $400
 0% 

nVault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-29-2014 , 17:17   Re: nVault
Reply With Quote #1

From this tut: https://forums.alliedmods.net/showthread.php?t=139916

PHP Code:
#define MAX_PLAYERS    32

//Create a list of options that are supported by the plugin
enum ( <<=_Options
{
    
Speed=1// 1 << 0 or 1 
    
AutoAim,  // 1 << 1 or 1 << 1 (as value is calculated by enum)        
    
HighJump// 1 << 2 or 2 << 1
    
ExtraHP,   // 1 << 3 or 4 << 1
    
ExtraArmor // 1 << 4 or 8 << 1
}

//Define an array that will keep track of each option a player currently has
new g_OptionsMAX_PLAYERS+];

//Examples of how to apply option for player
g_Optionsid ] |= Speed;
g_Optionsid ] |= HighJump;
g_Optionsid ] |= ExtraArmor;

//Examples of how to remove option for player
g_Optionsid ] &= ~Speed;
g_Optionsid ] &= ~HighJump;
g_Optionsid ] &= ~ExtraArmor;

//Example how to check if a player has an option
if ( g_Optionsid ] & Speed )
    
//player has speed 
To load and save player booleans (untested):
PHP Code:
//To save:
new szData15 ];
num_to_strg_Optionsid ] , szData charsmaxszData ) );
nvault_setg_VaultID szKey szData );

//To load:
g_Optionsid ] = nvault_getg_VaultID szKey ); 
__________________

Last edited by Bugsy; 11-29-2014 at 17:18.
Bugsy is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 11-29-2014 , 17:26   Re: nVault
Reply With Quote #2

Sorry, but if I have more than 20 choices (so 20 bools in g_bTrue) it is a little bit a lot of writing with your way, isn't it?

Last edited by ~Ice*shOt; 11-29-2014 at 17:26.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
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 17:41.


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