<?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=1Lorenzo</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=1Lorenzo"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/1Lorenzo"/>
	<updated>2026-05-16T23:48:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementID&amp;diff=82090</id>
		<title>GetElementID</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementID&amp;diff=82090"/>
		<updated>2025-06-02T12:05:07Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function gets the ID of an element. This is the &amp;quot;id&amp;quot; attribute of the element and is a string, NOT a number like a model ID, weapons ID or similar.&lt;br /&gt;
{{Note| This function can also be used to get the resource name of any ''resource-data''.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getElementID ( element theElement ) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getID|id|setElementID}} &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' the element from which to retrieve the ID.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This returns a ''string'' containing the element ID. It will return an empty ''string'' if it has no ID. It will return ''false'' if the element is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
To get the ID of the following element:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;flag id=&amp;quot;northflag&amp;quot; posX=&amp;quot;2365&amp;quot; posY=&amp;quot;215&amp;quot; posZ=&amp;quot;32&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You could use the following code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- assume flag refers to the flag element in the above XML code&lt;br /&gt;
idstring = getElementID ( flag )                   -- get the id of the flag element&lt;br /&gt;
outputChatBox ( &amp;quot;The flag's ID is: &amp;quot; .. idstring ) -- output: The flag's ID is: northflag&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another ex;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local obj = createObject(971, 0, 0, 3)&lt;br /&gt;
setElementID(obj, 'testObj')&lt;br /&gt;
&lt;br /&gt;
idstring = getElementID ( obj  )                   -- get the id of the object&lt;br /&gt;
outputChatBox ( &amp;quot;The obket's ID is: &amp;quot; .. idstring ) -- output: The object ID is: testObj&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element_functions}}&lt;br /&gt;
[[de:GetElementID]]&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsPlayerCrosshairVisible&amp;diff=81456</id>
		<title>IsPlayerCrosshairVisible</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsPlayerCrosshairVisible&amp;diff=81456"/>
		<updated>2024-12-05T02:03:34Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22751|This function checks if the local player has showing crosshair.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This function checks if the crosshair is rendered by GTA. Please note that hud components are not associated with this function, so the function may return '''true''' even if the ''&amp;quot;crosshair&amp;quot;'' component is hidden with [[setPlayerHudComponentVisible]]. If you need checking use [[isPlayerHudComponentVisible]].}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isPlayerCrosshairVisible()&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the player has the crosshair visible, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;aim&amp;quot;, function()&lt;br /&gt;
    local AimStatusText = isPlayerCrosshairVisible() and &amp;quot;Visbile&amp;quot; or &amp;quot;Hidden&amp;quot;&lt;br /&gt;
    outputChatBox(&amp;quot;Your AIM is: &amp;quot;.. AimStatusText)&lt;br /&gt;
end) &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>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxGetBlendMode&amp;diff=80087</id>
		<title>DxGetBlendMode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxGetBlendMode&amp;diff=80087"/>
		<updated>2024-08-30T11:11:07Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function returns the current blend mode for the dxDraw functions. The blend mode is set using [[dxSetBlendMode]]&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string dxGetBlendMode ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns the current blend mode, which can be one of:&lt;br /&gt;
*'''blend'''&lt;br /&gt;
*'''add'''&lt;br /&gt;
*'''modulate_add'''&lt;br /&gt;
*'''overwrite'''&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Function to draw a rectangle with the current blend mode displayed&lt;br /&gt;
function renderBlendModeExample()&lt;br /&gt;
    -- Get the current blend mode&lt;br /&gt;
    local blendMode = dxGetBlendMode()&lt;br /&gt;
    &lt;br /&gt;
    -- Draw a background rectangle&lt;br /&gt;
    dxDrawRectangle(100, 100, 300, 200, tocolor(0, 0, 255, 100))&lt;br /&gt;
&lt;br /&gt;
    -- Draw some text on top of the rectangle&lt;br /&gt;
    dxDrawText(&amp;quot;Current Blend Mode: &amp;quot; .. blendMode, 110, 110, 390, 190, tocolor(255, 255, 255, 255), 1.5, &amp;quot;default-bold&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Add an event handler to render the rectangle and text every frame&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, renderBlendModeExample)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.03782|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxGetBlendMode]]&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxSetShaderTransform&amp;diff=80086</id>
		<title>DxSetShaderTransform</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxSetShaderTransform&amp;diff=80086"/>
		<updated>2024-08-30T11:10:52Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function applies a 3D transformation to a [[shader]] element when it is drawn with [[dxDrawImage]].&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 dxSetShaderTransform ( element theShader,&lt;br /&gt;
                            float rotationX, float rotationY, float rotationZ,&lt;br /&gt;
                          [ float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, float rotationCenterOffsetZ = 0,&lt;br /&gt;
                            bool bRotationCenterOffsetOriginIsScreen = false,&lt;br /&gt;
                            float perspectiveCenterOffsetX = 0, float perspectiveCenterOffsetY = 0,&lt;br /&gt;
                            bool bPerspectiveCenterOffsetOriginIsScreen = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[shader]]:setTransform}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theShader:''' The shader element whose transformation is to be changed&lt;br /&gt;
*'''rotationX:''' Rotation angle in degrees around the X axis (Left,right). This will make the shader rotate along its width.&lt;br /&gt;
*'''rotationY:''' Rotation angle in degrees around the Y axis (Up,down). This will make the shader rotate along its height.&lt;br /&gt;
*'''rotationZ:''' Rotation angle in degrees around the Z axis (In,out). This will make the shader rotate in a similar way to the rotation argument in [[dxDrawImage]].&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''rotationCenterOffsetX :''' The center of rotation offset X position in screen relative units.&lt;br /&gt;
*'''rotationCenterOffsetY :''' The center of rotation offset Y position in screen relative units.&lt;br /&gt;
*'''rotationCenterOffsetZ :''' The center of rotation offset Z position in screen relative units.&lt;br /&gt;
*'''bRotationCenterOffsetOriginIsScreen :''' Set to [[boolean|true]] if the center of rotation origin should be the center of the screen rather than the center of the image.&lt;br /&gt;
*'''perspectiveCenterOffsetX :''' The center of perspective offset X position in screen relative units.&lt;br /&gt;
*'''perspectiveCenterOffsetY :''' The center of perspective offset Y position in screen relative units.&lt;br /&gt;
*'''bPerspectiveCenterOffsetOriginIsScreen :''' Set to [[boolean|true]] if the center of perspective origin should be the center of the screen rather than the center of the image.&lt;br /&gt;
&lt;br /&gt;
To convert screen relative units into screen pixel coordinates, ''multiply'' by the screen size. Conversely, to convert screen pixel coordinates to screen relative units, '''''divide''''' by the screen size.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the shader element's transform was successfully changed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local shader&lt;br /&gt;
local texture&lt;br /&gt;
local angle = 0 -- Initialize angle for rotation&lt;br /&gt;
local radius = 50 -- Reduced radius for the circular motion&lt;br /&gt;
local centerX, centerY -- Center of the screen&lt;br /&gt;
&lt;br /&gt;
function startShaderExample()&lt;br /&gt;
    -- Create a shader&lt;br /&gt;
    shader = dxCreateShader(&amp;quot;texture.fx&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Load a texture&lt;br /&gt;
    texture = dxCreateTexture(&amp;quot;myTexture.png&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    -- Apply the texture to the shader&lt;br /&gt;
    dxSetShaderValue(shader, &amp;quot;gTexture&amp;quot;, texture)&lt;br /&gt;
    &lt;br /&gt;
    -- Get the center of the screen&lt;br /&gt;
    local screenWidth, screenHeight = guiGetScreenSize()&lt;br /&gt;
    centerX = screenWidth / 2&lt;br /&gt;
    centerY = screenHeight / 2&lt;br /&gt;
    &lt;br /&gt;
    -- Start rendering the shader&lt;br /&gt;
    addEventHandler(&amp;quot;onClientRender&amp;quot;, root, renderShader)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, startShaderExample)&lt;br /&gt;
&lt;br /&gt;
function renderShader()&lt;br /&gt;
    -- Increment the angle to create rotation over time&lt;br /&gt;
    angle = angle + 0.02&lt;br /&gt;
    if angle &amp;gt; 2 * math.pi then&lt;br /&gt;
        angle = 0&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Calculate the position based on a smaller circular path&lt;br /&gt;
    local positionX = centerX + math.cos(angle) * radius&lt;br /&gt;
    local positionY = centerY + math.sin(angle) * radius&lt;br /&gt;
&lt;br /&gt;
    -- Apply transformation: translation along a smaller circular path and rotation&lt;br /&gt;
    dxSetShaderTransform(shader, positionX, positionY, 0, 0, 0, angle)&lt;br /&gt;
    &lt;br /&gt;
    -- Draw a rectangle with the shader applied, following the circular path&lt;br /&gt;
    dxDrawImage(positionX - 128, positionY - 128, 256, 256, shader)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function stopShaderExample()&lt;br /&gt;
    if shader then&lt;br /&gt;
        destroyElement(shader)&lt;br /&gt;
        shader = nil&lt;br /&gt;
    end&lt;br /&gt;
    if texture then&lt;br /&gt;
        destroyElement(texture)&lt;br /&gt;
        texture = nil&lt;br /&gt;
    end&lt;br /&gt;
    removeEventHandler(&amp;quot;onClientRender&amp;quot;, root, renderShader)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStop&amp;quot;, resourceRoot, stopShaderExample)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.2.0-9.03618|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=79981</id>
		<title>GetVehicleEntryPoints</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=79981"/>
		<updated>2024-08-01T15:14:07Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}} &lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22649| &lt;br /&gt;
This function returns a table containing the positions to 4 possible entry points to a vehicle. This function can be used alongside [[setPedEnterVehicle]] to make a ped enter a specific seat by first moving the ped to a entry point retrieved through '''getVehicleEntryPoints''' and then using [[setPedEnterVehicle]] to make them enter.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This does not directly relate to the amount of doors a vehicle has as vehicles with two doors can have multiple entry points to the same door.}}&lt;br /&gt;
{{Note|The vehicle needs to be streamed in for this function to work.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleEntryPoints(vehicle)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{OOP||[[vehicle]]:getEntryPoints}}&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''vehicle''': The vehicle from which we want to get entry points.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If the vehicle has entry points, it returns a table containing the positions of the 4 possible entry points to the vehicle, otherwise it returns ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
'''Example 1''': This example renders 3D (''text &amp;amp; circle'') on each '''streamed-in''' vehicle entry point&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, function()&lt;br /&gt;
    for _, vehicle in pairs(getElementsByType(&amp;quot;vehicle&amp;quot;, root, true)) do&lt;br /&gt;
        local entryX, entryY, entryZ = getElementPosition(vehicle) &lt;br /&gt;
        for index, position in pairs(getVehicleEntryPoints(vehicle)) do&lt;br /&gt;
            local drawX, drawY, distance = getScreenFromWorldPosition(&lt;br /&gt;
                position[1], position[2], position[3], 100&lt;br /&gt;
            )&lt;br /&gt;
&lt;br /&gt;
            if (drawX ~= false) then&lt;br /&gt;
                local cameraX, cameraY, cameraZ = getCameraMatrix()&lt;br /&gt;
&lt;br /&gt;
                dxDrawCircle(drawX, drawY, 8 / (distance * 0.1), 0, 360, tocolor(255, 0, 0, 255))&lt;br /&gt;
                dxDrawText(tostring(index), drawX, drawY + ((8 / (distance * 0.1)) / 2) + ((2 / (distance * 0.1)) + 0.5), 0, 0, tocolor(255, 0, 0, 255),&lt;br /&gt;
                    3 / (distance * 0.1), &amp;quot;default-bold&amp;quot;)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': This example checks if the player is near the vehicle door to ''enter''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleStartEnter&amp;quot;, root, function(thePlayer, seat, door)&lt;br /&gt;
    if thePlayer == localPlayer then&lt;br /&gt;
        local entryPoints = getVehicleEntryPoints(source)&lt;br /&gt;
        if entryPoints then&lt;br /&gt;
            local entryPoint = entryPoints[door + 1]&lt;br /&gt;
            if entryPoint then&lt;br /&gt;
                local distance = getDistanceBetweenPoints3D(Vector3(getElementPosition(localPlayer)), unpack(entryPoint))&lt;br /&gt;
                if distance &amp;gt; 2.5 then&lt;br /&gt;
                    outputChatBox(&amp;quot;You are too far away from the door to enter this vehicle!&amp;quot;)&lt;br /&gt;
                    cancelEvent()&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client vehicle functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=79980</id>
		<title>GetVehicleEntryPoints</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=79980"/>
		<updated>2024-08-01T15:12:14Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}} &lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22649| &lt;br /&gt;
This function returns a table containing the positions to 4 possible entry points to a vehicle. This function can be used alongside [[setPedEnterVehicle]] to make a ped enter a specific seat by first moving the ped to a entry point retrieved through '''getVehicleEntryPoints''' and then using [[setPedEnterVehicle]] to make them enter.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This does not directly relate to the amount of doors a vehicle has as vehicles with two doors can have multiple entry points to the same door.}}&lt;br /&gt;
{{Note|The vehicle needs to be streamed in for this function to work.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleEntryPoints(vehicle)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{OOP||[[vehicle]]:getEntryPoints}}&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''vehicle''': The vehicle from which we want to get entry points.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If the vehicle has entry points, it returns a table containing the positions of the 4 possible entry points to the vehicle, otherwise it returns ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
'''Example 1''': This example renders 3D (''text &amp;amp; circle'') on each '''streamed-in''' vehicle entry point.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, function()&lt;br /&gt;
    for _, vehicle in pairs(getElementsByType(&amp;quot;vehicle&amp;quot;, root, true)) do&lt;br /&gt;
        local entryX, entryY, entryZ = getElementPosition(vehicle) &lt;br /&gt;
        for index, position in pairs(getVehicleEntryPoints(vehicle)) do&lt;br /&gt;
            local drawX, drawY, distance = getScreenFromWorldPosition(&lt;br /&gt;
                position[1], position[2], position[3], 100&lt;br /&gt;
            )&lt;br /&gt;
&lt;br /&gt;
            if (drawX ~= false) then&lt;br /&gt;
                local cameraX, cameraY, cameraZ = getCameraMatrix()&lt;br /&gt;
&lt;br /&gt;
                dxDrawCircle(drawX, drawY, 8 / (distance * 0.1), 0, 360, tocolor(255, 0, 0, 255))&lt;br /&gt;
                dxDrawText(tostring(index), drawX, drawY + ((8 / (distance * 0.1)) / 2) + ((2 / (distance * 0.1)) + 0.5), 0, 0, tocolor(255, 0, 0, 255),&lt;br /&gt;
                    3 / (distance * 0.1), &amp;quot;default-bold&amp;quot;)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': This example checks if the player is near the vehicle door and not far.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleStartEnter&amp;quot;, root, function(thePlayer, seat, door)&lt;br /&gt;
    if thePlayer == localPlayer then&lt;br /&gt;
        local entryPoints = getVehicleEntryPoints(source)&lt;br /&gt;
        if entryPoints then&lt;br /&gt;
            local entryPoint = entryPoints[door + 1]&lt;br /&gt;
            if entryPoint then&lt;br /&gt;
                local distance = getDistanceBetweenPoints3D(Vector3(getElementPosition(localPlayer)), unpack(entryPoint))&lt;br /&gt;
                if distance &amp;gt; 2.5 then&lt;br /&gt;
                    outputChatBox(&amp;quot;You are too far away from the door to enter this vehicle!&amp;quot;)&lt;br /&gt;
                    cancelEvent()&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client vehicle functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=79979</id>
		<title>GetVehicleEntryPoints</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=79979"/>
		<updated>2024-08-01T15:11:37Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* nN Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}} &lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22649| &lt;br /&gt;
This function returns a table containing the positions to 4 possible entry points to a vehicle. This function can be used alongside [[setPedEnterVehicle]] to make a ped enter a specific seat by first moving the ped to a entry point retrieved through '''getVehicleEntryPoints''' and then using [[setPedEnterVehicle]] to make them enter.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This does not directly relate to the amount of doors a vehicle has as vehicles with two doors can have multiple entry points to the same door.}}&lt;br /&gt;
{{Note|The vehicle needs to be streamed in for this function to work.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getVehicleEntryPoints(vehicle)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{OOP||[[vehicle]]:getEntryPoints}}&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''vehicle''': The vehicle from which we want to get entry points.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If the vehicle has entry points, it returns a table containing the positions of the 4 possible entry points to the vehicle, otherwise it returns ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
Example 1: This example renders 3D (''text &amp;amp; circle'') on each '''streamed-in''' vehicle entry point.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, function()&lt;br /&gt;
    for _, vehicle in pairs(getElementsByType(&amp;quot;vehicle&amp;quot;, root, true)) do&lt;br /&gt;
        local entryX, entryY, entryZ = getElementPosition(vehicle) &lt;br /&gt;
        for index, position in pairs(getVehicleEntryPoints(vehicle)) do&lt;br /&gt;
            local drawX, drawY, distance = getScreenFromWorldPosition(&lt;br /&gt;
                position[1], position[2], position[3], 100&lt;br /&gt;
            )&lt;br /&gt;
&lt;br /&gt;
            if (drawX ~= false) then&lt;br /&gt;
                local cameraX, cameraY, cameraZ = getCameraMatrix()&lt;br /&gt;
&lt;br /&gt;
                dxDrawCircle(drawX, drawY, 8 / (distance * 0.1), 0, 360, tocolor(255, 0, 0, 255))&lt;br /&gt;
                dxDrawText(tostring(index), drawX, drawY + ((8 / (distance * 0.1)) / 2) + ((2 / (distance * 0.1)) + 0.5), 0, 0, tocolor(255, 0, 0, 255),&lt;br /&gt;
                    3 / (distance * 0.1), &amp;quot;default-bold&amp;quot;)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': This example checks if the player is near the vehicle door and not far.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleStartEnter&amp;quot;, root, function(thePlayer, seat, door)&lt;br /&gt;
    if thePlayer == localPlayer then&lt;br /&gt;
        local entryPoints = getVehicleEntryPoints(source)&lt;br /&gt;
        if entryPoints then&lt;br /&gt;
            local entryPoint = entryPoints[door + 1]&lt;br /&gt;
            if entryPoint then&lt;br /&gt;
                local distance = getDistanceBetweenPoints3D(Vector3(getElementPosition(localPlayer)), unpack(entryPoint))&lt;br /&gt;
                if distance &amp;gt; 2.5 then&lt;br /&gt;
                    outputChatBox(&amp;quot;You are too far away from the door to enter this vehicle!&amp;quot;)&lt;br /&gt;
                    cancelEvent()&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client vehicle functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetLatentEventHandles&amp;diff=78663</id>
		<title>GetLatentEventHandles</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetLatentEventHandles&amp;diff=78663"/>
		<updated>2023-12-12T20:40:19Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{Needs_Example}} &lt;br /&gt;
Gets the currently queued latent events. The last one in the table is always the latest event queued. Each returned handle can be used with [[getLatentEventStatus]] or [[cancelLatentEvent]]&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getLatentEventHandles ( player thePlayer )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player who is receiving the events.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getLatentEventHandles ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table of handles or false if invalid arguments were passed.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This command is triggering an latent-event to server, and if you write the command again and the trigger still didn't end then you have to wait.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-- CLIENT SIDE:&lt;br /&gt;
&lt;br /&gt;
local lastTriggerd = false &lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;trigger&amp;quot;,function()&lt;br /&gt;
	local triggers = getLatentEventHandles() -- get all latent events&lt;br /&gt;
	if triggers[lastTriggerd] then -- you can use (getLatentEventStatus) too!&lt;br /&gt;
		outputChatBox(&amp;quot;Wait until the trigger (&amp;quot;..lastTriggerd..&amp;quot;) ends!&amp;quot;,255,0,0)&lt;br /&gt;
		return &lt;br /&gt;
	end &lt;br /&gt;
	triggerLatentServerEvent(&amp;quot;LatentEventsCheck&amp;quot;,20000,resourceRoot,localPlayer)&lt;br /&gt;
	lastTriggerd = #getLatentEventHandles() -- set the lastTriggerd with the id for last event triggerd&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
-- SERVER SIDE:&lt;br /&gt;
&lt;br /&gt;
addEvent(&amp;quot;LatentEventsCheck&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;LatentEventsCheck&amp;quot;,root,function (thePlayer)&lt;br /&gt;
	outputChatBox(&amp;quot;Latent trigger done from: &amp;quot; .. getPlayerName(thePlayer), root,math.random(255),0,0) &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.3.0-9.03772|1.3.0-9.03772|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementBoneMatrix&amp;diff=78662</id>
		<title>GetElementBoneMatrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementBoneMatrix&amp;diff=78662"/>
		<updated>2023-12-12T20:25:22Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
{{Added feature/item|1.5.9|1.5.8|20704|This function returns the transformation matrix of a specific bone. Currently the [[Element/Player|Player]] and [[Element/Ped|Ped]] element types are accepted.}}&lt;br /&gt;
{{Tip|If you want to attach an element to a bone, see [[attachElementToBone]].}}&lt;br /&gt;
{{Tip|For [[matrix]] manipulation which goes beyond the basic examples given on this page, see the [[Lua matrix library]]. Using the built-in [[matrix]] class is also recommended.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getElementBoneMatrix ( element theElement, int boneId )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' the [[element]] to get the bone matrix on.&lt;br /&gt;
*'''boneId:''' the ID of the bone to get the matrix of. See [[Bone IDs]].&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a multi-dimensional array (which can be transformed into a proper [[matrix]] class using ''Matrix.create'' method) containing a 4x4 matrix. Returns ''false'' if invalid arguments were passed.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
this example will output bone position and rotation for id 5.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local boneMatrix = getElementBoneMatrix(localPlayer, 5) -- get the bone matrix for localPlayer, id: 5&lt;br /&gt;
if boneMatrix then&lt;br /&gt;
    -- extract position and rotation from the matrix&lt;br /&gt;
    local posX, posY, posZ = boneMatrix[4][1], boneMatrix[4][2], boneMatrix[4][3]&lt;br /&gt;
    local rotX, rotY, rotZ = math.deg(math.asin(-boneMatrix[3][2])), math.deg(math.atan2(boneMatrix[3][1], boneMatrix[3][3])), math.deg(math.atan2(boneMatrix[1][2], boneMatrix[2][2]))&lt;br /&gt;
&lt;br /&gt;
    outputChatBox(&amp;quot;Bone position: (&amp;quot; .. posX .. &amp;quot;, &amp;quot; .. posY .. &amp;quot;, &amp;quot; .. posZ .. &amp;quot;)&amp;quot;)&lt;br /&gt;
    outputChatBox(&amp;quot;Bone rotation: (&amp;quot; .. rotX .. &amp;quot;, &amp;quot; .. rotY .. &amp;quot;, &amp;quot; .. rotZ .. &amp;quot;)&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Invalid element or bone ID.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.8-9.20704|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_element_functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineResetSurfaceProperties&amp;diff=78661</id>
		<title>EngineResetSurfaceProperties</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineResetSurfaceProperties&amp;diff=78661"/>
		<updated>2023-12-12T20:18:04Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0157|1.5.6|16365|This function resets a surface property to its default value. If no ID is provided, it will reset all surfaces' properties to their original values.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mixed engineResetSurfaceProperties ( [ int surfaceID ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''surfaceID:''' [[Material IDs|Material ID]] from 0 to 178&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function executed succesfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{{Material_Properties}}&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This will reset any '''Surface Properties''' for id: ''5''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local surfaceID = 5 -- the material ID to reset properties&lt;br /&gt;
local success = engineResetSurfaceProperties(surfaceID)&lt;br /&gt;
&lt;br /&gt;
if success then&lt;br /&gt;
    outputChatBox(&amp;quot;Surface properties reset successfully.&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Invalid surface ID or error occurred.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineGetSurfaceProperties&amp;diff=78660</id>
		<title>EngineGetSurfaceProperties</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineGetSurfaceProperties&amp;diff=78660"/>
		<updated>2023-12-12T20:15:37Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0157|1.5.6|16365|This function retrieves the value of a surface property.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mixed engineGetSurfaceProperties ( int surfaceID, string property )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''surfaceID:''' [[Material IDs|Material ID]] from 0 to 178&lt;br /&gt;
*'''property:''' Property name&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the current property value. See the table below for possible values.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{{Material_Properties}}&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
In this example, we retrieve the surface property value for a material with ID 5 and the property name “audio.” If successful, it displays the value; otherwise, it indicates an invalid input&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local surfaceID = 5 -- the material ID&lt;br /&gt;
local property = &amp;quot;audio&amp;quot; -- the property name&lt;br /&gt;
local propertyValue = engineGetSurfaceProperties(surfaceID, property)&lt;br /&gt;
if propertyValue then&lt;br /&gt;
    outputChatBox(&amp;quot;Surface property '&amp;quot; .. property .. &amp;quot;' value: &amp;quot; .. tostring(propertyValue))&lt;br /&gt;
	-- returns : Surface property 'audio' value: concrete&lt;br /&gt;
else&lt;br /&gt;
    outputChatBox(&amp;quot;Invalid surface ID or property name.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=UpdateElementRpHAnim&amp;diff=78658</id>
		<title>UpdateElementRpHAnim</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=UpdateElementRpHAnim&amp;diff=78658"/>
		<updated>2023-12-12T01:37:25Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Added feature/item|1.5.9|1.5.8|20704|This function updates GTA bone animation for a given [[element]]. Currently the [[Element/Player|Player]] and [[Element/Ped|Ped]] element types are accepted. It must be called after [[setElementBoneRotation]] for changes to take effect. It should only be called once per frame, after you are done rotating bones on that element, as it is quite heavy.}}&lt;br /&gt;
{{Tip|If you want to attach an element to a bone, see [[attachElementToBone]].}}&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 updateElementRpHAnim ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' the [[element]] to update the bone animations.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientPedsProcessed&amp;quot;,root,function()&lt;br /&gt;
    for i,v in ipairs(getElementsByType('player',root,true)) do  -- loop all players&lt;br /&gt;
        &lt;br /&gt;
        -- just an exmaple anim&lt;br /&gt;
        setElementBoneRotation(v, 33, 0, 295.2, 0)&lt;br /&gt;
        setElementBoneRotation(v, 23, 0, 298.8, 0)&lt;br /&gt;
        setElementBoneRotation(v, 4, 0, 46.8, 0)&lt;br /&gt;
        setElementBoneRotation(v, 2, 0, 0, 32.4)&lt;br /&gt;
&lt;br /&gt;
        updateElementRpHAnim(v) -- Update ped bones animations&lt;br /&gt;
&lt;br /&gt;
    end &lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.8-9.20704|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_element_functions}}&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPedsProcessed&amp;diff=78657</id>
		<title>OnClientPedsProcessed</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPedsProcessed&amp;diff=78657"/>
		<updated>2023-12-12T01:36:40Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}} &lt;br /&gt;
{{Added feature/item|1.5.9|1.5.8|20704|This event is triggered after GTA updates bone transformations for all peds. This event can be used for updating bones.}}&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;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientPedsProcessed&amp;quot;,root,function() -- add the event&lt;br /&gt;
    for i,v in ipairs(getElementsByType('player',root,true)) do  -- loop all players&lt;br /&gt;
        &lt;br /&gt;
        -- just an exmaple anim&lt;br /&gt;
        setElementBoneRotation(v, 33, 0, 295.2, 0)&lt;br /&gt;
        setElementBoneRotation(v, 23, 0, 298.8, 0)&lt;br /&gt;
        setElementBoneRotation(v, 4, 0, 46.8, 0)&lt;br /&gt;
        setElementBoneRotation(v, 2, 0, 0, 32.4)&lt;br /&gt;
&lt;br /&gt;
        updateElementRpHAnim(v) -- Update ped bones animations&lt;br /&gt;
&lt;br /&gt;
    end &lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.8-9.20704}}&lt;br /&gt;
&lt;br /&gt;
==Warning==&lt;br /&gt;
This event 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>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=78656</id>
		<title>GetPedAnalogControlState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=78656"/>
		<updated>2023-12-12T01:30:03Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function retrieves the analog control state of a [[ped]], as set by [[setPedAnalogControlState]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;float getPedAnalogControlState ( ped thePed, string controlName [, bool rawValue ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' The ped you wish to retrieve the control state of.&lt;br /&gt;
*'''controlName:''' The control. See [[control names]] for a list of possible controls.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20383|&lt;br /&gt;
*'''rawValue:''' A [[bool]] indicating if it should return the raw player input value (will always return script value for non-player peds).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[float]] between 0 (full release) and 1 (full push) indicating the amount the control is pushed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This exmaple creating a ped can drive with command '''/drive'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local ped = createPed(0, 0,0,3)&lt;br /&gt;
local vehicle = createVehicle(554,0,0,3)&lt;br /&gt;
warpPedIntoVehicle(ped, vehicle)&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;drive&amp;quot;,function()&lt;br /&gt;
    isDriving = getPedAnalogControlState ( ped, &amp;quot;accelerate&amp;quot; ) -- get the analaog state of (accelerate)&lt;br /&gt;
    if isDriving==1 then -- checks if equals 1 that means is driving&lt;br /&gt;
        outputChatBox(&amp;quot;Ped is driving stoping..&amp;quot;)&lt;br /&gt;
        setPedAnalogControlState( ped, &amp;quot;accelerate&amp;quot;, 0 ) -- set the analaog (accelerate) to 0 &lt;br /&gt;
    else &lt;br /&gt;
        outputChatBox(&amp;quot;Starting drive&amp;quot;)&lt;br /&gt;
        setPedAnalogControlState( ped, &amp;quot;accelerate&amp;quot;, 1 ) -- set the analaog (accelerate) to 1 &lt;br /&gt;
    end &lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.04185|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getPedAnalogControlState]]&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=78655</id>
		<title>GetPedAnalogControlState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=78655"/>
		<updated>2023-12-12T01:29:56Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function retrieves the analog control state of a [[ped]], as set by [[setPedAnalogControlState]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;float getPedAnalogControlState ( ped thePed, string controlName [, bool rawValue ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' The ped you wish to retrieve the control state of.&lt;br /&gt;
*'''controlName:''' The control. See [[control names]] for a list of possible controls.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20383|&lt;br /&gt;
*'''rawValue:''' A [[bool]] indicating if it should return the raw player input value (will always return script value for non-player peds).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[float]] between 0 (full release) and 1 (full push) indicating the amount the control is pushed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This exmaple creating a ped can drive with command '''drive'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local ped = createPed(0, 0,0,3)&lt;br /&gt;
local vehicle = createVehicle(554,0,0,3)&lt;br /&gt;
warpPedIntoVehicle(ped, vehicle)&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;drive&amp;quot;,function()&lt;br /&gt;
    isDriving = getPedAnalogControlState ( ped, &amp;quot;accelerate&amp;quot; ) -- get the analaog state of (accelerate)&lt;br /&gt;
    if isDriving==1 then -- checks if equals 1 that means is driving&lt;br /&gt;
        outputChatBox(&amp;quot;Ped is driving stoping..&amp;quot;)&lt;br /&gt;
        setPedAnalogControlState( ped, &amp;quot;accelerate&amp;quot;, 0 ) -- set the analaog (accelerate) to 0 &lt;br /&gt;
    else &lt;br /&gt;
        outputChatBox(&amp;quot;Starting drive&amp;quot;)&lt;br /&gt;
        setPedAnalogControlState( ped, &amp;quot;accelerate&amp;quot;, 1 ) -- set the analaog (accelerate) to 1 &lt;br /&gt;
    end &lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.04185|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getPedAnalogControlState]]&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=78654</id>
		<title>GetPedAnalogControlState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=78654"/>
		<updated>2023-12-12T01:25:18Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function retrieves the analog control state of a [[ped]], as set by [[setPedAnalogControlState]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;float getPedAnalogControlState ( ped thePed, string controlName [, bool rawValue ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' The ped you wish to retrieve the control state of.&lt;br /&gt;
*'''controlName:''' The control. See [[control names]] for a list of possible controls.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20383|&lt;br /&gt;
*'''rawValue:''' A [[bool]] indicating if it should return the raw player input value (will always return script value for non-player peds).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[float]] between 0 (full release) and 1 (full push) indicating the amount the control is pushed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This exmaple creating a ped and vehicle, making the ped accelerate and driving&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local ped = createPed(0, 0,0,3)&lt;br /&gt;
local vehicle = createVehicle(554,0,0,3)&lt;br /&gt;
warpPedIntoVehicle(ped, vehicle)&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;drive&amp;quot;,function()&lt;br /&gt;
    isDriving = getPedAnalogControlState ( ped, &amp;quot;accelerate&amp;quot; ) -- get the analaog state of (accelerate)&lt;br /&gt;
    if isDriving==1 then -- checks if equals 1 that means is driving&lt;br /&gt;
        outputChatBox(&amp;quot;Ped is driving stoping..&amp;quot;)&lt;br /&gt;
        setPedAnalogControlState( ped, &amp;quot;accelerate&amp;quot;, 0 ) -- set the analaog (accelerate) to 0 &lt;br /&gt;
    else &lt;br /&gt;
        outputChatBox(&amp;quot;Starting drive&amp;quot;)&lt;br /&gt;
        setPedAnalogControlState( ped, &amp;quot;accelerate&amp;quot;, 1 ) -- set the analaog (accelerate) to 1 &lt;br /&gt;
    end &lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.04185|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getPedAnalogControlState]]&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetGroundPosition&amp;diff=78653</id>
		<title>GetGroundPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetGroundPosition&amp;diff=78653"/>
		<updated>2023-12-12T00:51:22Z</updated>

		<summary type="html">&lt;p&gt;1Lorenzo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function gets the Z level of the highest ground below a point. &lt;br /&gt;
&lt;br /&gt;
It is required that the point is near enough to the local player so that it's within the area where collision data is loaded. If this is not the case, an incorrect position will be returned.&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 getGroundPosition ( float x, float y, float z )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''x:''' A floating point number representing the X world coordinate of the point.&lt;br /&gt;
*'''y:''' A floating point number representing the Y world coordinate of the point.&lt;br /&gt;
*'''z:''' A floating point number representing the Z world coordinate of the point.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a float with the highest ground-level Z coord if parameters are valid, ''0'' if the point you tried to test is outside the loaded world map, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This clientside function determines if a player is under a ceiling or not.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function isPlayerUnderCover ( thePlayer )&lt;br /&gt;
	--we get the player's position&lt;br /&gt;
	local px, py, pz = getElementPosition ( thePlayer )&lt;br /&gt;
	--we'll check for ground level at the player's position, and also 500 units over him.&lt;br /&gt;
	--if these ground levels match, it must mean there were no obstacles (such as a ceiling) over the player,&lt;br /&gt;
	return getGroundPosition ( px, py, pz ) ~= getGroundPosition ( px, py, pz + 530 )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Another exmaple== &lt;br /&gt;
clientside function returns the distance between you and the ground (if there is)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getGroundDistance( thePlayer, zHeight  )&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- get position&lt;br /&gt;
    local groundPosition = getGroundPosition(x,y,z) -- get default ground pos &lt;br /&gt;
	local hit, x1, y1, groundPosition = processLineOfSight(x,y,z+1,x,y,z-(zHeight+0.7))  -- using zHeight get a better ground position&lt;br /&gt;
	local distance = getDistanceBetweenPoints3D(x, y, z, x,y, (groundPosition or z))  -- get distance between both positions &lt;br /&gt;
	return distance -- return the distance&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Some cool examples:  &lt;br /&gt;
addCommandHandler(&amp;quot;gdistance&amp;quot;,function(_, amount)&lt;br /&gt;
    distance = getGroundDistance(localPlayer, tonumber(amount))&lt;br /&gt;
    outputChatBox(&amp;quot;The distance to reach ground is: &amp;quot; .. distance)&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;do_im_flying&amp;quot;,function()&lt;br /&gt;
    distance = getGroundDistance(localPlayer, 20)&lt;br /&gt;
    if (distance&amp;gt;1) then &lt;br /&gt;
        outputChatBox(&amp;quot;Superman!! the distance between you and ground is: &amp;quot; .. distance)&lt;br /&gt;
    else &lt;br /&gt;
        outputChatBox(&amp;quot;naah&amp;quot;)&lt;br /&gt;
    end &lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_world_functions}}&lt;br /&gt;
&lt;br /&gt;
[[ru:getGroundPosition]]&lt;/div&gt;</summary>
		<author><name>1Lorenzo</name></author>
	</entry>
</feed>