Issue with mask
#1

Hello, When i buy a mask and do /maskon it makes all the players in the server with no name tag/armour except me, How can i fix it so it hides only the player's name and armour not the whole server...


Код:
	if(strcmp(cmd, "/maskon", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	if(PlayerInfo[playerid][pMask] == 0)
	   	 	{
	   		     SendClientMessage(playerid, COLOR_GRAD1, "** You don't have a mask");
	   		     return 1;
	   		}
	   		if(PlayerInfo[playerid][pLevel] < 5)
	    	{
	       		SendClientMessage(playerid, COLOR_GRAD1, "** You are not able to use it.");
	        	return 1;
	    	}
	    	PlayerInfo[playerid][pMaskuse] = 1;
   			SendClientMessage(playerid, -1,"You are now masked and your name is hidden.");
   			for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, false);
      		new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskon",d,m,y,h,mi,s,sendername);
			CommandLog(string);
		}
		return 1;
	}

	if(strcmp(cmd, "/maskoff", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	if(PlayerInfo[playerid][pMask] == 0)
	    	{
	       		SendClientMessage(playerid, COLOR_GRAD1, "   You don't have a mask");
	        	return 1;
	    	}
	    	if(PlayerInfo[playerid][pLevel] < 5)
	    	{
	        	SendClientMessage(playerid, COLOR_GRAD1, "   You are not able to use it.");
	        	return 1;
	    	}
			for(new i = 0; i < MAX_PLAYERS; i++)
	        {
  		    	if(IsPlayerConnected(i))
   		    	{
		   	      ShowPlayerNameTagForPlayer(playerid, i, true);
			}
		}
			PlayerInfo[playerid][pMaskuse] = 0;
			SendClientMessage(playerid, COLOR_GREEN, "You took off your mask off [/maskon to put it on].");
      		format(string, sizeof(string), "* %s puts a mask away.", sendername);
      		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
      		new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskoff",d,m,y,h,mi,s,sendername);
			CommandLog(string);
		}
		return 1;
	}
Reply
#2

Код:
for(new i = 0; i < MAX_PLAYERS; i++) 
{
    ShowPlayerNameTagForPlayer(i, playerid, false);
}
You had it backwards bud.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)