SA-MP Forums Archive
ShowPlayerNameTagForPlayer Issue. - 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: ShowPlayerNameTagForPlayer Issue. (/showthread.php?tid=517860)



ShowPlayerNameTagForPlayer Issue. - Laure - 07.06.2014

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.");
        }
    }



Respuesta: ShowPlayerNameTagForPlayer Issue. - SickAttack - 07.06.2014

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



Re: ShowPlayerNameTagForPlayer Issue. - Laure - 07.06.2014

Which one do you mean by it?


Respuesta: ShowPlayerNameTagForPlayer Issue. - SickAttack - 07.06.2014

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.


Re: ShowPlayerNameTagForPlayer Issue. - Laure - 07.06.2014

Nope, thats just choosing the availability like /tog admtag


Re: ShowPlayerNameTagForPlayer Issue. - Laure - 07.06.2014

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


Re: ShowPlayerNameTagForPlayer Issue. - TheNeeraz - 07.06.2014

I also have the same problem.


Re: ShowPlayerNameTagForPlayer Issue. - Laure - 07.06.2014

Help me.


Re: ShowPlayerNameTagForPlayer Issue. - biker122 - 07.06.2014

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?


Re: ShowPlayerNameTagForPlayer Issue. - Laure - 07.06.2014

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