08.04.2012, 22:00
(
Last edited by Jonny5; 13/05/2012 at 04:06 PM.
)
"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;
}