Attach3DTextLabelToPlayer -
Nourdin - 21.12.2013
Hello there,
If someone in my server goes onduty by typing /adminduty the admintag will appear on other people's head aswell which causes some problem. Can anyone help me?
Код:
PlayerInfo[playerid][Adminduty] = Create3DTextLabel(">> ADMIN DUTY! <<", COLOR_RED, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(PlayerInfo[playerid][Adminduty], playerid, 0.0, 0.0, 0.7);
PlayerInfo[playerid][AdminDuty] = true;
Thanks
Re: Attach3DTextLabelToPlayer -
Nourdin - 21.12.2013
BUMP
Re: Attach3DTextLabelToPlayer -
ikey07 - 22.12.2013
show whole /adminduty cmd
Re: Attach3DTextLabelToPlayer -
Nourdin - 22.12.2013
It's not only the adminduty, I just see people running around with a tag above their head. It is a weird bug.
Re: Attach3DTextLabelToPlayer -
CutX - 22.12.2013
don't forget to destroy the label when they go off duty OR disconnect while on duty.
when they go off duty OR disconnect while on duty,
also, just sayin' this if you din't do that:
you also must set the PlayerInfo[playerid][AdminDuty] to false.
if, lets say playerid 14 is onduty and crashes while being onduty and a new player connects with the playerid 14,
he'd be on duty cuz you didn't set the enum to false in onplayerdisconnect
but well, i can't tell if you did that or not, since you didn't show us the command yet :/
Re: Attach3DTextLabelToPlayer -
BlackWolf120 - 22.12.2013
Handle textlabels like this:
pawn Код:
new Text3D:label[MAX_PLAYERS],
Admin[MAX_PLAYERS];
public OnGameModeInit()//just create it here, we update it later
{
foreach(Player,i)
{
label[i] = Create3DTextLabel("", -1, 0, 0, 0, 10.0, 0, 0);
}
return 1;
}
public OnPlayerSpawn(playerid)//we update it on spawn and attach it to the player
{
if(Admin[playerid]>0)//if player is admin, update the admin label
{
s[24];
format(s, sizeof(s), "%s", Admin[playerid]);
Update3DTextLabelText(label[playerid],-1,s);
}
else Update3DTextLabelText(label[playerid],-1," ");//else delete/emtpy it
Attach3DTextLabelToPlayer(label[playerid], playerid, 0, 0, 0.3);
return 1;
}
//In case you want to "delete" the label, just empty it using:
Update3DTextLabelText(label[playerid], -1, " ");
This is an simple example, ofc you have to adjust this to your needs (change "label[playerid]" to your labelID ect).
This is a very simpel method and will work for sure!

I also had issues regarding this in the past but this method fixed it.
Hope this helps
Re: Attach3DTextLabelToPlayer -
Nourdin - 22.12.2013
Thank you for the replies, I hope it will work.
Both of you repped!