Attach3DTextLabelToPlayer
#1

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
Reply
#2

BUMP
Reply
#3

show whole /adminduty cmd
Reply
#4

It's not only the adminduty, I just see people running around with a tag above their head. It is a weird bug.
Reply
#5

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 :/
Reply
#6

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
Reply
#7

Thank you for the replies, I hope it will work.

Both of you repped!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)