<?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=Dealman</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=Dealman"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Dealman"/>
	<updated>2026-05-06T09:44:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsMouseInPosition&amp;diff=46033</id>
		<title>IsMouseInPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsMouseInPosition&amp;diff=46033"/>
		<updated>2015-10-14T12:34:03Z</updated>

		<summary type="html">&lt;p&gt;Dealman: Added modified version for hovering the cursor over texts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to check whether the mouse cursor/pointer is within a rectangular position&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMouseInPosition ( int x, int y, int width, int height )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''x''': Left-most X position for detection (absolute)&lt;br /&gt;
* '''y''': Top-most Y position for detection (absolute)&lt;br /&gt;
* '''width''': Width for detection (absolute)&lt;br /&gt;
* '''heigh''': Height for detection (absolute)&lt;br /&gt;
&lt;br /&gt;
===Return===&lt;br /&gt;
Returns true/false depending on whether the mouse is within the specified position or not&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
    function isMouseInPosition ( x, y, width, height )&lt;br /&gt;
    if ( not isCursorShowing ( ) ) then&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    local sx, sy = guiGetScreenSize ( )&lt;br /&gt;
    local cx, cy = getCursorPosition ( )&lt;br /&gt;
    local cx, cy = ( cx * sx ), ( cy * sy )&lt;br /&gt;
    if ( cx &amp;gt;= x and cx &amp;lt;= x + width ) and ( cy &amp;gt;= y and cy &amp;lt;= y + height ) then&lt;br /&gt;
        return true&lt;br /&gt;
    else&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Modified version for DX Text&lt;br /&gt;
function isCursorOverText(posX, posY, sizeX, sizeY)&lt;br /&gt;
    if(isCursorShowing()) then&lt;br /&gt;
        local cX, cY = getCursorPosition()&lt;br /&gt;
        local cX, cY = (cX*screenWidth), (cY*screenHeight)&lt;br /&gt;
        if(cX &amp;gt;= posX and cX &amp;lt;= posX+(sizeX - posX)) and (cY &amp;gt;= posY and cY &amp;lt;= posY+(sizeY - posY)) then&lt;br /&gt;
            return true&lt;br /&gt;
        else&lt;br /&gt;
            return false&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        return false	&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Changes the image when you move your cursor over it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
    addEventHandler ( &amp;quot;onClientRender&amp;quot;, root,&lt;br /&gt;
    function ( )&lt;br /&gt;
        local imgX, imgY, imgWidth, imgHeight = 50, 50, 200, 200&lt;br /&gt;
        dxDrawImage ( imgX, imgY, imgWidth, imgHeight, ( isMouseInPosition ( imgX, imgY, imgWidth, imgHeight ) and &amp;quot;myImage2.png&amp;quot; or &amp;quot;myImage.png&amp;quot; ), tocolor ( 255, 255, 255 ) )&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Castillo&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Dealman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientVehicleDamage&amp;diff=39084</id>
		<title>OnClientVehicleDamage</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientVehicleDamage&amp;diff=39084"/>
		<updated>2014-03-14T22:33:52Z</updated>

		<summary type="html">&lt;p&gt;Dealman: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client event}}&lt;br /&gt;
{{New items|4.0140|1.3.5|&lt;br /&gt;
This event is triggered when a vehicle is damaged.&lt;br /&gt;
}}&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 theAttacker, int theWeapon, float loss, float damagePosX, float damagePosY, float damagePosZ, int tyreID&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''theAttacker''': An element if there was an attacker.&lt;br /&gt;
*'''theWeapon''': An integer specifying the weapon ID if a weapon was used.&lt;br /&gt;
*'''loss''': A float representing the amount of damage taken.&lt;br /&gt;
*'''damagePosX''': A float representing the X co-ordinate of where the damage took place.&lt;br /&gt;
*'''damagePosX''': A float representing the Y co-ordinate of where the damage took place.&lt;br /&gt;
*'''damagePosX''': A float representing the Z co-ordinate of where the damage took place.&lt;br /&gt;
*'''tyreID''': A number representing the tyre which took damage, if there is one.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[vehicle]] that got damaged.&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
If this event is [[Event system#Canceling|canceled]], the vehicle will not be damaged.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example makes every SWAT tank immune from all weapon attacks.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handleVehicleDamage(attacker, weapon, loss, x, y, z, tyre)&lt;br /&gt;
    if (weapon and getElementModel(source) == 601) then&lt;br /&gt;
        -- A weapon was used and the vehicle model ID is that of the SWAT tank so cancel the damage.&lt;br /&gt;
        cancelEvent()&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleDamage&amp;quot;, root, handleVehicleDamage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example allows the Rhino to take damage from bullets even though they're bullet proof, this example doesn't work with explosions though.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Only let these weapons damage a Rhino&lt;br /&gt;
local weaponsToDamageRhino = {&lt;br /&gt;
	[38] = true, -- minigun&lt;br /&gt;
	[33] = true, -- country rifle&lt;br /&gt;
	[34] = true, -- sniper rifle&lt;br /&gt;
	[30] = true, -- AK-47&lt;br /&gt;
	[31] = true, -- M4&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function handleRhinoDamage(attacker, weapon, loss, x, y, z, tyre)&lt;br /&gt;
	if (weapon and getElementModel(source) == 432 and loss &amp;gt; 0) then&lt;br /&gt;
		if (weaponsToDamageRhino[weapon]) then&lt;br /&gt;
			setElementHealth(source, getElementHealth(source) - loss)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleDamage&amp;quot;, root, handleRhinoDamage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example will prevent your vehicle from taking damage by being lit on fire.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function preventFireDamage_Handler(theAttacker, theWeapon)&lt;br /&gt;
	if(theWeapon == 37) then&lt;br /&gt;
		cancelEvent()&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleDamage&amp;quot;, getRootElement(), preventFireDamage_Handler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client vehicle events===&lt;br /&gt;
{{Client_vehicle_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Dealman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPreRender&amp;diff=39019</id>
		<title>OnClientPreRender</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPreRender&amp;diff=39019"/>
		<updated>2014-03-02T11:06:38Z</updated>

		<summary type="html">&lt;p&gt;Dealman: /* Warning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}} &lt;br /&gt;
This event is triggered every time before GTA renders a new frame.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float timeSlice&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''timeSlice:''' The interval between this frame and the previous one in milliseconds (delta time).&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes the camera follow the player in a GTA2-like way.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
root = getRootElement ()&lt;br /&gt;
function updateCamera ()&lt;br /&gt;
	local x, y, z = getElementPosition ( getLocalPlayer () )&lt;br /&gt;
	setCameraMatrix ( x, y, z + 50, x, y, z )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPreRender&amp;quot;, root, updateCamera )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Warning==&lt;br /&gt;
This event and [[onClientRender]] will trigger whatever function it is attached to with every frame. Depending on the server's maximum FPS and what your computer might handle - you might end up triggering the function 30-60 times '''per second'''.&lt;br /&gt;
&lt;br /&gt;
As a result, this event may cause severe lag and/or even crashes if not used cautiously.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===[[Game_Processing_Order|Game Processing Order]]===&lt;br /&gt;
===Other client events===&lt;br /&gt;
{{Client_other_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Dealman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPreRender&amp;diff=39018</id>
		<title>OnClientPreRender</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPreRender&amp;diff=39018"/>
		<updated>2014-03-02T11:06:21Z</updated>

		<summary type="html">&lt;p&gt;Dealman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}} &lt;br /&gt;
This event is triggered every time before GTA renders a new frame.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float timeSlice&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''timeSlice:''' The interval between this frame and the previous one in milliseconds (delta time).&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes the camera follow the player in a GTA2-like way.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
root = getRootElement ()&lt;br /&gt;
function updateCamera ()&lt;br /&gt;
	local x, y, z = getElementPosition ( getLocalPlayer () )&lt;br /&gt;
	setCameraMatrix ( x, y, z + 50, x, y, z )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPreRender&amp;quot;, root, updateCamera )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Warning==&lt;br /&gt;
This event and [[onClientPreRender]] will trigger whatever function it is attached to with every frame. Depending on the server's maximum FPS and what your computer might handle - you might end up triggering the function 30-60 times '''per second'''.&lt;br /&gt;
&lt;br /&gt;
As a result, this event may cause severe lag and/or even crashes if not used cautiously.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===[[Game_Processing_Order|Game Processing Order]]===&lt;br /&gt;
===Other client events===&lt;br /&gt;
{{Client_other_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Dealman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientRender&amp;diff=39017</id>
		<title>OnClientRender</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientRender&amp;diff=39017"/>
		<updated>2014-03-02T11:06:07Z</updated>

		<summary type="html">&lt;p&gt;Dealman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}} &lt;br /&gt;
This event is triggered every time GTA renders a new frame. It is required for the DirectX drawing functions, and also useful for other clientside operations that have to be applied repeatedly with very short time differences between them.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
''None''&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes the camera follow the player in a GTA2-like way. This will be a little bit laggy. If you want the camera to follow something (eg. player or vehicle) then use [[onClientPreRender]] instead.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function updateCamera ()&lt;br /&gt;
	local x, y, z = getElementPosition ( localPlayer )&lt;br /&gt;
	setCameraMatrix ( x, y, z + 50, x, y, z )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientRender&amp;quot;, root, updateCamera )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Warning==&lt;br /&gt;
This event and [[onClientPreRender]] will trigger whatever function it is attached to with every frame. Depending on the server's maximum FPS and what your computer might handle - you might end up triggering the function 30-60 times '''per second'''.&lt;br /&gt;
&lt;br /&gt;
As a result, this event may cause severe lag and/or even crashes if not used cautiously.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===[[Game_Processing_Order|Game Processing Order]]===&lt;br /&gt;
===Other client events===&lt;br /&gt;
{{Client_other_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Dealman</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxGUI/dxCreateScrollBar&amp;diff=35581</id>
		<title>DxGUI/dxCreateScrollBar</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxGUI/dxCreateScrollBar&amp;diff=35581"/>
		<updated>2013-04-26T14:50:08Z</updated>

		<summary type="html">&lt;p&gt;Dealman: Created page with &amp;quot;==Example== {{Client function}} &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; dxTestWindow = exports.dxgui:dxCreateWindow(resourceRoot, 445, 150, 608, 335, &amp;quot;Main Window&amp;quot;, tocolor(255,255,255,255), &amp;quot;default&amp;quot;, &amp;quot;Lig...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Example==&lt;br /&gt;
{{Client function}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
dxTestWindow = exports.dxgui:dxCreateWindow(resourceRoot, 445, 150, 608, 335, &amp;quot;Main Window&amp;quot;, tocolor(255,255,255,255), &amp;quot;default&amp;quot;, &amp;quot;Lighter Black&amp;quot;)&lt;br /&gt;
dxTestScrollBar = exports.dxgui:dxCreateScrollBar(resourceRoot, 25, 102, 242, 19, dxTestWindow, &amp;quot;Horizontal/Vertical&amp;quot;, 0, 100, &amp;quot;Lighter Black&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dealman</name></author>
	</entry>
</feed>