<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=STKrush</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=STKrush"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/STKrush"/>
	<updated>2026-04-29T14:27:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementVisibleTo&amp;diff=68108</id>
		<title>SetElementVisibleTo</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementVisibleTo&amp;diff=68108"/>
		<updated>2020-12-26T00:47:34Z</updated>

		<summary type="html">&lt;p&gt;STKrush: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
{{Needs_Checking|Can an element only be visible to one element (and its children) at a time? If so, do we need clearElementVisibleTo? If not, surely we need to remove the root element before using this function?&lt;br /&gt;
&lt;br /&gt;
Does the order of setElementVisibleTo calls really not matter? [[visibility|Visibility]] seems to ''imply'' that the order does matter.&lt;br /&gt;
&lt;br /&gt;
Is this function particularly ''or only'' useful for changing the visibility of markers, radar blips and radar areas?|[[User:EAi|EAi]][[User:Iam2noob4u|Iam2noob4u]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This function can change an [[element]]'s [[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 that contribute to the physics engine). This function is particularly useful for changing the visibility of markers, radar blips and radar areas.&lt;br /&gt;
&lt;br /&gt;
Visibility settings of lower elements in the element tree override higher ones - if visibility for root is set to false and for a player is set to true, it will be visible to the player.&lt;br /&gt;
&lt;br /&gt;
If you want to clear all visibility settings of an object, try [[clearElementVisibleTo]]&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementVisibleTo ( element theElement, element visibleTo, bool visible )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setVisibleTo||isElementVisibleTo}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The element you want to control the visibility of.&lt;br /&gt;
*'''visibleTo:''' The element you wish the element to be visible or invisible to. Any child elements that are players will also be able to see the element. See [[visibility]].&lt;br /&gt;
*'''visible:''' Whether you are making it visible or invisible to the player.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the element's visibility was changed successfully, ''false'' otherwise, for example if you are trying to change the visibility of a vehicle, player or object.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a marker and makes it only visibile to the player called 'someguy'.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Find the player called someguy&lt;br /&gt;
local someguy = getPlayerFromName ( &amp;quot;someguy&amp;quot; )&lt;br /&gt;
-- If the player was found then&lt;br /&gt;
if ( someguy ) then&lt;br /&gt;
	-- Get the player's position into the variables x, y and z&lt;br /&gt;
	x, y, z = getElementPosition ( someguy )&lt;br /&gt;
	-- Create a marker at the player's position&lt;br /&gt;
	myMarker = createMarker ( x, y, z )&lt;br /&gt;
	&lt;br /&gt;
	-- Then make the marker invisible to the whole dimension (root for the first)&lt;br /&gt;
	setElementVisibleTo ( myMarker, root, false )&lt;br /&gt;
	-- Set marker visibility to true for someguy&lt;br /&gt;
	setElementVisibleTo ( myMarker, someguy, true )&lt;br /&gt;
	&lt;br /&gt;
	-- The order in which you do the visibility changes does not matter, but ideally trues should be set before falses in order to prevent a momentary flicker.&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example shows how to make the marker visible to everyone except anotherguy&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Find the player called someguy&lt;br /&gt;
local someguy = getPlayerFromName ( &amp;quot;someguy&amp;quot; )&lt;br /&gt;
local anotherguy = getPlayerFromName ( &amp;quot;anotherguy&amp;quot; )&lt;br /&gt;
-- If the player was found then&lt;br /&gt;
if ( someguy ) then&lt;br /&gt;
	-- Get the player's position into the variables x, y and z&lt;br /&gt;
	x, y, z = getElementPosition ( someguy )&lt;br /&gt;
	-- Create a marker at the player's position&lt;br /&gt;
	myMarker = createMarker ( x, y, z )&lt;br /&gt;
	attachElements(myMarker, someguy)&lt;br /&gt;
&lt;br /&gt;
	-- First make sure everyone is able to see the marker, this line is unnecessary in this case as root visibility is set to true by default behaviour&lt;br /&gt;
	setElementVisibleTo ( myMarker, root, true )&lt;br /&gt;
&lt;br /&gt;
	-- Then hide it from anotherguy&lt;br /&gt;
	setElementVisibleTo ( myMarker, anotherguy, false )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element_functions}}&lt;/div&gt;</summary>
		<author><name>STKrush</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsTransferBoxActive&amp;diff=59549</id>
		<title>IsTransferBoxActive</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsTransferBoxActive&amp;diff=59549"/>
		<updated>2018-09-29T21:19:32Z</updated>

		<summary type="html">&lt;p&gt;STKrush: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function returns whether the file downloading dialog box is active or not. This appears when a resource is started and the client doesn't have all the files that resource requires the client to have.&lt;br /&gt;
&lt;br /&gt;
It's important to note that resources aren't started on the client until they're completely downloaded, so a resource cannot use this function to detect if it's own files are downloaded. A client-side resource triggers the [[onClientResourceStart]] event when the files it requires are downloaded.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool isTransferBoxActive ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the file transfer box is visible, ''false'' if not.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This makes the camera fade in, once all resource downloads are finished.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
resourceRoot = getResourceRootElement(getThisResource())&lt;br /&gt;
function checkTransfer()&lt;br /&gt;
	if isTransferBoxActive() then&lt;br /&gt;
		setTimer(checkTransfer,2000,1) -- Check again after 2 seconds&lt;br /&gt;
	else &lt;br /&gt;
		fadeCamera(true)  -- TransferBox isnt active, fade in camera&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;,resourceRoot,checkTransfer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>STKrush</name></author>
	</entry>
</feed>