Raised This Month: $ Target: $400
 0% 

help with bit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-12-2022 , 23:34   Re: help with bit
Reply With Quote #1

These macros are designed to store booleans/bit-flags for each player, allowing you to pass their player ID and the bit-field variable. It's pretty straightforward.

Suppose you wanted to record each player that was slayed, clearing the flag if they are revived.
PHP Code:
#define get_bit(%2,%1) (%1 & (1<<(%2&31)))
#define set_bit(%2,%1) (%1 |= (1<<(%2&31)))
#define rem_bit(%2,%1) (%1 &= ~(1 <<(%2&31)))

new WasPlayerSlayed;

SlayFuncid )
{
    
//slay( id );

    
set_bitid WasPlayerSlayed );
}

RevivePlayerid )
{
    
//revive( id );

    
rem_bitid WasPlayerSlayed );
}

bool:WasPlayerSlayedAndNotRevivedid )
{
    return !!
get_bitid WasPlayerSlayed );

If csgo_reset_data() should set all bits in loaded to 0, just do loaded = 0

Please ask a more specific question if you need help, but the above posts should help you understand what each macro does.
__________________

Last edited by Bugsy; 04-12-2022 at 23:38.
Bugsy is offline
PawnBegg
Junior Member
Join Date: Apr 2022
Old 04-13-2022 , 04:19   Re: help with bit
Reply With Quote #2

THANKS YOU GUYS, a little bit clear now ;)
PawnBegg is offline
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 21:20.


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