[HELP] ShowPlayerNameTagForPlayer - SOLVED
#1

I'm having a problem with this code:
pawn Код:
if(strcmp(cmd, "/maskon", true) == 0) // by Ellis
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pMask] == 0)
            {
               SendClientMessage(playerid, COLOR_GRAD1, "  You don't have a mask");
               return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 2)
        {
                SendClientMessage(playerid, COLOR_GRAD1, " You can't use it.");
            return 1;
        }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                ShowPlayerNameTagForPlayer(playerid,i, 0);
            }
            PlayerInfo[playerid][pMaskuse] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "  You have put your mask on [/maskoff to put it away].");
            GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* %s puts a mask on.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
You told me in the last post to add this:
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  if(PlayerInfo[playerid][pMaskuse] == 1)
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 1);
  else
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);
}
It didn't work,i can still see their name.
Reply
#2

Quote:
Originally Posted by Uniqueee
I'm having a problem with this code:
pawn Код:
if(strcmp(cmd, "/maskon", true) == 0) // by Ellis
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pMask] == 0)
            {
              SendClientMessage(playerid, COLOR_GRAD1, " You don't have a mask");
              return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 2)
        {
            SendClientMessage(playerid, COLOR_GRAD1, " You can't use it.");
            return 1;
        }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                ShowPlayerNameTagForPlayer(playerid,i, 0);
            }
            PlayerInfo[playerid][pMaskuse] = 1;
            SendClientMessage(playerid, COLOR_WHITE, " You have put your mask on [/maskoff to put it away].");
            GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* %s puts a mask on.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
You told me in the last post to add this:
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  if(PlayerInfo[playerid][pMaskuse] == 1)
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 1);
  else
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);
}
It didn't work,i can still see their name.
Try changing the Player you're checking the mask. And try not making more than one topic for the same subject.
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  if(PlayerInfo[forplayerid][pMaskuse] == 1)
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 1);
  else
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);
}
Reply
#3

Quote:
Originally Posted by wafffllesss
Quote:
Originally Posted by Uniqueee
I'm having a problem with this code:
pawn Код:
if(strcmp(cmd, "/maskon", true) == 0) // by Ellis
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pMask] == 0)
            {
               SendClientMessage(playerid, COLOR_GRAD1, "  You don't have a mask");
               return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 2)
        {
                SendClientMessage(playerid, COLOR_GRAD1, " You can't use it.");
            return 1;
        }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                ShowPlayerNameTagForPlayer(playerid,i, 0);
            }
            PlayerInfo[playerid][pMaskuse] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "  You have put your mask on [/maskoff to put it away].");
            GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* %s puts a mask on.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
You told me in the last post to add this:
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  if(PlayerInfo[playerid][pMaskuse] == 1)
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 1);
  else
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);
}
It didn't work,i can still see their name.
Try changing the Player you're checking the mask. And try not making more than one topic for the same subject.
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  if(PlayerInfo[forplayerid][pMaskuse] == 1)
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 1);
  else
    ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);
}
You didn't change anything. You mean ShowPlayerNameTagForPlayer(playerid,forplayerid, 0); ?
I am making new posts because when there are more than 3 comments people think i got the answers.

Edit: i tried,it didn't work.
Reply
#4

pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  ShowPlayerNameTagForPlayer(playerid, forplayerid, PlayerInfo[playerid][pMaskuse]);
}
Reply
#5

Quote:
Originally Posted by CrαcK
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  ShowPlayerNameTagForPlayer(playerid, forplayerid, PlayerInfo[playerid][pMaskuse]);
}
Thanks Crack but it didn't work,it hides my name for 1 second only :[
I didn't change anything in /maskon,just added the callback you gave me to the buttom.
Thank you for attempting to help me,anyone?
I tried to set a timer for it,that will set ShowPlayerNameTagForPlayer 0 if he is using a mask.
It worked good but the problem is that i set the timer to 1 millisecond and i think it isn't good.
I mean it might crash the server,right?
Reply
#6

Quote:
Originally Posted by Uniqueee
Quote:
Originally Posted by CrαcK
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
  ShowPlayerNameTagForPlayer(playerid, forplayerid, PlayerInfo[playerid][pMaskuse]);
}
Thanks Crack but it didn't work,it hides my name for 1 second only :[
I didn't change anything in /maskon,just added the callback you gave me to the buttom.
Thank you for attempting to help me,anyone?
I tried to set a timer for it,that will set ShowPlayerNameTagForPlayer 0 if he is using a mask.
It worked good but the problem is that i set the timer to 1 millisecond and i think it isn't good.
I mean it might crash the server,right?
Do you have "ShowNameTags(1);" in your OnGameModeInit?
if you do... try setting it to 0 "ShowNameTags(0);" or removing it from the script.
Reply
#7

Let me make it clear.. half the replies have this wrong

Код:
ShowPlayerNameTagForPlayer(forplayer, playerid, false);

forplayer Player who will see the results of this function
playerid  Player whose name tag will be shown or hidden
false   false(hidden) true(shown)
Reply
#8

Quote:
Originally Posted by Μαστερμινδ
Let me make it clear.. half the replies have this wrong

Код:
ShowPlayerNameTagForPlayer(forplayer, playerid, false);

forplayer Player who will see the results of this function
playerid Player whose name tag will be shown or hidden
false   false(hidden) true(shown)
Thank you,but still..it is different in 0.3,i mean you need to add the OnPlayerStreamin.
It hides the player for a second only.
Reply
#9

Do you have morphinc included? You need to disable it, because it is enables/disabled the names based on how close you are to the other player.
Reply
#10

Nice you are right it works now
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)