SA-MP Forums Archive
How to make 3PlayerTextLabel NameTag System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make 3PlayerTextLabel NameTag System (/showthread.php?tid=597678)



How to make 3PlayerTextLabel NameTag System - Barnwell - 03.01.2016

Hello All

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

Like True Roleplay Server.


Re: How to make 3PlayerTextLabel NameTag System - lucamsx - 03.01.2016

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.


Re: How to make 3PlayerTextLabel NameTag System - Barnwell - 03.01.2016

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


Re: How to make 3PlayerTextLabel NameTag System - lucamsx - 03.01.2016

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;
}



Re: How to make 3PlayerTextLabel NameTag System - HarrisonC - 03.01.2016

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);
}