<?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=Mkl</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=Mkl"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Mkl"/>
	<updated>2026-04-25T20:18:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerClick&amp;diff=75908</id>
		<title>OnPlayerClick</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerClick&amp;diff=75908"/>
		<updated>2022-12-31T14:58:53Z</updated>

		<summary type="html">&lt;p&gt;Mkl: /* Use of predefined variable in example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when a player clicks using the mouse cursor.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mouseButton, string buttonState, element clickedElement, float worldPosX, float worldPosY, float worldPosZ, float screenPosX, float screenPosY&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''mouseButton''': a [[string]] representing the mouse button that was pressed. Value can be ''left'', ''middle'' or ''right''.&lt;br /&gt;
*'''buttonState''': a [[string]] representing the button state. Value can be ''up'' or ''down''.&lt;br /&gt;
*'''clickedElement''': the [[element]] the [[player]] clicked on. This value is ''nil'' if none.&lt;br /&gt;
*'''worldPosX''': the X position in the world the [[player]] clicked on.&lt;br /&gt;
*'''worldPosY''': the Y position in the world the [[player]] clicked on.&lt;br /&gt;
*'''worldPosZ''': the Z position in the world the [[player]] clicked on.&lt;br /&gt;
*'''screenPosX''': the X position on the screen the [[player]] clicked on.&lt;br /&gt;
*'''screenPosY''': the Y position on the screen the [[player]] clicked on.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[player]] that clicked.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs the state of the button they just pressed.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputClick(mouseButton, buttonState)&lt;br /&gt;
	outputChatBox(&amp;quot;Your &amp;quot;..mouseButton..&amp;quot; mouse button is now &amp;quot;..buttonState,source,255,255,0) -- output the state of the button they just pressed.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerClick&amp;quot;, root, outputClick) -- When a player clicks trigger the outputClick function&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Player events}}&lt;/div&gt;</summary>
		<author><name>Mkl</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerBan&amp;diff=75907</id>
		<title>OnPlayerBan</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerBan&amp;diff=75907"/>
		<updated>2022-12-31T14:56:32Z</updated>

		<summary type="html">&lt;p&gt;Mkl: /* Use of predefined variable root instead of getRootElement() in example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when a player added a [[ban]] (like [[onBan]]).&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
ban banPointer, player responsibleElement&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''banPointer''': the [[ban]] pointer which was added.&lt;br /&gt;
*'''responsibleElement''': the [[player]] who added the ban.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[player]] who was banned.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs the responsible element and the banned player's name when a ban takes place.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputBan ( banPointer, responsibleElement ) -- Define the banner and the ban pointer in the function.&lt;br /&gt;
	local banner = getPlayerName( responsibleElement ) or &amp;quot;Console&amp;quot; -- Get the banner's name.&lt;br /&gt;
	&lt;br /&gt;
	outputChatBox ( banner ..&amp;quot; has banned &amp;quot;.. getPlayerName( source ) ..&amp;quot;.&amp;quot;, root, 255, 0, 0 ) -- Output the ban.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerBan&amp;quot;, root, outputBan ) -- Trigger the function when there is a ban.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03908|Fixed responsible element parameter}}&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Player events}}&lt;br /&gt;
&lt;br /&gt;
[[ru:onPlayerBan]]&lt;/div&gt;</summary>
		<author><name>Mkl</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnElementDimensionChange&amp;diff=75906</id>
		<title>OnElementDimensionChange</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnElementDimensionChange&amp;diff=75906"/>
		<updated>2022-12-31T14:32:47Z</updated>

		<summary type="html">&lt;p&gt;Mkl: /* Explanation and comments for the example*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{Added feature/item|1.5.9|1.5.8|20724|This event is triggered when the dimension of an [[element]] is changed using [[setElementDimension]].}}&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int oldDimension, int newDimension&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''oldDimension''': An [[int]] representing the dimension the [[element]] was in before.&lt;br /&gt;
*'''newDimension''': An [[int]] representing the dimension the [[element]] is in now.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] that changed its dimension.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example prints the old and the new dimension of a vehicle&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local vehicle = createVehicle (411, 0, 0, 3) -- create a vehicle&lt;br /&gt;
setTimer (setElementDimension, 1000, 1, vehicle, 10) -- set a new dimension to the vehicle after 1 second&lt;br /&gt;
&lt;br /&gt;
-- add an event handler to onElementDimensionChange attached to the vehicle&lt;br /&gt;
addEventHandler (&amp;quot;onElementDimensionChange&amp;quot;, vehicle,&lt;br /&gt;
	function (oldDimension, newDimension)&lt;br /&gt;
		 -- print the old and the new vehicle's dimension&lt;br /&gt;
		outputChatBox (inspect (source) .. &amp;quot;'s dimension changed from &amp;quot; .. oldDimension .. &amp;quot; to &amp;quot; .. newDimension)&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.5.8-9.20724|n/a|}}&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Element events}}&lt;/div&gt;</summary>
		<author><name>Mkl</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnElementColShapeHit&amp;diff=75904</id>
		<title>OnElementColShapeHit</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnElementColShapeHit&amp;diff=75904"/>
		<updated>2022-12-31T14:08:55Z</updated>

		<summary type="html">&lt;p&gt;Mkl: /* Use of predefine variable root instead of getRootElement() in example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when an player or vehicle element collides with a colshape.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
colshape theColShape, bool matchingDimension&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''theColShape''': the [[colshape]] that this [[element]] collided with.&lt;br /&gt;
*'''matchingDimension''': a [[boolean]] representing if the [[element]] and the [[colshape]] are in the same [[dimension]].&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[player]] or [[vehicle]] that collided with the colshape.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example prints type of the element which entered the created colshape to chatbox.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
colArea = createColCircle( 1400.0, -700.0, 5.0 ) -- create the colshape&lt;br /&gt;
&lt;br /&gt;
function elementColShapeHit( colShapeHit )&lt;br /&gt;
    if colShapeHit == colArea then -- if element entered the created colshape&lt;br /&gt;
        outputChatBox( getElementType( source ) .. &amp;quot; entered the colCircle!&amp;quot; ) -- print the type of the element to chatbox&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onElementColShapeHit&amp;quot;, root, elementColShapeHit ) -- add a handler function for the event&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Element events}}&lt;/div&gt;</summary>
		<author><name>Mkl</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnColShapeHit&amp;diff=75903</id>
		<title>OnColShapeHit</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnColShapeHit&amp;diff=75903"/>
		<updated>2022-12-31T14:06:33Z</updated>

		<summary type="html">&lt;p&gt;Mkl: /*Use of predefine variable root instead of getRootElement() in examples*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{Note|The hit won't be detected if the [[element]] that entered the colshape is a colshape.}}&lt;br /&gt;
This event is triggered when a physical [[element]] hits a [[colshape]].&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element hitElement, bool matchingDimension&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''hitElement''': the [[element]] that entered the colshape.&lt;br /&gt;
*'''matchingDimension''': a [[boolean]] referring to whether the hit collision shape was in the same [[dimension]] as the element.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[colshape]] that got hit by a player or vehicle.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a hill area for a ''King of the hill'' gamemode.  When a player enters or leaves the area, it's announced in the chatbox.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create our hill area for our gamemode&lt;br /&gt;
local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 15, 15 )&lt;br /&gt;
&lt;br /&gt;
-- add hill_Enter as a handler for when a player enters the hill area&lt;br /&gt;
function hill_Enter ( thePlayer, matchingDimension )&lt;br /&gt;
        if getElementType ( thePlayer ) == &amp;quot;player&amp;quot; then --if the element that entered was player&lt;br /&gt;
                --let's get the name of the player&lt;br /&gt;
                local nameOfThePlayer = getPlayerName ( thePlayer )&lt;br /&gt;
	        --announce to everyone that the player entered the hill&lt;br /&gt;
	        outputChatBox ( nameOfThePlayer..&amp;quot; entered the zone!&amp;quot;, root, 255, 255, 109 )&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, hillArea, hill_Enter )&lt;br /&gt;
&lt;br /&gt;
-- add hill_Enter as a handler for when a player leaves the hill area&lt;br /&gt;
function hill_Exit ( thePlayer, matchingDimension )&lt;br /&gt;
        if getElementType ( thePlayer ) == &amp;quot;player&amp;quot; then --if the element that left was player&lt;br /&gt;
	        --check if the player is not dead&lt;br /&gt;
	        if isPlayerDead ( thePlayer ) ~= true then&lt;br /&gt;
                        --let's get the name of the player&lt;br /&gt;
                        local nameOfThePlayer = getPlayerName ( thePlayer )&lt;br /&gt;
	        	--if he was alive, announce to everyone that the player has left the hill&lt;br /&gt;
	        	outputChatBox ( nameOfThePlayer..&amp;quot; left the zone!&amp;quot;, root, 255, 255, 109 )&lt;br /&gt;
	        end&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onColShapeLeave&amp;quot;, hillArea, hill_Exit )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Colshape events}}&lt;/div&gt;</summary>
		<author><name>Mkl</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerVehicleEnter&amp;diff=75902</id>
		<title>OnPlayerVehicleEnter</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerVehicleEnter&amp;diff=75902"/>
		<updated>2022-12-31T13:45:41Z</updated>

		<summary type="html">&lt;p&gt;Mkl: /* Use of predefined variable root instead of getRootElement() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when a [[player]] enters a vehicle.&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
vehicle theVehicle, int seat, ped jacked&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''theVehicle''': a [[vehicle]] element representing the vehicle that was entered.&lt;br /&gt;
*'''seat''': an [[int]] representing the seat in which the player is entering.&lt;br /&gt;
*'''jacked''': a [[player]] or [[ped]] element representing who has been jacked.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[player]] that entered the vehicle.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example forces a player out of a police vehicle if he is not a policeman.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
policeVehicles = { [598]=true, [596]=true, [597]=true, [599]=true }&lt;br /&gt;
policeSkins = { [280]=true, [281]=true, [282]=true, [283]=true, [284]=true, [285]=true, [286]=true }&lt;br /&gt;
&lt;br /&gt;
function enterVehicle ( theVehicle, seat, jacked ) --when a player enters a vehicle&lt;br /&gt;
    if ( policeVehicles[getElementModel ( theVehicle )] ) and ( not policeSkins[getElementModel ( source )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin&lt;br /&gt;
        removePedFromVehicle ( source ) -- force the player out of the vehicle&lt;br /&gt;
        outputChatBox ( &amp;quot;Only policeman can enter police cars!&amp;quot;, source ) -- and tell the player why&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, enterVehicle ) -- add an event handler for onPlayerVehicleEnter&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example adds a 'moto' helmet to a player when he gets on a nrg bike, and removes it when he gets off.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function addHelmetOnEnter ( theVehicle, seat, jacked )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 522 ) then -- if its a nrg&lt;br /&gt;
        addPedClothes ( source, &amp;quot;moto&amp;quot;, &amp;quot;moto&amp;quot;, 16 ) -- add the helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, addHelmetOnEnter )&lt;br /&gt;
&lt;br /&gt;
function removeHelmetOnExit ( theVehicle, seat, jacked )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 522 ) then -- if its a nrg&lt;br /&gt;
        removePedClothes ( source, 16 ) -- remove the helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, root, removeHelmetOnExit )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Player events}}&lt;/div&gt;</summary>
		<author><name>Mkl</name></author>
	</entry>
</feed>