Removing 3D label from player
#9

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
pawn Код:
//may i ask: Why "pid" and not "playerid"?
Attach3DTextLabelToPlayer(PlayerInfo[pid][pPlayername], playerid, 0, 0, 0.3);
//Also you have to update the label...
As i already said, i would create a label for every player in advance.

pawn Код:
new Text3D:label[MAX_PLAYERS],
    namestring[MAX_PLAYER_NAME];

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
{
    format(namestring, sizeof(namestring), "%s", GetName(playerid));
    Update3DTextLabelText(label[playerid],-1,namestring);
    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, " ");
Just change the "label[playerid]" to your labelID.

This is a very simpel method and will work for sure!

Hope this helps
Noob question here: How would it know what "Player" is on OnGameModeInit?
Reply


Messages In This Thread
Removing 3D label from player - by Mattakil - 17.12.2013, 22:39
Re: Removing 3D label from player - by BlackWolf120 - 17.12.2013, 22:43
Re: Removing 3D label from player - by Mattakil - 17.12.2013, 22:50
Re: Removing 3D label from player - by BlackWolf120 - 17.12.2013, 22:57
Re: Removing 3D label from player - by Mattakil - 17.12.2013, 23:10
Re: Removing 3D label from player - by BlackWolf120 - 17.12.2013, 23:25
Re: Removing 3D label from player - by Mattakil - 18.12.2013, 00:08
Re: Removing 3D label from player - by Mattakil - 18.12.2013, 00:23
Re: Removing 3D label from player - by Hansrutger - 18.12.2013, 00:30
Re: Removing 3D label from player - by BlackWolf120 - 18.12.2013, 18:03

Forum Jump:


Users browsing this thread: 2 Guest(s)