<?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=Cro+Capy</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=Cro+Capy"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Cro_Capy"/>
	<updated>2026-04-29T19:49:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetLocalPlayer&amp;diff=35866</id>
		<title>GetLocalPlayer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetLocalPlayer&amp;diff=35866"/>
		<updated>2013-05-07T15:51:56Z</updated>

		<summary type="html">&lt;p&gt;Cro Capy: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the player element of the client running the current script. &lt;br /&gt;
&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
You can use the predefined variable '''localPlayer''' instead of typing getLocalPlayer()&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player getLocalPlayer ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the local [[player]] element.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This client side function outputs the player's current location to the console.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- we get the local player (we do this outside of the function body so it isn't retrieved every time&lt;br /&gt;
-- the function is called, since the local player never changes)&lt;br /&gt;
&lt;br /&gt;
function outputLocalPlayerPosition ( )&lt;br /&gt;
	-- get the local player's position&lt;br /&gt;
	local px, py, pz = getElementPosition ( getLocalPlayer ( ) )&lt;br /&gt;
	-- output it to the console&lt;br /&gt;
	outputConsole ( &amp;quot;Your location: &amp;quot; .. px .. &amp;quot; &amp;quot; .. py .. &amp;quot; &amp;quot; .. pz )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This client side script makes the local player's camera flash red after being hit.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function flashRed ( )&lt;br /&gt;
	-- fade out the local player's camera to red during a second&lt;br /&gt;
	fadeCamera( false, 1.0, 255, 0, 0 )&lt;br /&gt;
	-- set a 500 ms (0.5 sec) timer to fade it back in before it has completely faded out&lt;br /&gt;
	setTimer( fadeCamera, 500, 1, true, 1.0 )&lt;br /&gt;
end&lt;br /&gt;
-- we attach our 'flashRed' function to be a handler of &amp;quot;onClientPlayerDamage&amp;quot; when its source (that is, the hit player) is the local player&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerDamage&amp;quot;, getLocalPlayer ( ), flashRed )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_player_functions}}&lt;/div&gt;</summary>
		<author><name>Cro Capy</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetLocalPlayer&amp;diff=35865</id>
		<title>GetLocalPlayer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetLocalPlayer&amp;diff=35865"/>
		<updated>2013-05-07T15:51:16Z</updated>

		<summary type="html">&lt;p&gt;Cro Capy: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the player element of the client running the current script. &lt;br /&gt;
&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
You can use the predefined variable '''localPlayer''' instead of typing getLocalPlayer()&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player getLocalPlayer ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the local [[player]] element.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This client side function outputs the player's current location to the console.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- we get the local player (we do this outside of the function body so it isn't retrieved every time&lt;br /&gt;
-- the function is called, since the local player never changes)&lt;br /&gt;
&lt;br /&gt;
function outputLocalPlayerPosition ( )&lt;br /&gt;
	-- get the local player's position&lt;br /&gt;
	local px, py, pz = getElementPosition ( localPlayer )&lt;br /&gt;
	-- output it to the console&lt;br /&gt;
	outputConsole ( &amp;quot;Your location: &amp;quot; .. px .. &amp;quot; &amp;quot; .. py .. &amp;quot; &amp;quot; .. pz )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This client side script makes the local player's camera flash red after being hit.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function flashRed ( )&lt;br /&gt;
	-- fade out the local player's camera to red during a second&lt;br /&gt;
	fadeCamera( false, 1.0, 255, 0, 0 )&lt;br /&gt;
	-- set a 500 ms (0.5 sec) timer to fade it back in before it has completely faded out&lt;br /&gt;
	setTimer( fadeCamera, 500, 1, true, 1.0 )&lt;br /&gt;
end&lt;br /&gt;
-- we attach our 'flashRed' function to be a handler of &amp;quot;onClientPlayerDamage&amp;quot; when its source (that is, the hit player) is the local player&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerDamage&amp;quot;, getLocalPlayer ( ), flashRed )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_player_functions}}&lt;/div&gt;</summary>
		<author><name>Cro Capy</name></author>
	</entry>
</feed>