Using y_bit
#1

As there's no tutorial for y_bit, I've been trying to work it out myself.. I came up with this:

pawn Код:
#include <a_samp>

#include <YSI\y_bit>

enum _:E_PLAYER_FLAGS
{
    PLAYER_IS_LOGGED_IN
}

new BitArray:PlayerFlag[MAX_PLAYERS]<E_PLAYER_FLAGS>;

public OnFilterScriptInit()
{
    new playerid = 0; // This is just a test

    Bit_Set(PlayerFlag[playerid], PLAYER_IS_LOGGED_IN, true);

    PrintPlayerFlags(playerid);

    return 1;
}

stock PrintPlayerFlags(playerid)
{
    print("\n");

    printf("PLAYER_IS_LOGGED_IN\t%i", Bit_Get(PlayerFlag[playerid], PLAYER_IS_LOGGED_IN));

    print("\n");
}
It WORKS, but I feel as if something is wrong, in regards to the enum and tags. I had to use the underscore tag (_ to prevent a tag mismatch warning.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)