02.07.2014, 13:46
pawn Код:
#include <a_samp>
#include <zcmd>
new bool:pUsingMask[MAX_PLAYERS];
stock EnablePlayerName(playerid,bool:status) {
for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, status)
return true;
}
stock RetrievePlayerName(playerid) {
new name[MAX_PLAYER_NAME];
if(pUsingMask[playerid]) {
format(name,sizeof(name),"Masked player");
} else {
GetPlayerName(playerid,name,sizeof(name));
}
return name;
}
CMD:mask(playerid,params[]) {
if(pUsingMask[playerid]) {
pUsingMask[playerid] = false;
SendClientMessage(playerid,-1,"Mask disabled, all players will now see your name.");
EnablePlayerName(playerid,true);
} else {
pUsingMask[playerid] = true;
SendClientMessage(playerid,-1,"Mask enabled, all players won't see your name.");
EnablePlayerName(playerid,false);
}
return true;
}
public OnPlayerConnect(playerid) {
for(new i = 0; i < MAX_PLAYERS; i++) {
ShowPlayerNameTag(playerid,i,pUsingMask[playerid]);
}
return true;
}
public OnPlayerText(playerid,text[]) {
format(text,sizeof(text),"%s says: %s",RetrievePlayerName,text);
SendClientMessageToAll(-1,text);
return 0;
}
If there is any error please contact me.
Little explanation:
I made a function which enables/disables player name tag.
For new players who connected later someone used /mask command, i sync them into the system, so they won't see your name if you're masked too.
I made another function which checks if you're masked or not, then the function is called when player speaks.
/mask checks if you're masked or not, and it will mask / unmask you automatically.

