ClearElementVisibleTo: 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__  
__NOTOC__  
{{Server function}}
This function clears any settings added by setElementVisibleTo and restores an element to its default visibility.  This does not work with all entities - [[vehicle]]s, [[player]]s and [[object]]s are exempt. This is because these objects are required for accurate sync (they're physical objects). This function is particularily useful for changing the visibility of markers, radar blips and radar areas.
This function clears any settings added by setElementVisibleTo and restores an element to its default visibility.  This does not work with all entities - [[vehicle]]s, [[player]]s and [[object]]s are exempt. This is because these objects are required for accurate sync (they're physical objects). This function is particularily useful for changing the visibility of markers, radar blips and radar areas.


Line 14: Line 15:


==Example==  
==Example==  
<section name="Server" class="server" show="true">
This example clears any visibility settings after a player dies, so everyone can see his blip for a short period
This example clears any visibility settings after a player dies, so everyone can see his blip for a short period
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 21: Line 23:
addEventHandler ( "onPlayerWasted", getRootElement(), clearVisibilityWasted  ) --add an event handler for onPlayerWasted
addEventHandler ( "onPlayerWasted", getRootElement(), clearVisibilityWasted  ) --add an event handler for onPlayerWasted
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Element_functions}}
{{Element_functions}}

Revision as of 16:14, 15 August 2007

This function clears any settings added by setElementVisibleTo and restores an element to its default visibility. This does not work with all entities - vehicles, players and objects are exempt. This is because these objects are required for accurate sync (they're physical objects). This function is particularily useful for changing the visibility of markers, radar blips and radar areas.

Syntax

bool clearElementVisibleTo ( element theElement )   

Required Arguments

  • element: The element in which you wish to restore to its default visibility

Returns

Returns true if the operation was successful, false otherwise.

Example

Click to collapse [-]
Server

This example clears any visibility settings after a player dies, so everyone can see his blip for a short period

function clearVisibilityWasted ( totalammo, killer, killerweapon, bodypart ) -- when a player dies
    clearElementVisibleTo ( getBlipAttachedTo ( source ) ) -- clear any visiblity settings of his blip
end
addEventHandler ( "onPlayerWasted", getRootElement(), clearVisibilityWasted  ) --add an event handler for onPlayerWasted

See Also