ShowPlayerNameTagForPlayer Issue.
#1

Hey there, created a admin tag system for my server, which can be toggled by a command by admins, but the problem is it hides the name tag only for those who also has admin tag toggled else it Shows both name tag and admin tag without hiding the health armor and name, and sometimes it even hide everything like in /mask command, its out of my capacity, Help me please, will provide rep as a thanks. Also there's my command that toggles admin tag.
pawn Код:
else if(!strcmp(params, "admtag", true))
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!AdminTag[playerid])
        {
            for(new i; i<MAX_PLAYERS; i++)
            {
                ShowPlayerNameTagForPlayer(playerid, i, false);
            }
            AdminTag[playerid] = 1;
            format(string, sizeof(string), "{FF6347}EG-RP Administrator\n{FFFFFF}%s\n{2641FE}%s", RPN(playerid), RPALN(playerid));
            Attach3DTextLabelToPlayer(AdminText[playerid], playerid, 0, 0, 0.25);
            if(IsValidDynamic3DTextLabel(AdminText[playerid])) DestroyDynamic3DTextLabel(AdminText[playerid]);
            AdminText[playerid] = CreateDynamic3DTextLabel(string, COLOR_WHITE, 0, 0, -20, 25, playerid);
            Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, AdminText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.25);
            SendClientMessage(playerid, COLOR_GREEN, "You have toggled your Admin Head Tag on.");
        }
        else
        {
            for(new i; i<MAX_PLAYERS; i++)
            {
                ShowPlayerNameTagForPlayer(playerid, i, true);
            }
            AdminTag[playerid] = 0;
            if(IsValidDynamic3DTextLabel(AdminText[playerid])) DestroyDynamic3DTextLabel(AdminText[playerid]);
            SendClientMessage(playerid, COLOR_DARKRED, "You have toggled your Admin Head Tag off.");
        }
    }
Reply
#2

Change it to this:
pawn Код:
for(new i; i<MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true/false);
Reply
#3

Which one do you mean by it?
Reply
#4

Like this:
pawn Код:
else if(!strcmp(params, "admtag", true))
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!AdminTag[playerid])
        {
            for(new i; i<MAX_PLAYERS; i++)
            {
                ShowPlayerNameTagForPlayer(i, playerid, false);
            }
            AdminTag[playerid] = 1;
            format(string, sizeof(string), "{FF6347}EG-RP Administrator\n{FFFFFF}%s\n{2641FE}%s", RPN(playerid), RPALN(playerid));
            Attach3DTextLabelToPlayer(AdminText[playerid], playerid, 0, 0, 0.25);
            if(IsValidDynamic3DTextLabel(AdminText[playerid])) DestroyDynamic3DTextLabel(AdminText[playerid]);
            AdminText[playerid] = CreateDynamic3DTextLabel(string, COLOR_WHITE, 0, 0, -20, 25, playerid);
            Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, AdminText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.25);
            SendClientMessage(playerid, COLOR_GREEN, "You have toggled your Admin Head Tag on.");
        }
        else
        {
            for(new i; i<MAX_PLAYERS; i++)
            {
                ShowPlayerNameTagForPlayer(i, playerid, true);
            }
            AdminTag[playerid] = 0;
            if(IsValidDynamic3DTextLabel(AdminText[playerid])) DestroyDynamic3DTextLabel(AdminText[playerid]);
            SendClientMessage(playerid, COLOR_DARKRED, "You have toggled your Admin Head Tag off.");
        }
    }
And why are you using strcmp to create commands? You should use ZCMD or y_commands.
Reply
#5

Nope, thats just choosing the availability like /tog admtag
Reply
#6

Woah, now other 3DLabel gets added along with my admin tag and appears along with it lol.
Reply
#7

I also have the same problem.
Reply
#8

Help me.
Reply
#9

Use foreach instead. Get foreach include (search).

At the top of your script
pawn Код:
#include <foreach>
pawn Код:
else if(!strcmp(params, "admtag", true))
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!AdminTag[playerid])
        {
            foreach(Player,i) ShowPlayerNameTagForPlayer(i,playerid,0);
            AdminTag[playerid] = 1;
            format(string, sizeof(string), "{FF6347}EG-RP Administrator\n{FFFFFF}%s\n{2641FE}%s", RPN(playerid), RPALN(playerid));

            AdminText[playerid] = CreateDynamic3DTextLabel(string, COLOR_WHITE, 0.0, 0.0, 0.4, 25, playerid);
            Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, AdminText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.25);
            SendClientMessage(playerid, COLOR_GREEN, "You have toggled your Admin Head Tag on.");
        }
        else if(AdminTag[playerid] == 1)
        {
            foreach(Player,i) ShowPlayerNameTagForPlayer(i,playerid,1);
            AdminTag[playerid] = 0;
            if(IsValidDynamic3DTextLabel(AdminText[playerid])) DestroyDynamic3DTextLabel(AdminText[playerid]);
            SendClientMessage(playerid, COLOR_DARKRED, "You have toggled your Admin Head Tag off.");
        }
    }
Maybe this?
Reply
#10

And about the random textlabel attached to above players head? What about it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)