SetPlayerNametagShowing: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server client function}}
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
{{New feature|3|1.0|This function allows you to set whether a player's nametag visibility both clientside and serverside (Serverside only DP2.x)}}
 
Use this to define whether the player's name tag is visible or invisible.
Use this to define whether the player's name tag is visible or invisible.



Revision as of 19:40, 1 January 2009

This function allows you to set whether a player's nametag visibility both clientside and serverside (Serverside only DP2.x)

Use this to define whether the player's name tag is visible or invisible.

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

Returns true if successful, false otherwise

Example

This script will turn off player tags for everyone

root = getRootElement ( )
-- Store all the players in the server into a table
players = getElementsByType ( "player" )

function ResourceStart ( name, root )
    for k,v in ipairs ( players ) do              -- for all the players in the table
        setPlayerNametagShowing ( v, false )      -- turn off their nametag
    end
end
addEventHandler ( "onResourceStart", root, ResourceStart )

function PlayerJoin ()
      -- Whoever joins the server should also have their nametags deactivated
	setPlayerNametagShowing ( source, false )
end
addEventHandler ( "onPlayerJoin", root, PlayerJoin )

See Also