SA-MP Forums Archive
Using y_bit - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Using y_bit (/showthread.php?tid=451207)



Using y_bit - MP2 - 16.07.2013

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.