- Documentation
- Server functions
- setPlayerNametagStyle
Function
setPlayerNametagStyle
Sets the look of the built-in nametags above other players' heads as seen by this player (or everyone: root). Pass only the fields to change; the rest stay. Fields: enabled (bool, false hides the built-in nametags, e.g. when a resource draws its own with dxDrawText), distance (metres, 0 = no limit), showDistance (bool, the "12 m" suffix after the nickname), scale (0.4–4, text size), color (a colour from tocolor or false = default colour), background (a background colour from tocolor or false = no background). A single player's colour, text and hiding (setPlayerNametagColor, setPlayerNametagText, setPlayerNametagShowing) take precedence over the style. After reconnecting set the style again.
Syntax
bool setPlayerNametagStyle(player thePlayer, table style)Arguments
thePlayerplayer- A player or
root. styletable- The fields to change.
Returns
true on success; false for a bad field.
Example
addEventHandler("onPlayerJoin", root, function()
setPlayerNametagStyle(source, { distance = 40, showDistance = false, scale = 1.2 })
end)
See also
getPlayerNametagStyleReturns the nametag look set for the player withsetPlayerNametagStyle(a table with the fieldsenabled,distance,showDistance,scale,color,background).setNametagStyleSets the look of the built-in nametags above other players' heads for the local player. Fields as insetPlayerNametagStyle:enabled,distance,showDistance,scale,color,background; pass only the ones to change.setNametagsEnabledTurns the built-in nametags above other players' heads on or off for the local player. A shortcut forsetNametagStyle({ enabled = ... }); useful when a resource draws its own nametags.setPlayerNametagColorSets the colour of the nametag above the player's head (everyone sees it; it takes precedence over the colour fromsetPlayerNametagStyle). The player's nickname in chat uses this colour too.