/mask command
#1

pawn Код:
CMD:mask(playerid, params[])
{
  new name[MAX_PLAYER_NAME];
  new string[128];
  if (PlayerInfo[playerid][pMaskOwner] == 1)
     {
   if(PlayerInfo[playerid][pMask] == 0)
  {
     new rand = 1000 + random(8999);
     MaskID[playerid] = rand;
     for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, false);
     PlayerInfo[playerid][pMask] = 1;
     format(string, sizeof(string), "\n\nStranger_%d", MaskID[playerid]);
     MaskLabel[playerid] = CreateDynamic3DTextLabel(string, WHITE, 0, 0, -20, 25, playerid);
     Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, MaskLabel[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.30);
     GetPlayerName(playerid, name, sizeof(name));
     format(string, sizeof(string), "* %s has put a mask on.", name);
     ProxDetector(15.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  }
   else if(PlayerInfo[playerid][pMask] == 1)
   {
     DestroyDynamic3DTextLabel(MaskLabel[playerid]);
     for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(playerid, i, true);
     MaskID[playerid] = 0;
     PlayerInfo[playerid][pMask] = 0;
     GetPlayerName(playerid, name, sizeof(name));
     format(string, sizeof(string), "* %s has put their mask away.", name);
     ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   }
 }
  else
  {
          SendClientMessageEx(playerid, COLOR_WHITE, "You haven't bought a mask.");
     }
     return 1;
}
The player's nametag doesn't disappear. How do I fix this?
Reply
#2

Quote:

ShowNameTags must be set to 1 to be able to show name tags with ShowPlayerNameTagForPlayer, that means that in order to be effective you need to ShowPlayerNameTagForPlayer(forplayerid, playerid, 0) ahead of time(OnPlayerStreamIn is a good spot).

So you have to
pawn Код:
public OnGameModeInit()
{
    ShowNameTags(1);//ADD THIS
Reply
#3

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
So you have to
pawn Код:
public OnGameModeInit()
{
    ShowNameTags(1);//ADD THIS
Didn't help.
Reply
#4

Quote:

CMD:mask(playerid, params[])
{
new name[MAX_PLAYER_NAME];
new string[128];
if (PlayerInfo[playerid][pMaskOwner] == 1)
{
if(PlayerInfo[playerid][pMask] == 0)
{
new rand = 1000 + random(8999);
MaskID[playerid] = rand;
foreach(Player, i) { ShowPlayerNameTagForPlayer(i, playerid, 0);}
PlayerInfo[playerid][pMask] = 1;
format(string, sizeof(string), "\n\nStranger_%d", MaskID[playerid]);
MaskLabel[playerid] = CreateDynamic3DTextLabel(string, WHITE, 0, 0, -20, 25, playerid);
Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, MaskLabel[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.30);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s has put a mask on.", name);
ProxDetector(15.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLO R_PURPLE,COLOR_PURPLE);
}
else if(PlayerInfo[playerid][pMask] == 1)
{
DestroyDynamic3DTextLabel(MaskLabel[playerid]);
foreach(Player, i) { ShowPlayerNameTagForPlayer(i, playerid, 1);}
MaskID[playerid] = 0;
PlayerInfo[playerid][pMask] = 0;
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s has put their mask away.", name);
ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You haven't bought a mask.");
}
return 1;
}

Try that?
Reply
#5

Oh I got it, replace
pawn Код:
ShowPlayerNameTagForPlayer(playerid, i, true);
to
pawn Код:
ShowPlayerNameTagForPlayer(i, playerid, true);
Check this for information

Quote:

ShowPlayerNameTagForPlayer(playerid, showplayerid, show)

playerid Player who will see the results of this function
showplayerid Player whose name tag will be shown or hidden
show 1-show name tag, 0-hide name tag

Reply
#6

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Oh I got it, replace
pawn Код:
ShowPlayerNameTagForPlayer(playerid, i, true);
to
pawn Код:
ShowPlayerNameTagForPlayer(i, playerid, true);
Check this for information
Still not working...
Reply
#7

How, what happens ?
(Are you a "mask owner") ?
Reply
#8

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
How, what happens ?
(Are you a "mask owner") ?
The mask label appears but the name tag doesn't disappear.
Reply
#9

pawn Код:
public OnGameModeInit()
{
    ShowNameTags(1);
}

CMD:mask(playerid, params[])
{
    if(!PlayerInfo[playerid][pMaskOwner]) return SendClientMessageEx(playerid, COLOR_WHITE, "You haven't bought a mask.");

    new name[MAX_PLAYER_NAME], string[128];

    if(!PlayerInfo[playerid][pMask])
    {
        new MaskID[playerid] = 1000 + random(8999);

        for(new i; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
        PlayerInfo[playerid][pMask] = 1;
       
        format(string, sizeof(string), "\n\nStranger_%d", MaskID[playerid]);
        MaskLabel[playerid] = CreateDynamic3DTextLabel(string, WHITE, 0, 0, -20, 25, playerid);
        Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, MaskLabel[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.30);

        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "* %s has put a mask on.", name);
        ProxDetector(15.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    else
    {
        DestroyDynamic3DTextLabel(MaskLabel[playerid]);
        for(new i; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
        MaskID[playerid] = 0;
        PlayerInfo[playerid][pMask] = 0;
       
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "* %s has put their mask away.", name);
        ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }

    return 1;
}
Reply
#10

Try,
PHP код:
 ShowPlayerNameTagForPlayer(iplayeridfalse); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)