SetPlayerNametagShowing: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(9 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server client function}} | ||
{{New feature|3|1.0|This function allows you to set whether a player's nametag visibility both clientside and serverside}} | |||
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. | ||
Line 9: | Line 10: | ||
bool setPlayerNametagShowing ( player thePlayer, bool showing ) | bool setPlayerNametagShowing ( player thePlayer, bool showing ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[player]]:setNametagShowing|nametagShowing|isPlayerNametagShowing}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' Define the player whos tag visiblity status you want to change | *'''thePlayer:''' Define the player whos tag visiblity status you want to change | ||
Line 21: | Line 21: | ||
This script will turn off player tags for everyone | This script will turn off player tags for everyone | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
--Store all the players in the server into | 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 | |||
for | |||
setPlayerNametagShowing ( | |||
end | end | ||
end | end | ||
addEventHandler ( "onResourceStart", | addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) | ||
function | function onPlayerJoin ( ) | ||
-- Whoever joins the server should also have their nametags deactivated | -- Whoever joins the server should also have their nametags deactivated | ||
setPlayerNametagShowing ( source, false ) | setPlayerNametagShowing ( source, false ) | ||
end | end | ||
addEventHandler ( "onPlayerJoin", root, | addEventHandler ( "onPlayerJoin", root, onPlayerJoin ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 41: | Line 39: | ||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} | ||
[[ar:setPlayerNametagShowing]] |
Latest revision as of 14:12, 24 March 2016
This function allows you to set whether a player's nametag visibility both clientside and serverside
Use this to define whether the player's name tag is visible or invisible.
Syntax
bool setPlayerNametagShowing ( player thePlayer, bool showing )
OOP Syntax Help! I don't understand this!
- Method: player:setNametagShowing(...)
- Variable: .nametagShowing
- Counterpart: isPlayerNametagShowing
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
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
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState