ShowPlayerHudComponent: Difference between revisions
Jump to navigation
Jump to search
m (added radar component) |
No edit summary |
||
(21 intermediate revisions by 13 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
{{Deprecated|setPlayerHudComponentVisible}} | |||
This function will show or hide a part of the player's HUD. | This function will show or hide a part of the player's HUD. | ||
{{Deprecated_feature|3|1.0| | |||
Component 'clock' does not hide the clock | |||
}} | |||
==Syntax== | ==Syntax== | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool showPlayerHudComponent ( player thePlayer, string component, bool show ) | bool showPlayerHudComponent ( player thePlayer, string component, bool show ) | ||
Line 8: | Line 16: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' | *'''thePlayer:''' The player element for which you wish to show/hide a HUD component | ||
*'''component:''' The component you wish to show or hide. Valid values are: | |||
:*'''ammo:''' The display showing how much ammo the player has in their weapon | |||
:*'''area_name:''' The text that appears containing the name of the area a player has entered | |||
:*'''armour:''' The display showing the player's armor | |||
:*'''breath:''' The display showing the player's breath | |||
:*'''clock:''' The display showing the in-game time | |||
:*'''health:''' The display showing the player's health | |||
:*'''money:''' The display showing how much money the player has | |||
:*'''radar:''' The bottom-left corner miniradar | |||
:*'''vehicle_name:''' The text that appears containing the player's vehicle name when the player enters a vehicle | |||
:*'''weapon:''' The display showing the player's weapon | |||
{{New feature|3.0110|1.1| | |||
:*'''radio:''' The display showing the radio label | |||
:*'''wanted:''' The display showing the player's wanted level | |||
:*'''crosshair:''' The weapon crosshair and sniper scope | |||
:*'''all:''' All of the above at the same time | |||
}} | |||
*'''show:''' Specify if the component should be shown (''true'') or hidden (''false'') | |||
</section> | |||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
bool showPlayerHudComponent ( string component, bool show ) | |||
</syntaxhighlight> | |||
===Required Arguments=== | |||
*'''component:''' The component you wish to show or hide. Valid values are: | *'''component:''' The component you wish to show or hide. Valid values are: | ||
:*'''ammo:''' The display showing how much ammo the player has in their weapon | :*'''ammo:''' The display showing how much ammo the player has in their weapon | ||
Line 14: | Line 47: | ||
:*'''armour:''' The display showing the player's armor | :*'''armour:''' The display showing the player's armor | ||
:*'''breath:''' The display showing the player's breath | :*'''breath:''' The display showing the player's breath | ||
:*'''clock:''' The display showing the in-game time | |||
:*'''health:''' The display showing the player's health | :*'''health:''' The display showing the player's health | ||
:*'''money:''' The display showing how much money the player has | :*'''money:''' The display showing how much money the player has | ||
Line 19: | Line 53: | ||
:*'''vehicle_name:''' The text that appears containing the player's vehicle name when the player enters a vehicle | :*'''vehicle_name:''' The text that appears containing the player's vehicle name when the player enters a vehicle | ||
:*'''weapon:''' The display showing the player's weapon | :*'''weapon:''' The display showing the player's weapon | ||
*'''show:''' Specify if the | {{New feature/item|3.0110|1.1|| | ||
:*'''radio:''' The display showing the radio label | |||
:*'''wanted:''' The display showing the player's wanted level | |||
:*'''crosshair:''' The weapon crosshair and sniper scope | |||
:*'''all:''' All of the above at the same time | |||
}} | |||
*'''show:''' Specify if the component should be shown (''true'') or hidden (''false'') | |||
</section> | |||
===Returns=== | ===Returns=== | ||
Line 25: | Line 66: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
This example hides the ammo and weapon displays for players when they join. | This example hides the ammo and weapon displays for players when they join. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function hudChanger () | function hudChanger () | ||
showPlayerHudComponent ( source, "ammo", false ) -- Hide the ammo displays for the newly joined player | |||
showPlayerHudComponent ( source, "weapon", false ) -- Hide the weapon displays for the newly joined player | |||
end | end | ||
-- Make our hudChanger function called when the player joins | |||
addEventHandler ( "onPlayerJoin", root, hudChanger ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Player_functions}} | {{Player_functions}} |
Latest revision as of 09:17, 4 November 2020
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use setPlayerHudComponentVisible instead. |
This function will show or hide a part of the player's HUD.
Syntax
Click to collapse [-]
Serverbool showPlayerHudComponent ( player thePlayer, string component, bool show )
Required Arguments
- thePlayer: The player element for which you wish to show/hide a HUD component
- component: The component you wish to show or hide. Valid values are:
- ammo: The display showing how much ammo the player has in their weapon
- area_name: The text that appears containing the name of the area a player has entered
- armour: The display showing the player's armor
- breath: The display showing the player's breath
- clock: The display showing the in-game time
- health: The display showing the player's health
- money: The display showing how much money the player has
- radar: The bottom-left corner miniradar
- vehicle_name: The text that appears containing the player's vehicle name when the player enters a vehicle
- weapon: The display showing the player's weapon
- radio: The display showing the radio label
- wanted: The display showing the player's wanted level
- crosshair: The weapon crosshair and sniper scope
- all: All of the above at the same time
- show: Specify if the component should be shown (true) or hidden (false)
Click to collapse [-]
Clientbool showPlayerHudComponent ( string component, bool show )
Required Arguments
- component: The component you wish to show or hide. Valid values are:
- ammo: The display showing how much ammo the player has in their weapon
- area_name: The text that appears containing the name of the area a player has entered
- armour: The display showing the player's armor
- breath: The display showing the player's breath
- clock: The display showing the in-game time
- health: The display showing the player's health
- money: The display showing how much money the player has
- radar: The bottom-left corner miniradar
- vehicle_name: The text that appears containing the player's vehicle name when the player enters a vehicle
- weapon: The display showing the player's weapon
- radio: The display showing the radio label
- wanted: The display showing the player's wanted level
- crosshair: The weapon crosshair and sniper scope
- all: All of the above at the same time
- show: Specify if the component should be shown (true) or hidden (false)
Returns
Returns true if the component was shown or hidden succesfully, false if an invalid argument was specified.
Example
Click to collapse [-]
ServerThis example hides the ammo and weapon displays for players when they join.
function hudChanger () showPlayerHudComponent ( source, "ammo", false ) -- Hide the ammo displays for the newly joined player showPlayerHudComponent ( source, "weapon", false ) -- Hide the weapon displays for the newly joined player end -- Make our hudChanger function called when the player joins addEventHandler ( "onPlayerJoin", root, hudChanger )
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