[Include] Bit_Flags 0.1
#2

"Example Usage Section"

pawn Code:
//Setup our user flags.
enum(<<=1)
{
    pSpawned =1,
    pDev,
    pAdmin,
    pVip,
    pAFK
}

//define out player flags array
new gPlayerFlags[MAX_PLAYERS];


public OnPlayerSpawn(playerid)
{
    //add the flag of spawned once player spawns
    Add_Bit_Flag(gPlayerFlags[playerid],pSpawned);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{  
    //remove the spawned flag when they die
    Remove_Bit_Flag(gPlayerFlags[playerid],pSpawned);
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/admin", true, 6))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "/admin : Make yourself an admin");
        //add admin flag
        Add_Bit_Flag(gPlayerFlags[playerid],pAdmin);
        return 1;
    }
    if(!strcmp(cmdtext, "/radmin", true, 7))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "/radmin : Remove yourself as an admin");
        //remove admin flag
        Remove_Bit_Flag(gPlayerFlags[playerid],pAdmin);
        return 1;
    }
    return 0;
}
Reply


Messages In This Thread
Bit_Flags 0.1 - by Jonny5 - 08.04.2012, 21:58
Re: Bit_Flags 0.1 - by Jonny5 - 08.04.2012, 22:00
Re: Bit_Flags 0.1 - by steki. - 08.04.2012, 22:07
Re: Bit_Flags 0.1 - by Jonny5 - 08.04.2012, 22:15
Re: Bit_Flags 0.1 - by mprofitt - 09.05.2012, 14:50
Re: Bit_Flags 0.1 - by Jonny5 - 13.05.2012, 16:07
Re: Bit_Flags 0.1 - by Ballu Miaa - 14.05.2012, 00:53
Re: Bit_Flags 0.1 - by Jonny5 - 14.05.2012, 18:31

Forum Jump:


Users browsing this thread: 1 Guest(s)