05.05.2014, 04:55
Hey there, I created tag system for admin in which they can toggle their admin tag above thier head with a command ie /tog admtag. It should work by hiding the players health bar armor bar and their names, and just show the tag which i created it worked fine but in a while after toggling it on and off for some couple of times i found a problem it sometime shows both, the admin tag and players original tag ( ie ,health bar, armor , name)
My code is like this i expect help from you guys so i could fix it and it works in proper manner.
Thanks in advance.
My code is like this i expect help from you guys so i could fix it and it works in proper manner.
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])
{
AdminTag[playerid] = 1;
foreach(Player, i)
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
format(string, sizeof(string), "{FF6347}UT-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
{
AdminTag[playerid] = 0;
foreach(Player, i)
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
if(IsValidDynamic3DTextLabel(AdminText[playerid])) DestroyDynamic3DTextLabel(AdminText[playerid]);
SendClientMessage(playerid, COLOR_DARKRED, "You have toggled your Admin Head Tag off.");
}
}