 |
|
AMX Mod X Plugin Approver
|

04-26-2012
, 09:35
Re: Cvar: Add number together
|
#4
|
You don't understand I guess.
Using letters are more easy, you don't need to calculate.
// a - Grenade bonus
// b - HP Bonus
// c - Money bonus
// d - Bomb plant bonus
// e - Bomb defuse bonus
// f - Bomb pickup bonus
For example : random_cvar "ac"
Register your cvar normally. Then to get a sum of flags, you use read_flags().
To know what bonuses, you can make an enum :
enum ( <= 1 )
{
BONUS_GRENADE = 1,
BONUS_HP,
BONUS_MONEY,
BONUS_BOMB_PLANTED,
BONUS_BOMB_DEFUSED,
BONUS_BOMB_PICKED_UP
};
Then, to check, retrieve the sum of bits with read_flags and get_pcvar_string :
new flags[ 12 ];
get_pcvar_string( pointer, flags, charsmax( flags ) );
new bitsum = read_flags( flags );
And all you need to do :
if( bitsum & BONUS_GRENADE )
{
}
if( bitsum & BONUS_HP )
{
}
etc.
You can also use numbers, and you would not need to use read_flags. You could cache directly the value with get_pcvar_num.
You get the ideas.
__________________
|
|
|
|