<?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=MrIssam</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=MrIssam"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/MrIssam"/>
	<updated>2026-06-02T03:42:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetSearchLightEndPosition&amp;diff=62790</id>
		<title>GetSearchLightEndPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetSearchLightEndPosition&amp;diff=62790"/>
		<updated>2019-05-24T16:37:37Z</updated>

		<summary type="html">&lt;p&gt;MrIssam: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
&lt;br /&gt;
This function gets the end position of a [[Element/Searchlight|searchlight]] element.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float getSearchLightEndPosition ( searchlight theSearchLight )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/Searchlight|searchLight]]:getEndPosition|endPosition|setSearchLightEndPosition}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theSearchLight''': the searchlight to get the position where the searchlight's light cone ends.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If the specified searchlight element is valid, this function will return three ''float'', which are the three coordinates of searchlight's end position. If not, it will return ''false'' plus an error message.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
local helmetLantern&lt;br /&gt;
&lt;br /&gt;
local function updateHelmetLantern()&lt;br /&gt;
    local helmetPos, playerMatrix = Vector3(getPedBonePosition(localPlayer, 6)), getElementMatrix(localPlayer)&lt;br /&gt;
    local targetPos = Vector3(playerMatrix[4][1] + playerMatrix[2][1] * 3, playerMatrix[4][2] + playerMatrix[2][2] * 3, playerMatrix[4][3] + playerMatrix[2][3] * 3)&lt;br /&gt;
    -- If the searchlight we use for the effect doesn't exist, create it&lt;br /&gt;
    -- If it is already created, then simply update its start and end positions&lt;br /&gt;
    if not helmetLantern then&lt;br /&gt;
        helmetLantern = createSearchLight(helmetPos, targetPos, 0, 15)&lt;br /&gt;
		local a , b = getSearchLightEndPosition(helmetLantern)&lt;br /&gt;
		outputChatBox(a ..&amp;quot; &amp;quot;..b)&lt;br /&gt;
    else&lt;br /&gt;
        setSearchLightStartPosition(helmetLantern, helmetPos)&lt;br /&gt;
        setSearchLightEndPosition(helmetLantern, targetPos)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function manageHelmetLantern()&lt;br /&gt;
    local helmetLanternOff = not helmetLantern&lt;br /&gt;
    playSoundFrontEnd(helmetLanternOff and 37 or 38)&lt;br /&gt;
    if helmetLanternOff then&lt;br /&gt;
        -- Let updateHelmetLantern take care of creating and updating the effect&lt;br /&gt;
        addEventHandler(&amp;quot;onClientPreRender&amp;quot;, root, updateHelmetLantern)&lt;br /&gt;
    else&lt;br /&gt;
        -- Stop updateHelmetLantern doing its job and clear variables&lt;br /&gt;
        removeEventHandler(&amp;quot;onClientPreRender&amp;quot;, root, updateHelmetLantern)&lt;br /&gt;
        destroyElement(helmetLantern)&lt;br /&gt;
        helmetLantern = nil&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Allow the player to turn the helmet lantern or on off by using /togglelantern or pressing O&lt;br /&gt;
addCommandHandler(&amp;quot;togglelantern&amp;quot;, manageHelmetLantern)&lt;br /&gt;
bindKey(&amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, manageHelmetLantern)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Client_searchlight_functions}}&lt;/div&gt;</summary>
		<author><name>MrIssam</name></author>
	</entry>
</feed>