setPlayerNametagShowing | Multi Theft Auto: Wiki Skip to content

setPlayerNametagShowing

Client-side
Server-side
Shared

Pair: isPlayerNametagShowing

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function allows you to set whether a player's nametag visibility both clientside and serverside

OOP Syntax Help! I don't understand this!

  • Method:player:setNametagShowing(...)
  • Variable: .nametagShowing

Syntax

bool setPlayerNametagShowing ( player thePlayer, bool showing )
Required Arguments
  • thePlayer: Define the player whos tag visiblity status you want to change
  • showing: Use true or false to show/hide the tag

Returns

  • bool: value

Returns true if successful, false otherwise

Code Examples

shared

This script will turn off player tags for everyone

function onResourceStart ( )
local players = getElementsByType ( "player" ) -- Store all the players in the server into a table
for key, player in ipairs ( players ) do -- for all the players in the table
setPlayerNametagShowing ( player, false ) -- turn off their nametag
end
end
addEventHandler ( "onResourceStart", resourceRoot, onResourceStart )
function onPlayerJoin ( )
-- Whoever joins the server should also have their nametags deactivated
setPlayerNametagShowing ( source, false )
end
addEventHandler ( "onPlayerJoin", root, onPlayerJoin )

See Also