Integer versus boolean
#5

You can also store 32 true/false values in a single variable if you really want to save memory. By using bit flags.

Код:
enum PLAYER_FLAGS :(<<= 1)
{
    LOGGED_IN = 1,
    IN_RACE
};

new PLAYER_FLAGS: PlayerFlags[MAX_PLAYERS];

//when player logs in...
PlayerFlags[playerid] |= LOGGED_IN;

//when player logs out
PlayerFlags[playerid] &= ~LOGGED_IN;

//check if player is logged in.
if( PlayerFlags[playerid] & LOGGED_IN )
EDIT: Sorry didn't realize that link had already been posted.
Reply


Messages In This Thread
Integer versus boolean - by BiosMarcel - 14.05.2016, 10:27
Re: Integer versus boolean - by Konstantinos - 14.05.2016, 10:37
Re: Integer versus boolean - by BiosMarcel - 14.05.2016, 10:42
Re: Integer versus boolean - by Konstantinos - 14.05.2016, 10:49
Re: Integer versus boolean - by iggy1 - 14.05.2016, 11:00
Re: Integer versus boolean - by BiosMarcel - 14.05.2016, 11:06
Re: Integer versus boolean - by Konstantinos - 14.05.2016, 11:10
Re: Integer versus boolean - by BiosMarcel - 14.05.2016, 11:14
Re: Integer versus boolean - by AbyssMorgan - 14.05.2016, 11:35
Re: Integer versus boolean - by BiosMarcel - 14.05.2016, 11:38

Forum Jump:


Users browsing this thread: 2 Guest(s)