- Documentation
- Client functions
- setNametagsEnabled
Function
setNametagsEnabled
Turns the built-in nametags above other players' heads on or off for the local player. A shortcut for setNametagStyle({ enabled = ... }); useful when a resource draws its own nametags.
Syntax
bool setNametagsEnabled(bool enabled)Arguments
enabledboolfalsehides the built-in nametags.
Returns
true on success.
Example
setNametagsEnabled(false)
addEventHandler("onClientRender", root, function()
for _, player in ipairs(getElementsByType("player", root, true)) do
if player ~= localPlayer then
local x, y, z = getElementPosition(player)
local sx, sy = getScreenFromWorldPosition(x, y, z + 1.1)
if sx then dxDrawText(getPlayerName(player), sx, sy) end
end
end
end)
See also
areNametagsEnabledChecks whether the built-in nametags above heads are on for the local player.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.