SA-MP Forums Archive
DisableNameTag help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DisableNameTag help (/showthread.php?tid=604091)



DisableNameTag help - justjamie - 31.03.2016

Hello,
i need help with my /name off & /name on.
It compiles, but nothing happends.
pawn Код:
{
    if(PlayerInfo[playerid][power] || PlayerInfo[playerid][premium] || PlayerInfo[playerid][playerteam]==HITMAN || PlayerInfo[playerid][playerteam]==FBI || PlayerInfo[playerid][playerlvl]>= 15)
    {
    new tmp[4];
    if(sscanf(params, "s", tmp)) return SCP(playerid, "[on/off]");
    if(strcmp(tmp,"on",true)==0)

    {
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    ShowPlayerNameTagForPlayer(playerid, i, true);
    PlayerTemp[playerid][hname]=0;
  }
  return 1;
    }
    else if(strcmp(tmp,"off",true)==0)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    ShowPlayerNameTagForPlayer(playerid, i, false);
    PlayerTemp[playerid][hname]=1;
  }
  return 1;
}
}
}
Anything wrong here?
hname is a diffrent script that makes the name Stranger


Re: DisableNameTag help - xTURBOx - 31.03.2016

ShowPlayerNameTagForPlayer
Show that function


Re: DisableNameTag help - introzen - 31.03.2016

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
ShowPlayerNameTagForPlayer
Show that function
ShowPlayerNameTagForPlayer is a native SAMP function.
https://sampwiki.blast.hk/wiki/ShowPlayerNameTagForPlayer

Quote:
Originally Posted by justjamie
Посмотреть сообщение
Hello,
i need help with my /name off & /name on.
It compiles, but nothing happends.
pawn Код:
{
    if(PlayerInfo[playerid][power] || PlayerInfo[playerid][premium] || PlayerInfo[playerid][playerteam]==HITMAN || PlayerInfo[playerid][playerteam]==FBI || PlayerInfo[playerid][playerlvl]>= 15)
    {
    new tmp[4];
    if(sscanf(params, "s", tmp)) return SCP(playerid, "[on/off]");
    if(strcmp(tmp,"on",true)==0)

    {
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    ShowPlayerNameTagForPlayer(playerid, i, true);
    PlayerTemp[playerid][hname]=0;
  }
  return 1;
    }
    else if(strcmp(tmp,"off",true)==0)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    ShowPlayerNameTagForPlayer(playerid, i, false);
    PlayerTemp[playerid][hname]=1;
  }
  return 1;
}
}
}
Anything wrong here?
hname is a diffrent script that makes the name Stranger
In order for ShowPlayerNameTagForPlayer to work, ShowNameTags must be set to 1. Also make sure you use ShowPlayerNameTagForPlayer in OnPlayerStreamIn.

pawn Код:
for(new i = GetPlayerPoolSize(); i != -1; --i) ShowPlayerNameTagForPlayer(i, playerid, false);
Your code makes every players name tag disappear for the player writing /name off.


Re: DisableNameTag help - justjamie - 02.04.2016

Quote:
Originally Posted by introzen
Посмотреть сообщение
Your code makes every players name tag disappear for the player writing /name off.
Makes sense, but how do i fix it?
I already have ShowNameTags(1);