Skip to content

Instantly share code, notes, and snippets.

@earlwlkr
Last active August 29, 2015 14:13
Show Gist options
  • Save earlwlkr/c9b7a9ea4ca9c87f9372 to your computer and use it in GitHub Desktop.
Save earlwlkr/c9b7a9ea4ca9c87f9372 to your computer and use it in GitHub Desktop.
#include <a_samp>
#include <YSI\y_iterate>
#include <zcmd>
new bool: wearing_mask[MAX_PLAYERS char];
public OnPlayerConnect(playerid)
{
wearing_mask{playerid} = false;
return 1;
}
CMD:mask(playerid, params[])
{
// Whatever.
if (IsPlayerAdmin(playerid))
return SendClientMessage(playerid, 0xAFAFAFAA, "Ban khong duoc phep su dung lenh nay!");
if (!wearing_mask{playerid})
SendClientMessage(playerid, 0xAFAFAFAA, "Ban da deo mat na ten cua ban da bi an");
else
SendClientMessage(playerid, 0xAFAFAFAA, "Ban da thao mat na ten cua ban da hien thi");
foreach (new i: Player)
{
// Current mask state (before toggling), because 'show' = ! wearing_mask.
ShowPlayerNameTagForPlayer(i, playerid, wearing_mask{playerid});
}
// Toggle mask flag.
wearing_mask{playerid} = !wearing_mask{playerid};
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment