ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setPlayerNametagColor

Function

setPlayerNametagColor

ServerPlayersIdentical to MTA:SA

Sets the colour of the nametag above the player's head (everyone sees it; it takes precedence over the colour from setPlayerNametagStyle). The player's nickname in chat uses this colour too.

Syntax

bool setPlayerNametagColor(player thePlayer, int/false r, int g, int b)

Arguments

thePlayerplayer
The player.
rint/false
Red 0-255, or false = the default colour (from setPlayerNametagStyle, otherwise the built-in one).
gint
Green 0-255.
bint
Blue 0-255.

Returns

true on success.

Example

addEventHandler("onPlayerTeamChange", root, function(oldTeam, newTeam)
    if newTeam then
        setPlayerNametagColor(source, getTeamColor(newTeam))
    end
end)

See also