SetPlayerHudComponentVisible: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
{{Server client function}}


{{New items|3.0152|1.3.2|
This function will show or hide a part of the player's HUD.
}}


toffy to kurw jebany i jego matka jest dziwka
{{Deprecated_feature|3|1.0|
Component 'clock' does not hide the clock
}}
 
==Syntax==
 
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
bool setPlayerHudComponentVisible ( player thePlayer, string component, bool show )
</syntaxhighlight>
 
===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
{{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 setPlayerHudComponentVisible ( string component, bool show )
</syntaxhighlight>
 
===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
{{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 ''true'' if the component was shown or hidden succesfully, ''false'' if an invalid argument was specified.
 
==Requirements==
{{Requirements|1.3.2|1.3.2}}
 
==Example==
<section name="Server" class="server" show="true">
This example hides the ammo and weapon displays for players when they join.
<syntaxhighlight lang="lua">
-- Hide some of the hud components when a player joins the server
addEventHandler ( "onPlayerJoin", root,
    function ()
        setPlayerHudComponentVisible ( source, "ammo", false )    -- Hide the ammo displays for the newly joined player
        setPlayerHudComponentVisible ( source, "weapon", false )  -- Hide the weapon displays for the newly joined player
    end
)
</syntaxhighlight>
</section>
 
==See Also==
{{Player_functions}}

Revision as of 17:48, 11 January 2017

This function will show or hide a part of the player's HUD.

Syntax

Click to collapse [-]
Server
bool setPlayerHudComponentVisible ( 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 [-]
Client
bool setPlayerHudComponentVisible ( 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.

Requirements

This template will be deleted.

Example

Click to collapse [-]
Server

This example hides the ammo and weapon displays for players when they join.

-- Hide some of the hud components when a player joins the server
addEventHandler ( "onPlayerJoin", root, 
    function ()
        setPlayerHudComponentVisible ( source, "ammo", false )    -- Hide the ammo displays for the newly joined player
        setPlayerHudComponentVisible ( source, "weapon", false )  -- Hide the weapon displays for the newly joined player
    end
)

See Also