/mask command
#6

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;
}
Made this in a few seconds.
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.
Reply


Messages In This Thread
/mask command - by CodyAlzack - 01.07.2014, 21:52
Re: /mask command - by Crystallize - 01.07.2014, 22:13
Re: /mask command - by CodyAlzack - 02.07.2014, 08:50
Re: /mask command - by CodyAlzack - 02.07.2014, 11:40
AW: /mask command - by NaS - 02.07.2014, 13:19
Re: /mask command - by icra - 02.07.2014, 13:46
Re: /mask command - by CodyAlzack - 02.07.2014, 16:42
Re: /mask command - by Konstantinos - 02.07.2014, 16:51
Re: /mask command - by greentarch - 02.07.2014, 16:52
Re: /mask command - by CodyAlzack - 02.07.2014, 17:39

Forum Jump:


Users browsing this thread: 1 Guest(s)