How to make 3PlayerTextLabel NameTag System
#1

Hello All

i want to make 3playertextlabel nametag system like this Max Williams not Max_Williams

Like True Roleplay Server.
Reply
#2

bits from my script - create a new label for each player
Код:
new PlayerText3D:PlayerLabel[SLOTS];
Attach label to player at the spawn (use some kind of variable to do it only once)
Код:
PlayerLabel[playerid] = Create3DTextLabel("Player's Label", 0xFFFFFFFF, x, y, z, drawdistance, vw, testlos);
Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid, x, y, z);
UpdatePlayerLabel(playerid); //custom function
And update it every time it's needed.
Код:
//UpdatePlayerLabel
GetPlayerHealth(playerid, pHealth);
GetPlayerArmour(playerid, pArmour);
format(stc,sizeof(stc),"\n\n\n{BFBFBF}%s\n{FFFFFF}%.0f hp, %.0f armour", RemoveUnderScore(playerid), pHealth, pArmour);
Update3DTextLabelText(PlayerLabel[playerid], 0xFFFFFFFF, stc);
And don't forget to destroy the label when player is leaving the server.
Reply
#3

i want it without HP & Armour and are you sure the name without _ this?
Reply
#4

Then just remove hp/armour integers so only %s (string with name) will be left.
And i forgot to post the RemoveUnderScore stock, sorry. There you go:
Код:
stock RemoveUnderScore(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
Reply
#5

Don't forget that you will need to hide the original SA-MP nametags by using the code below in your OnGameModeInit() callback.

Код:
public OnGameModeInit()
{
    // This will fully disable all player nametags
    // (including health and armour bars)
    ShowNameTags(0);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)