<?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=Pirulax</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=Pirulax"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Pirulax"/>
	<updated>2026-04-09T19:31:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ProcessLineOfSight&amp;diff=79554</id>
		<title>ProcessLineOfSight</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ProcessLineOfSight&amp;diff=79554"/>
		<updated>2024-06-08T19:18:48Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function casts a ray between two points in the world, and tells you information about the point that was hit, if any. The two positions '''must''' be within the local player's draw distance as the collision data is not loaded outside this area, and the call will just fail as if the ray didn't hit.&lt;br /&gt;
&lt;br /&gt;
This function is relatively expensive to call, so over use of this in scripts may have a detrimental effect on performance.&lt;br /&gt;
&lt;br /&gt;
This function is useful for checking for collisions and for editor-style scripts. If you wish to find what element is positioned at a particular point on the screen, use this function combined with [[getWorldFromScreenPosition]]. If you wish to just know if something is hit, and don't care about what or where was hit, use [[isLineOfSightClear]].&lt;br /&gt;
&lt;br /&gt;
{{Note|Due to a bug, shootThroughStuff argument does currently check for seeThroughStuff!}}&lt;br /&gt;
{{Note|Due to a bug, seeThroughStuff argument has no effect. It mistakenly checks for &amp;quot;shootThrough&amp;quot; surfaces and will always behave as if the argument is set to FALSE (It will never hit).}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
Return values labelled for ease of reference.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool               -- hit&lt;br /&gt;
float float float  -- hitX, hitY, hitZ&lt;br /&gt;
element            -- hitElement&lt;br /&gt;
float float float  -- normalX, normalY, normalZ&lt;br /&gt;
int                -- material&lt;br /&gt;
float              -- lighting&lt;br /&gt;
int                -- piece&lt;br /&gt;
int                -- worldModelID&lt;br /&gt;
float float float  -- worldModelPositionX,Y,Z&lt;br /&gt;
float float float  -- worldModelRotationX,Y,Z&lt;br /&gt;
int                -- worldLODModelID&lt;br /&gt;
float float        -- uvX, uvY&lt;br /&gt;
string             -- textureName,&lt;br /&gt;
string             -- frameName,&lt;br /&gt;
float float float  -- extraHitX, extraHitY, extraHitZ&lt;br /&gt;
                  processLineOfSight ( float startX, float startY, float startZ, &lt;br /&gt;
                                       float endX, float endY, float endZ, &lt;br /&gt;
                                       [ bool checkBuildings = true, &lt;br /&gt;
                                       bool checkVehicles = true, &lt;br /&gt;
                                       bool checkPlayers = true, &lt;br /&gt;
                                       bool checkObjects = true, &lt;br /&gt;
                                       bool checkDummies = true, &lt;br /&gt;
                                       bool seeThroughStuff = false, &lt;br /&gt;
                                       bool ignoreSomeObjectsForCamera = false, &lt;br /&gt;
                                       bool shootThroughStuff = false, &lt;br /&gt;
                                       element ignoredElement = nil,&lt;br /&gt;
                                       bool includeWorldModelInformation = false,&lt;br /&gt;
                                       bool bIncludeCarTyres = false,&lt;br /&gt;
                                       bool bIncludeExtraMateriaInfo = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''startX:''' The start ''x'' position&lt;br /&gt;
*'''startY:''' The start ''y'' position&lt;br /&gt;
*'''startZ:''' The start ''z'' position&lt;br /&gt;
*'''endX:''' The end ''x'' position&lt;br /&gt;
*'''endY:''' The end ''y'' position&lt;br /&gt;
*'''endZ:''' The end ''z'' position&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''checkBuildings:''' Allow the line of sight to be blocked by GTA's internally placed buildings, i.e. the world map.&lt;br /&gt;
*'''checkVehicles:''' Allow the line of sight to be blocked by [[Vehicle|vehicles]].&lt;br /&gt;
*'''checkPlayers:''' Allow the line of sight to be blocked by [[Player|players]].&lt;br /&gt;
*'''checkObjects:''' Allow the line of sight to be blocked by [[Object|objects]].&lt;br /&gt;
*'''checkDummies:''' Allow the line of sight to be blocked by GTA's internal dummies.  These are not used in the current MTA version so this argument can be set to ''false''.&lt;br /&gt;
*'''seeThroughStuff:''' Allow the line of sight '''pass through''' collision materials that have this flag enabled (By default material IDs 52, 55 and 66 which are some fences that you can shoot throug but still walk on them).&lt;br /&gt;
*'''ignoreSomeObjectsForCamera:''' Allow the line of sight to '''pass through''' objects that have (K) property enabled in &amp;quot;object.dat&amp;quot; data file. (i.e. Most dynamic objects like boxes or barrels)&lt;br /&gt;
*'''shootThroughStuff:''' Allow the line of sight to '''pass through''' collision materials that have this flag enabled (By default material IDs 28, 29, 31, 32, 33, 74, 75, 76, 77, 78, 79, 96, 97, 98, 99, 100 which are exclusively sand / beach or underwater objects).&lt;br /&gt;
*'''ignoredElement:''' Allow the line of sight to '''pass through''' a certain specified element. This is usually set to the object you are tracing from so it does not interfere with the results.&lt;br /&gt;
*'''includeWorldModelInformation :''' Include the results of hitting a world model.&lt;br /&gt;
*'''bIncludeCarTyres :''' Includes car tyre hits.&lt;br /&gt;
{{New feature/item|3.161|1.6.0|22173|&lt;br /&gt;
*'''bIncludeExtraMateriaInfo:''' Include the material info like UV coords, textureName, frameName and precision clump hit position.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*'''hit:''' ''true'' if there is a collision, ''false'' otherwise&lt;br /&gt;
The other values are only filled if there is a collision, they contain ''nil'' otherwise&lt;br /&gt;
*'''hitX, hitY, hitZ:''' collision position&lt;br /&gt;
*'''hitElement:''' the MTA element hit if any, ''nil'' otherwise&lt;br /&gt;
*'''normalX, normalY, normalZ:''' the normal of the surface hit&lt;br /&gt;
*'''material:''' an integer representing the [[Material IDs|GTASA material ID]] of the surface hit when applicable (world, objects)&lt;br /&gt;
*'''lighting:''' a float between 0 (fully dark) and 1 (bright) representing the amount of light that the hit building surface will transfer to peds or vehicles that are in contact with it. The value can be affected by the game time of day, usually with a lower (darker) value being returned during the night.&lt;br /&gt;
*'''piece:''' an integer representing the part of the element hit if hitElement is a vehicle or a ped/player, ''0'' otherwise. &lt;br /&gt;
**For a ped/player, piece represents the body part hit:&lt;br /&gt;
{{BodyParts}}&lt;br /&gt;
**For vehicles, piece represents the vehicle part hit:&lt;br /&gt;
{{VehicleParts}}&lt;br /&gt;
*'''worldModelID:''' If includeWorldModelInformation was set to ''true'' and a world model was hit, this will contain the model ID.&lt;br /&gt;
*'''worldModelPositionX,Y,Z:''' If worldModelID is set, this will contain the world model position.&lt;br /&gt;
*'''worldModelRotationX,Y,Z:''' If worldModelID is set, this will contain the world model rotation.&lt;br /&gt;
*'''worldLODModelID:''' If worldModelID is set, this will contain the LOD model ID if applicable.&lt;br /&gt;
*'''uvX, uvY:''' If bIncludeExtraMateriaInfo is set, it contains the texture UV positions of the hit triangle of the hit entity.&lt;br /&gt;
*'''textureName:''' Same as above, but contains the texture name.&lt;br /&gt;
*'''frameName:''' Same as above, but contains the frame name. (This, for example in case of cars this is (but not limited to) a [[Vehicle Components]])&lt;br /&gt;
*'''modelHitX, modelHitY, modelHitZ:''' Same as above, but contains the exact position hit on the model itself (It is much more precise than the `hitX, hitY, hitZ` returned above, as those are only processed against the much more simpler collision mesh, while these are obtained from processing the visual mesh itself (the DFF))&lt;br /&gt;
&lt;br /&gt;
==Examples== &lt;br /&gt;
This example shows how you can tell what position and element the camera is looking at, up to 50 units away.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local w, h = guiGetScreenSize ()&lt;br /&gt;
local tx, ty, tz = getWorldFromScreenPosition ( w/2, h/2, 50 )&lt;br /&gt;
local px, py, pz = getCameraMatrix()&lt;br /&gt;
hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz )&lt;br /&gt;
if hit then&lt;br /&gt;
    outputChatBox ( &amp;quot;Looking at &amp;quot; .. x .. &amp;quot;, &amp;quot; .. y .. &amp;quot;, &amp;quot; ..  z )&lt;br /&gt;
    if elementHit then&lt;br /&gt;
        outputChatBox ( &amp;quot;Hit element &amp;quot; .. getElementType(elementHit) )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This example shows how you can get the surface type a vehicle is on. This is useful if you want to do a script to dirt cars over time. Please note that this function doesn't count if the vehicle is streamed in or not, so expect this function to fail or return incorrect values on unloaded vehicles.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getSurfaceVehicleIsOn(vehicle)&lt;br /&gt;
    if isElement(vehicle) and (isVehicleOnGround(vehicle) or isElementInWater(vehicle)) then -- Is an element and is touching any surface?&lt;br /&gt;
        local cx, cy, cz = getElementPosition(vehicle) -- Get the position of the vehicle&lt;br /&gt;
        local gz = getGroundPosition(cx, cy, cz) - 0.001 -- Get the Z position of the ground the vehicle is on (-0.001 because of processLineOfSight)&lt;br /&gt;
        local hit, _, _, _, _, _, _, _, surface = processLineOfSight(cx, cy, cz, cx, cy, gz) -- This will get the material of the thing the car is standing on&lt;br /&gt;
        if hit then&lt;br /&gt;
            return surface -- If everything is correct, stop executing this function and return the surface type&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return false -- If something isn't correct, return false&lt;br /&gt;
end&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.04273|''bIncludeCarTyres'' argument added}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.04273|''worldModelID'' return value fixed}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.04405|''lighting'' return value fixed}}&lt;br /&gt;
{{ChangelogItem|1.6.0-9.22173|''bIncludeExtraMateriaInfo '' argument added}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client world functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ProcessLineOfSight&amp;diff=79553</id>
		<title>ProcessLineOfSight</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ProcessLineOfSight&amp;diff=79553"/>
		<updated>2024-06-08T19:18:06Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Fix last edit (Clarify function arguments)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function casts a ray between two points in the world, and tells you information about the point that was hit, if any. The two positions '''must''' be within the local player's draw distance as the collision data is not loaded outside this area, and the call will just fail as if the ray didn't hit.&lt;br /&gt;
&lt;br /&gt;
This function is relatively expensive to call, so over use of this in scripts may have a detrimental effect on performance.&lt;br /&gt;
&lt;br /&gt;
This function is useful for checking for collisions and for editor-style scripts. If you wish to find what element is positioned at a particular point on the screen, use this function combined with [[getWorldFromScreenPosition]]. If you wish to just know if something is hit, and don't care about what or where was hit, use [[isLineOfSightClear]].&lt;br /&gt;
&lt;br /&gt;
{{Note|Due to a bug, shootThroughStuff argument does currently check for seeThroughStuff!}}&lt;br /&gt;
{{Note|Due to a bug, seeThroughStuff argument has no effect. It mistakenly checks for &amp;quot;shootThrough&amp;quot; surfaces and will always behave as if the argument is set to FALSE (It will never hit).}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
Return values labelled for ease of reference.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool               -- hit&lt;br /&gt;
float float float  -- hitX, hitY, hitZ&lt;br /&gt;
element            -- hitElement&lt;br /&gt;
float float float  -- normalX, normalY, normalZ&lt;br /&gt;
int                -- material&lt;br /&gt;
float              -- lighting&lt;br /&gt;
int                -- piece&lt;br /&gt;
int                -- worldModelID&lt;br /&gt;
float float float  -- worldModelPositionX,Y,Z&lt;br /&gt;
float float float  -- worldModelRotationX,Y,Z&lt;br /&gt;
int                -- worldLODModelID&lt;br /&gt;
float float        -- uvX, uvY&lt;br /&gt;
string             -- textureName,&lt;br /&gt;
string             -- frameName,&lt;br /&gt;
float float float  -- extraHitX, extraHitY, extraHitZ&lt;br /&gt;
                  processLineOfSight ( float startX, float startY, float startZ, &lt;br /&gt;
                                       float endX, float endY, float endZ, &lt;br /&gt;
                                       [ bool checkBuildings = true, &lt;br /&gt;
                                       bool checkVehicles = true, &lt;br /&gt;
                                       bool checkPlayers = true, &lt;br /&gt;
                                       bool checkObjects = true, &lt;br /&gt;
                                       bool checkDummies = true, &lt;br /&gt;
                                       bool seeThroughStuff = false, &lt;br /&gt;
                                       bool ignoreSomeObjectsForCamera = false, &lt;br /&gt;
                                       bool shootThroughStuff = false, &lt;br /&gt;
                                       element ignoredElement = nil,&lt;br /&gt;
                                       bool includeWorldModelInformation = false,&lt;br /&gt;
                                       bool bIncludeCarTyres = false,&lt;br /&gt;
                                       bool bIncludeExtraMateriaInfo = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''startX:''' The start ''x'' position&lt;br /&gt;
*'''startY:''' The start ''y'' position&lt;br /&gt;
*'''startZ:''' The start ''z'' position&lt;br /&gt;
*'''endX:''' The end ''x'' position&lt;br /&gt;
*'''endY:''' The end ''y'' position&lt;br /&gt;
*'''endZ:''' The end ''z'' position&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''checkBuildings:''' Allow the line of sight to be blocked by GTA's internally placed buildings, i.e. the world map.&lt;br /&gt;
*'''checkVehicles:''' Allow the line of sight to be blocked by [[Vehicle|vehicles]].&lt;br /&gt;
*'''checkPlayers:''' Allow the line of sight to be blocked by [[Player|players]].&lt;br /&gt;
*'''checkObjects:''' Allow the line of sight to be blocked by [[Object|objects]].&lt;br /&gt;
*'''checkDummies:''' Allow the line of sight to be blocked by GTA's internal dummies.  These are not used in the current MTA version so this argument can be set to ''false''.&lt;br /&gt;
*'''seeThroughStuff:''' Allow the line of sight '''pass through''' collision materials that have this flag enabled (By default material IDs 52, 55 and 66 which are some fences that you can shoot throug but still walk on them).&lt;br /&gt;
*'''ignoreSomeObjectsForCamera:''' Allow the line of sight to '''pass through''' objects that have (K) property enabled in &amp;quot;object.dat&amp;quot; data file. (i.e. Most dynamic objects like boxes or barrels)&lt;br /&gt;
*'''shootThroughStuff:''' Allow the line of sight to '''pass through''' collision materials that have this flag enabled (By default material IDs 28, 29, 31, 32, 33, 74, 75, 76, 77, 78, 79, 96, 97, 98, 99, 100 which are exclusively sand / beach or underwater objects).&lt;br /&gt;
*'''ignoredElement:''' Allow the line of sight to '''pass through''' a certain specified element. This is usually set to the object you are tracing from so it does not interfere with the results.&lt;br /&gt;
*'''includeWorldModelInformation :''' Include the results of hitting a world model.&lt;br /&gt;
*'''bIncludeCarTyres :''' Includes car tyre hits.&lt;br /&gt;
{{New feature/item|3.161|1.6.0|22173|&lt;br /&gt;
*'''bIncludeExtraMateriaInfo:''' Include the material info like UV coords, textureName, frameName and precision clump hit position.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*'''hit:''' ''true'' if there is a collision, ''false'' otherwise&lt;br /&gt;
The other values are only filled if there is a collision, they contain ''nil'' otherwise&lt;br /&gt;
*'''hitX, hitY, hitZ:''' collision position&lt;br /&gt;
*'''hitElement:''' the MTA element hit if any, ''nil'' otherwise&lt;br /&gt;
*'''normalX, normalY, normalZ:''' the normal of the surface hit&lt;br /&gt;
*'''material:''' an integer representing the [[Material IDs|GTASA material ID]] of the surface hit when applicable (world, objects)&lt;br /&gt;
*'''lighting:''' a float between 0 (fully dark) and 1 (bright) representing the amount of light that the hit building surface will transfer to peds or vehicles that are in contact with it. The value can be affected by the game time of day, usually with a lower (darker) value being returned during the night.&lt;br /&gt;
*'''piece:''' an integer representing the part of the element hit if hitElement is a vehicle or a ped/player, ''0'' otherwise. &lt;br /&gt;
**For a ped/player, piece represents the body part hit:&lt;br /&gt;
{{BodyParts}}&lt;br /&gt;
**For vehicles, piece represents the vehicle part hit:&lt;br /&gt;
{{VehicleParts}}&lt;br /&gt;
*'''worldModelID:''' If includeWorldModelInformation was set to ''true'' and a world model was hit, this will contain the model ID.&lt;br /&gt;
*'''worldModelPositionX,Y,Z:''' If worldModelID is set, this will contain the world model position.&lt;br /&gt;
*'''worldModelRotationX,Y,Z:''' If worldModelID is set, this will contain the world model rotation.&lt;br /&gt;
*'''worldLODModelID:''' If worldModelID is set, this will contain the LOD model ID if applicable.&lt;br /&gt;
*'''uvX, uvY:''' If bIncludeExtraMateriaInfo is set, it contains the texture UV positions of the triangle of the hit entity.&lt;br /&gt;
*'''textureName:''' Same as above, but contains the texture name.&lt;br /&gt;
*'''frameName:''' Same as above, but contains the frame name. (This, for example in case of cars this is (but not limited to) a [[Vehicle Components]])&lt;br /&gt;
*'''modelHitX, modelHitY, modelHitZ:''' Same as above, but contains the exact position hit on the model itself (It is much more precise than the `hitX, hitY, hitZ` returned above, as those are only processed against the much more simpler collision mesh, while these are obtained from processing the visual mesh itself (the DFF))&lt;br /&gt;
&lt;br /&gt;
==Examples== &lt;br /&gt;
This example shows how you can tell what position and element the camera is looking at, up to 50 units away.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local w, h = guiGetScreenSize ()&lt;br /&gt;
local tx, ty, tz = getWorldFromScreenPosition ( w/2, h/2, 50 )&lt;br /&gt;
local px, py, pz = getCameraMatrix()&lt;br /&gt;
hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz )&lt;br /&gt;
if hit then&lt;br /&gt;
    outputChatBox ( &amp;quot;Looking at &amp;quot; .. x .. &amp;quot;, &amp;quot; .. y .. &amp;quot;, &amp;quot; ..  z )&lt;br /&gt;
    if elementHit then&lt;br /&gt;
        outputChatBox ( &amp;quot;Hit element &amp;quot; .. getElementType(elementHit) )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This example shows how you can get the surface type a vehicle is on. This is useful if you want to do a script to dirt cars over time. Please note that this function doesn't count if the vehicle is streamed in or not, so expect this function to fail or return incorrect values on unloaded vehicles.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getSurfaceVehicleIsOn(vehicle)&lt;br /&gt;
    if isElement(vehicle) and (isVehicleOnGround(vehicle) or isElementInWater(vehicle)) then -- Is an element and is touching any surface?&lt;br /&gt;
        local cx, cy, cz = getElementPosition(vehicle) -- Get the position of the vehicle&lt;br /&gt;
        local gz = getGroundPosition(cx, cy, cz) - 0.001 -- Get the Z position of the ground the vehicle is on (-0.001 because of processLineOfSight)&lt;br /&gt;
        local hit, _, _, _, _, _, _, _, surface = processLineOfSight(cx, cy, cz, cx, cy, gz) -- This will get the material of the thing the car is standing on&lt;br /&gt;
        if hit then&lt;br /&gt;
            return surface -- If everything is correct, stop executing this function and return the surface type&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return false -- If something isn't correct, return false&lt;br /&gt;
end&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.04273|''bIncludeCarTyres'' argument added}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.04273|''worldModelID'' return value fixed}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.04405|''lighting'' return value fixed}}&lt;br /&gt;
{{ChangelogItem|1.6.0-9.22173|''bIncludeExtraMateriaInfo '' argument added}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client world functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77663</id>
		<title>ProcessLineAgainstMesh</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77663"/>
		<updated>2023-09-23T17:38:28Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Added feature/item|3.0161|1.6.0|22173|Does a raycast against an element's renderable mesh model directly}}&lt;br /&gt;
Does a raycast against an element's renderable mesh model [not the collision model!].&lt;br /&gt;
The same functionality is already present in [[processLineOfSight]], but the latter is a little buggy due to the fact that the collision model is always simplified, and not exactly the same as the mesh, which leads to situations where no hit is detected, even though the visible mesh is hittable [or vice versa].&lt;br /&gt;
Also, when one is interested in a specific element the overhead is a lot smaller [as we can skip all the collision detection done by the before-mentioned function].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
Return values labelled for ease of reference.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool               -- hit &lt;br /&gt;
float float        -- texU, texV&lt;br /&gt;
string             -- textureName&lt;br /&gt;
string             -- frameName&lt;br /&gt;
float float float  -- worldX, worldY, worldZ&lt;br /&gt;
                  processLineAgainstMesh(element toTest, &lt;br /&gt;
                                         float startX, float startY, float startZ, &lt;br /&gt;
                                         float endX, float endY, float endZ)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''toProcess:''' The element to process the line against&lt;br /&gt;
*'''startX, startY, startZ:''' The start [origin] of the line&lt;br /&gt;
*'''endX, endY, endZ:''' The end of the line&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*'''hit:''' ''true'' if there is a collision with the given element's mesh, ''false'' otherwise [in which case all other values are nil]&lt;br /&gt;
*'''texU, texV:''' the U, V coordinates on the hit geometry's texture&lt;br /&gt;
*'''textureName:''' name of the hit geometry's texture&lt;br /&gt;
*'''frameName:''' hit frame's name&lt;br /&gt;
*'''worldX, worldY, worldZ:''' collision position in world space&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.22173|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client world functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77662</id>
		<title>ProcessLineAgainstMesh</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77662"/>
		<updated>2023-09-23T17:37:23Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add &amp;quot;Added feature/item&amp;quot; header&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Added feature/item|3.0161|1.6.0|22173|Does a raycast against an element's renderable mesh model directly}}&lt;br /&gt;
Does a raycast against an element's renderable mesh model [not the collision model!].&lt;br /&gt;
The same functionality is already present in [[processLineOfSight]], but the latter is a little buggy due to the fact that the collision model is always simplified, and not exactly the same as the mesh, which leads to situations where no hit is detected, even though the visible mesh is hittable [or vice versa].&lt;br /&gt;
Also, when one is interested in a specific element the overhead is a lot smaller [as we can skip all the collision detection done by the before-mentioned function].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
Return values labelled for ease of reference.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool               -- hit &lt;br /&gt;
float float        -- texU, texV&lt;br /&gt;
string             -- textureName&lt;br /&gt;
string             -- frameName&lt;br /&gt;
float float float  -- worldX, worldY, worldZ&lt;br /&gt;
                  processLineAgainstMesh(element toTest, &lt;br /&gt;
                                         float startX, float startY, float startZ, &lt;br /&gt;
                                         float endX, float endY, float endZ)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''toProcess:''' The element to process the line against&lt;br /&gt;
*'''startX, startY, startZ:''' The start [origin] of the line&lt;br /&gt;
*'''endX, endY, endZ:''' The end of the line&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*'''hit:''' ''true'' if there is a collision with the given element's mesh, ''false'' otherwise [in which case all other values are nil]&lt;br /&gt;
*'''texU, texV:''' the U, V coordinates on the hit geometry's texture&lt;br /&gt;
*'''textureName:''' name of the hit geometry's texture&lt;br /&gt;
*'''frameName:''' hit frame's name&lt;br /&gt;
*'''worldX, worldY, worldZ:''' collision position in world space&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client world functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77661</id>
		<title>ProcessLineAgainstMesh</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77661"/>
		<updated>2023-09-23T17:33:37Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add &amp;quot;See Also&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Does a raycast against an element's renderable mesh model [not the collision model!].&lt;br /&gt;
The same functionality is already present in [[processLineOfSight]], but the latter is a little buggy due to the fact that the collision model is always simplified, and not exactly the same as the mesh, which leads to situations where no hit is detected, even though the visible mesh is hittable [or vice versa].&lt;br /&gt;
Also, when one is interested in a specific element the overhead is a lot smaller [as we can skip all the collision detection done by the before-mentioned function].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
Return values labelled for ease of reference.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool               -- hit &lt;br /&gt;
float float        -- texU, texV&lt;br /&gt;
string             -- textureName&lt;br /&gt;
string             -- frameName&lt;br /&gt;
float float float  -- worldX, worldY, worldZ&lt;br /&gt;
                  processLineAgainstMesh(element toTest, &lt;br /&gt;
                                         float startX, float startY, float startZ, &lt;br /&gt;
                                         float endX, float endY, float endZ)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''toProcess:''' The element to process the line against&lt;br /&gt;
*'''startX, startY, startZ:''' The start [origin] of the line&lt;br /&gt;
*'''endX, endY, endZ:''' The end of the line&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*'''hit:''' ''true'' if there is a collision with the given element's mesh, ''false'' otherwise [in which case all other values are nil]&lt;br /&gt;
*'''texU, texV:''' the U, V coordinates on the hit geometry's texture&lt;br /&gt;
*'''textureName:''' name of the hit geometry's texture&lt;br /&gt;
*'''frameName:''' hit frame's name&lt;br /&gt;
*'''worldX, worldY, worldZ:''' collision position in world space&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client world functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77660</id>
		<title>ProcessLineAgainstMesh</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ProcessLineAgainstMesh&amp;diff=77660"/>
		<updated>2023-09-23T17:32:56Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Create the page. Needs an example!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Does a raycast against an element's renderable mesh model [not the collision model!].&lt;br /&gt;
The same functionality is already present in [[processLineOfSight]], but the latter is a little buggy due to the fact that the collision model is always simplified, and not exactly the same as the mesh, which leads to situations where no hit is detected, even though the visible mesh is hittable [or vice versa].&lt;br /&gt;
Also, when one is interested in a specific element the overhead is a lot smaller [as we can skip all the collision detection done by the before-mentioned function].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
Return values labelled for ease of reference.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool               -- hit &lt;br /&gt;
float float        -- texU, texV&lt;br /&gt;
string             -- textureName&lt;br /&gt;
string             -- frameName&lt;br /&gt;
float float float  -- worldX, worldY, worldZ&lt;br /&gt;
                  processLineAgainstMesh(element toTest, &lt;br /&gt;
                                         float startX, float startY, float startZ, &lt;br /&gt;
                                         float endX, float endY, float endZ)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''toProcess:''' The element to process the line against&lt;br /&gt;
*'''startX, startY, startZ:''' The start [origin] of the line&lt;br /&gt;
*'''endX, endY, endZ:''' The end of the line&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*'''hit:''' ''true'' if there is a collision with the given element's mesh, ''false'' otherwise [in which case all other values are nil]&lt;br /&gt;
*'''texU, texV:''' the U, V coordinates on the hit geometry's texture&lt;br /&gt;
*'''textureName:''' name of the hit geometry's texture&lt;br /&gt;
*'''frameName:''' hit frame's name&lt;br /&gt;
*'''worldX, worldY, worldZ:''' collision position in world space&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnMarkerHit&amp;diff=77648</id>
		<title>OnMarkerHit</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnMarkerHit&amp;diff=77648"/>
		<updated>2023-09-20T20:40:31Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add important note regarding weird behavior&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when an element enters a marker created using [[createMarker]].&lt;br /&gt;
{{Important Note|The event is not triggered when only the dimension changes of the player. So, if you use the `matchingDimension` when teleporting players into existing markers you should always first set their dimension/interior and only then the position}}&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 hit the [[marker]].&lt;br /&gt;
*'''matchingDimension''': a [[boolean]] representing whether the [[element]] is in the same dimension as the [[marker]].&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[marker]] that got hit by the element.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
This example will output a message what type of element has entered a marker.&lt;br /&gt;
&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local playerMarker = createMarker(0, 0, 2, &amp;quot;cylinder&amp;quot;, 5, 10, 244, 23, 200, root)&lt;br /&gt;
&lt;br /&gt;
function handlePlayerMarker(hitElement)&lt;br /&gt;
	local elementType = getElementType(hitElement)&lt;br /&gt;
&lt;br /&gt;
	outputChatBox(&amp;quot;Element (&amp;quot;..elementType..&amp;quot;) has entered marker.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onMarkerHit&amp;quot;, playerMarker, handlePlayerMarker)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Issues==&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{Issue|551|If a marker was attached to another element, onMarkerHit won't be triggered}}&lt;br /&gt;
{{Issue|519|onMarkerHit not always triggered in interiors}}&lt;br /&gt;
{{Issue|923|Server side markers with size &amp;lt; 1.5 don't trigger event}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Marker events}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientMarkerHit&amp;diff=77647</id>
		<title>OnClientMarkerHit</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientMarkerHit&amp;diff=77647"/>
		<updated>2023-09-20T20:39:42Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered when a player enters a marker created using [[createMarker]].&lt;br /&gt;
&lt;br /&gt;
{{Important Note|The event is not triggered when only the dimension changes of the player. So, if you use the `matchingDimension` when teleporting players into existing markers you should always first set their dimension/interior and only then the position}}&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player hitPlayer, bool matchingDimension&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''hitPlayer:''' the [[player]] that hit the [[marker]].&lt;br /&gt;
*'''matchingDimension:''' ''true'' if the [[player]] is in the same [[dimension]] as the hit [[marker]].&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[marker]] that got hit by the player.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This code will output a message to the chatbox whenever any player walks into any marker.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function MarkerHit ( hitPlayer, matchingDimension )&lt;br /&gt;
	outputChatBox ( getPlayerName(hitPlayer) .. &amp;quot; entered a marker&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientMarkerHit&amp;quot;, getRootElement(), MarkerHit )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client marker events===&lt;br /&gt;
{{Client marker events}}&lt;br /&gt;
===Client marker functions===&lt;br /&gt;
{{Client_marker_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientMarkerHit&amp;diff=77646</id>
		<title>OnClientMarkerHit</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientMarkerHit&amp;diff=77646"/>
		<updated>2023-09-20T20:39:17Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add important note regarding weird behaviour&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered when a player enters a marker created using [[createMarker]].&lt;br /&gt;
&lt;br /&gt;
{{Important Note|The event is not triggered when only the dimension changes of an element. So, if you use the `matchingDimension` when teleporting players into existing markers you should always first set their dimension/interior and only then the position}}&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player hitPlayer, bool matchingDimension&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''hitPlayer:''' the [[player]] that hit the [[marker]].&lt;br /&gt;
*'''matchingDimension:''' ''true'' if the [[player]] is in the same [[dimension]] as the hit [[marker]].&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[marker]] that got hit by the player.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This code will output a message to the chatbox whenever any player walks into any marker.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function MarkerHit ( hitPlayer, matchingDimension )&lt;br /&gt;
	outputChatBox ( getPlayerName(hitPlayer) .. &amp;quot; entered a marker&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientMarkerHit&amp;quot;, getRootElement(), MarkerHit )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client marker events===&lt;br /&gt;
{{Client marker events}}&lt;br /&gt;
===Client marker functions===&lt;br /&gt;
{{Client_marker_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineRequestModel&amp;diff=77527</id>
		<title>EngineRequestModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineRequestModel&amp;diff=77527"/>
		<updated>2023-08-26T18:02:05Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add note about having to call engineFreeModel in onClientResourceStop&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20147|This function is used to assign the next available model ID to a certain element type.}}&lt;br /&gt;
{{note|Before release '''1.5.8 r20716''' this must be &amp;quot;ped&amp;quot;. After release '''1.5.8 r20716''' this function supports &amp;quot;vehicle&amp;quot; and &amp;quot;object&amp;quot; too.}}&lt;br /&gt;
{{note|Vehicle unique features may be unsupported, see [https://github.com/multitheftauto/mtasa-blue/issues/1861 issue 1861] for examples and details}}&lt;br /&gt;
{{Important Note|Unlike some other functions, the side-effects of this function aren't reverted on resource stop, so you must manually call [[engineFreeModel]] in [[onClientResourceStop]] (Just like the example below does)}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int engineRequestModel ( string elementType [, int parentID ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''elementType''': &amp;quot;ped&amp;quot;, &amp;quot;vehicle&amp;quot; or &amp;quot;object&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''parentID''': The ID of the parent model (by default this is: 1337 - objects, 400 - vehicles, 7 - peds).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20147| Returns an ''integer'' of the model ID that was available to be assigned to the element type, ''false'' if no free model ID available or invalid element type.}}&lt;br /&gt;
Do not rely on the model numbers returned being consistent across multiple clients or multiple runs of resources. There is no guarantee for the order of the numbers or that the same numbers will always correspond to the same element type. Any patterns are coincidental.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example creates a ped and then gives you the opportunity to change its model. If the resource stops, then the IDs allocated will be deallocated. Use ''/cap'' for creating the ped and ''/sap'' to skin the ped. You will need some skins added to a folder and to the meta.xml for ''/sap'' to work:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local peds = {}&lt;br /&gt;
function createAllocatedPed()&lt;br /&gt;
    local x, y, z = getElementPosition(localPlayer)&lt;br /&gt;
    local id = engineRequestModel(&amp;quot;ped&amp;quot;)&lt;br /&gt;
    peds[id] = createPed(id, x+0.5, y, z+0.5)&lt;br /&gt;
    outputChatBox(&amp;quot;New ped with ID &amp;quot;..id..&amp;quot; created.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;cap&amp;quot;, createAllocatedPed, false, false)&lt;br /&gt;
&lt;br /&gt;
function skinAllocatedPeds()&lt;br /&gt;
    local txd, dff;&lt;br /&gt;
    for id,ped in pairs(peds) do&lt;br /&gt;
        if fileExists(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.txd&amp;quot;) and fileExists(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.dff&amp;quot;) then&lt;br /&gt;
            txd = engineLoadTXD(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.txd&amp;quot;)&lt;br /&gt;
            engineImportTXD(txd, id)&lt;br /&gt;
            dff = engineLoadDFF(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.dff&amp;quot;)&lt;br /&gt;
            engineReplaceModel(dff, id)&lt;br /&gt;
            outputChatBox(&amp;quot;Model ID &amp;quot;..id..&amp;quot; changed correctly.&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Model ID &amp;quot;..id..&amp;quot; couldn't change. REASON: skins/&amp;quot; .. id .. &amp;quot;.txd or skins/&amp;quot; .. id .. &amp;quot;.dff does not exist.&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;sap&amp;quot;, skinAllocatedPeds, false, false)&lt;br /&gt;
&lt;br /&gt;
function onStop()&lt;br /&gt;
    for id,ped in pairs(peds) do&lt;br /&gt;
        engineFreeModel(id)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStop&amp;quot;, resourceRoot, onStop)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.7-9.20147|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreaming&amp;diff=77525</id>
		<title>EngineStreaming</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreaming&amp;diff=77525"/>
		<updated>2023-08-25T23:36:45Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Static class used for manipulating the GTA:SA streaming engine.&lt;br /&gt;
&lt;br /&gt;
==See more==&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77524</id>
		<title>EngineStreamingGetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77524"/>
		<updated>2023-08-25T23:34:27Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Gets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|The `showmemstat` command can be used to see this value in real-time [You might have to scroll down using PgDown on your keyboard]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
number engineStreamingGetMemorySize()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:getMemorySize|memorySize|engineStreamingSetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The maximum amount of RAM [in bytes] that can be used for streaming. It is always a non-zero positive number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77523</id>
		<title>EngineStreamingSetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77523"/>
		<updated>2023-08-25T23:34:17Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Sets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|The `showmemstat` command can be used to see this value in real-time [You might have to scroll down using PgDown on your keyboard]}}&lt;br /&gt;
{{Tip|To restore to default value use [[engineStreamingRestoreMemorySize]]}}&lt;br /&gt;
{{Important Note|'''This function is meant for advanced users only, as it can lead to stability issues'''. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetBufferSize&amp;diff=77522</id>
		<title>EngineStreamingGetBufferSize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetBufferSize&amp;diff=77522"/>
		<updated>2023-08-25T23:32:47Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Get the streaming buffer size ['''not''' maximum memory size]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
number engineStreamingGetBufferSize()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:getBufferSize|bufferSize|engineStreamingSetBufferSize}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The streaming buffer size. It is always a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming buffer size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;sbs&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        if engineStreamingSetBufferSize(tonumber(sizeMB) * 1024 * 1024) then -- Convert MB to Bytes&lt;br /&gt;
            outputChatbox(&amp;quot;The streaming buffer size has been changed from &amp;quot; .. math.floor(engineStreamingGetBufferSize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatbox(&amp;quot;Not enough memory!&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetBufferSize&amp;diff=77521</id>
		<title>EngineStreamingGetBufferSize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetBufferSize&amp;diff=77521"/>
		<updated>2023-08-25T23:32:30Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Created page with &amp;quot;__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|21874|Get the streaming buffer size ['''not''' maximum memory size]}} ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; number engineStreamingGetBufferSize() &amp;lt;/syntaxhighlight&amp;gt; {{OOP||EngineStreaming:setBufferSize|bufferSize|engineStreamingGetBufferSize}}  ===Returns=== The streaming buffer size. It is always a positive non-zero number.  ==Example== This example adds a command that can be used to change the streamin...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Get the streaming buffer size ['''not''' maximum memory size]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
number engineStreamingGetBufferSize()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setBufferSize|bufferSize|engineStreamingGetBufferSize}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The streaming buffer size. It is always a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming buffer size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;sbs&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        if engineStreamingSetBufferSize(tonumber(sizeMB) * 1024 * 1024) then -- Convert MB to Bytes&lt;br /&gt;
            outputChatbox(&amp;quot;The streaming buffer size has been changed from &amp;quot; .. math.floor(engineStreamingGetBufferSize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatbox(&amp;quot;Not enough memory!&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetBufferSize&amp;diff=77520</id>
		<title>EngineStreamingSetBufferSize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetBufferSize&amp;diff=77520"/>
		<updated>2023-08-25T23:30:48Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Set the streaming buffer size. The larger it is, the more models can be loaded in one go BUT increases the RAM  ['''not''' streaming memory!] usage. Can help with custom IMG loading speed by reducing pop-in.}}&lt;br /&gt;
{{Important Note|'''This function is meant for advanced users only, as it can lead to stability issues'''. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in!}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool engineStreamingSetBufferSize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setBufferSize|bufferSize|engineStreamingGetBufferSize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The streaming buffer size. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
True if there was enough memory to allocate the buffer, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming buffer size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;sbs&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        if engineStreamingSetBufferSize(tonumber(sizeMB) * 1024 * 1024) then -- Convert MB to Bytes&lt;br /&gt;
            outputChatbox(&amp;quot;The streaming buffer size has been changed from &amp;quot; .. math.floor(engineStreamingGetBufferSize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatbox(&amp;quot;Not enough memory!&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetBufferSize&amp;diff=77519</id>
		<title>EngineStreamingSetBufferSize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetBufferSize&amp;diff=77519"/>
		<updated>2023-08-25T23:30:17Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Created page with &amp;quot;__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|21874|Get the streaming buffer size. The larger it is, the more models can be loaded in one go BUT increases the RAM  ['''not''' streaming memory!] usage. Can help with custom IMG loading speed by reducing pop-in.}} {{Important Note|'''This function is meant for advanced users only, as it can lead to stability issues'''. Using a very high value might result in more crashes, while using a value too low might le...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Get the streaming buffer size. The larger it is, the more models can be loaded in one go BUT increases the RAM  ['''not''' streaming memory!] usage. Can help with custom IMG loading speed by reducing pop-in.}}&lt;br /&gt;
{{Important Note|'''This function is meant for advanced users only, as it can lead to stability issues'''. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in!}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool engineStreamingSetBufferSize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setBufferSize|bufferSize|engineStreamingGetBufferSize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The streaming buffer size. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
True if there was enough memory to allocate the buffer, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming buffer size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;sbs&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        if engineStreamingSetBufferSize(tonumber(sizeMB) * 1024 * 1024) then -- Convert MB to Bytes&lt;br /&gt;
            outputChatbox(&amp;quot;The streaming buffer size has been changed from &amp;quot; .. math.floor(engineStreamingGetBufferSize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatbox(&amp;quot;Not enough memory!&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77518</id>
		<title>EngineStreamingSetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77518"/>
		<updated>2023-08-25T23:21:20Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Change build number to the correct value&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Sets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|To restore to default value use [[engineStreamingRestoreMemorySize]]}}&lt;br /&gt;
{{Important Note|'''This function is meant for advanced users only, as it can lead to stability issues'''. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77517</id>
		<title>EngineStreamingGetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77517"/>
		<updated>2023-08-25T23:20:39Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Fix Returns styling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Gets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
number engineStreamingGetMemorySize()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:getMemorySize|memorySize|engineStreamingSetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The maximum amount of RAM [in bytes] that can be used for streaming. It is always a non-zero positive number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77516</id>
		<title>EngineStreamingGetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77516"/>
		<updated>2023-08-25T23:20:04Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Change build number to the correct value&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Gets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
number engineStreamingGetMemorySize()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:getMemorySize|memorySize|engineStreamingSetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
The maximum amount of RAM [in bytes] that can be used for streaming. It is always a non-zero positive number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingRestoreMemorySize&amp;diff=77515</id>
		<title>EngineStreamingRestoreMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingRestoreMemorySize&amp;diff=77515"/>
		<updated>2023-08-25T23:19:01Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Created page with &amp;quot;__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|21874|Restores the maximum amount of RAM [in bytes] that can be used for streaming to the default value}} {{Tip|The function to manipulate the memory size is engineStreamingSetMemorySize}}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; nil engineStreamingSetMemorySize() &amp;lt;/syntaxhighlight&amp;gt; {{OOP||EngineStreaming:restoreMemorySize||}}  ==Example== This example adds a command that can be used to change the stre...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21874|Restores the maximum amount of RAM [in bytes] that can be used for streaming to the default value}}&lt;br /&gt;
{{Tip|The function to manipulate the memory size is [[engineStreamingSetMemorySize]]}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:restoreMemorySize||}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;rsms&amp;quot;, function()&lt;br /&gt;
    local prevMB = math.floor(engineGetStreamingMemorySize() / 1024 / 1024)&lt;br /&gt;
    engineStreamingRestoreMemorySize()&lt;br /&gt;
    outputChatbox(&amp;quot;The maximum streaming memory available has been restored to the original value of &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB [Was &amp;quot; .. prevMB .. &amp;quot; MB]&amp;quot;)&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21874|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77514</id>
		<title>EngineStreamingSetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77514"/>
		<updated>2023-08-25T23:10:35Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21946|Sets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|To restore to default value use [[engineStreamingRestoreMemorySize]]}}&lt;br /&gt;
{{Important Note|'''This function is meant for advanced users only, as it can lead to stability issues'''. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21946|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77513</id>
		<title>EngineStreamingSetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77513"/>
		<updated>2023-08-25T23:10:07Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21946|Sets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|To restore to the default value use [[engineStreamingRestoreMemorySize]]}}&lt;br /&gt;
{{Important Note|'''This function is meant for advanced users only, as it can lead to stability issues'''. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21946|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77512</id>
		<title>EngineStreamingSetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77512"/>
		<updated>2023-08-25T23:09:10Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21946|Sets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|To restore to the default value use [[engineStreamingRestoreMemorySize]]}}&lt;br /&gt;
{{Important Note|**This function is meant for advanced users only, as it can lead to stability issues**. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21946|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77511</id>
		<title>EngineStreamingSetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77511"/>
		<updated>2023-08-25T23:08:56Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21946|Sets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|To restore to the default value use [[engineStreamingRestoreMemorySize]]}}&lt;br /&gt;
{{Important Note|**This function is meant for advanced users only, as it can lead to stability issues**. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sets the memory size to 512 MB.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;cap&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21946|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77510</id>
		<title>EngineStreamingGetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingGetMemorySize&amp;diff=77510"/>
		<updated>2023-08-25T23:08:25Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Created page with &amp;quot;__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|21946|Gets the maximum amount of RAM [in bytes] that can be used for streaming}} ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; number engineStreamingGetMemorySize() &amp;lt;/syntaxhighlight&amp;gt; {{OOP||EngineStreaming:getMemorySize|memorySize|engineStreamingSetMemorySize}}  ==Returns== The maximum amount of RAM [in bytes] that can be used for streaming. It is always a non-zero positive number.  ==Example== This example add...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21946|Gets the maximum amount of RAM [in bytes] that can be used for streaming}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
number engineStreamingGetMemorySize()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:getMemorySize|memorySize|engineStreamingSetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
The maximum amount of RAM [in bytes] that can be used for streaming. It is always a non-zero positive number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a command that can be used to change the streaming memory size, and display the previous value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;ssms&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21946|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77509</id>
		<title>EngineStreamingSetMemorySize</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreamingSetMemorySize&amp;diff=77509"/>
		<updated>2023-08-25T23:02:32Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Created page with &amp;quot;__NOTOC__ {{Client function}} {{New feature/item|3.0160|1.6.0|21946|Sets the maximum amount of [in bytes] that can be used for streaming}} {{Tip|To restore to the default value use engineStreamingRestoreMemorySize}} {{Important Note|**This function is meant for advanced users only, as it can lead to stability issues**. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-st...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6.0|21946|Sets the maximum amount of [in bytes] that can be used for streaming}}&lt;br /&gt;
{{Tip|To restore to the default value use [[engineStreamingRestoreMemorySize]]}}&lt;br /&gt;
{{Important Note|**This function is meant for advanced users only, as it can lead to stability issues**. Using a very high value might result in more crashes, while using a value too low might lead to frequent pop-in [and due to the way MTA works micro-stutter as well]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil engineStreamingSetMemorySize( number sizeBytes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[EngineStreaming]]:setMemorySize|memorySize|engineStreamingGetMemorySize}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''sizeBytes ''': The maximum amount of RAM [in bytes] that can be used for streaming. Must be a positive non-zero number.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sets the memory size to 512 MB.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;cap&amp;quot;, function(_, sizeMB)&lt;br /&gt;
    if tonumber(sizeMB) then&lt;br /&gt;
        outputChatbox(&amp;quot;The maximum streaming memory available has been changed from &amp;quot; .. math.floor(engineGetStreamingMemorySize() / 1024 / 1024) .. &amp;quot; MB to &amp;quot; .. sizeMB .. &amp;quot; MB&amp;quot;)      &lt;br /&gt;
        engineStreamingSetMemorySize(tonumber(sizeMB) * 1024 * 1024) -- Convert MB to Bytes&lt;br /&gt;
    else&lt;br /&gt;
        outputChatbox(&amp;quot;Please enter a numeric value!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end, false, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.6.0-9.21946|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineStreaming&amp;diff=77508</id>
		<title>EngineStreaming</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineStreaming&amp;diff=77508"/>
		<updated>2023-08-25T22:50:59Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Created page with &amp;quot;Static class used for manipulating the GTA:SA streaming engine.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Static class used for manipulating the GTA:SA streaming engine.&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Compiling_MTASA&amp;diff=75700</id>
		<title>Compiling MTASA</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Compiling_MTASA&amp;diff=75700"/>
		<updated>2022-12-04T22:48:04Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add mirror 2 (Also, someone please move the hashes into a spoiler)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In order to successfully build Multi Theft Auto from source, it is necessary to perform a number of steps, which we will explain below.&lt;br /&gt;
&lt;br /&gt;
Please read the instructions carefully and do not skip parts of it, if you have no experience.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Compiling the Multi Theft Auto client is only supported on Windows 10.&lt;br /&gt;
&lt;br /&gt;
Make sure you have the following software and SDKs installed:&lt;br /&gt;
&lt;br /&gt;
=== Visual Studio 2022 ===&lt;br /&gt;
[[File:Visual_Studio_Community.PNG|right|150px|link=https://www.visualstudio.com/vs/]]&lt;br /&gt;
# '''[https://visualstudio.microsoft.com/vs/ Download Microsoft Visual Studio 2022]''' - make sure you get the Community Edition, that one is free.&lt;br /&gt;
# On the installation checklist, [[:File:VsFoundationClasses.png|make sure you tick these 2 items]]:&lt;br /&gt;
## ''Desktop development with C++''&lt;br /&gt;
## Optional component ''C++ MFC for latest v143 build tools (x86 &amp;amp; x64)''&lt;br /&gt;
&lt;br /&gt;
If you don't enable MFC, you will get the following error: &amp;lt;code&amp;gt;cannot open include file 'afxres.h'&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you've made a mistake, you can run the ''Visual Studio Installer'' app to modify your current installation. There is no need to uninstall and reinstall.&lt;br /&gt;
&lt;br /&gt;
=== Microsoft DirectX SDK ===&lt;br /&gt;
[[File:DirectX_SDK.jpg|right|150px|link=http://web.archive.org/web/20200804044856/https://www.microsoft.com/en-us/download/details.aspx?id=23549]]&lt;br /&gt;
'''Download Microsoft DirectX SDK (August 2009) (DXSDK_Aug09.exe):'''&lt;br /&gt;
* [https://archive.org/download/dxsdk_aug09/DXSDK_Aug09.exe Mirror 1]&lt;br /&gt;
* [https://mega.nz/file/pQJCiAJY#jBcYT6ZP4DMBpnm12BLRto9EQ-RjjpP3BWkSPanpvLI Mirror 2]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-top: 0px; width: 70%; word-break: break-all;&amp;quot;&lt;br /&gt;
|+ File verification&lt;br /&gt;
|- style=&amp;quot;vertical-align:bottom;&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; | Algorithm and variant&lt;br /&gt;
! Hash&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; | '''{{nowrap|SHA-3}}''' || ''SHA3-224'' || 8bfcdc03518d7edd34689534fd4d21291469ff2f2eb10437ad648c58&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA3-256'' || 45bf3e08da3b3636ddb4f4a74243430f8d65759c074c0d79756ef810c4701c5a&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA3-384'' || b358e529963d6f5fd7f8bd4b530fb18f6a2e6a442009a54e981b2f9967589ed48150af310f283640d56f9b60d41100c9&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA3-512'' || 43522187053af744250059ef69c0f3083cecd1157fe56daac16b9497ebc6fb5b525875144e42898367c55f757cffd3526f37074d544470578602a5a944a45a75&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHAKE128'' || 2a7c81bde9e867cbb5ef00b72ad8de66a3ee64c1d59f16465fa712479b6a84d28a02cc5ed08afa1d51e72011657453dbd4656cc9340d32e18179c39d03982dfc35c8f0c2a5c99e11dc74d0e23ed21b1e55f19c809a5a152bde39a2d46fcd12421f373f2d691ade1b57faf6c2ab7aded5a7d174f1f1c77127c0d6a1523b4775c569c5e1b4efa2da4bf2f708a96707a709e245a7f507382e69a81777919c90e95a091c0b699ce7f517&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHAKE256'' || 9c100dac5245a61774f3a2752bf9e941bdcd5654b18035155161c63b20936dfc9bd7334feb9a6fe9a99a65491161083b39ac3bd578e2cf4f90cba3c786e9924fa0611f65a725331b77b63e7c8b552e1637bc77531ba0f2c9cac72115b28e523929ede4e5b246a0755e8d5c4089d94bf16627fb08672cfffa523bba3d976489a0eec60d3c6a96ca2b&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; | '''{{nowrap|SHA-2}}''' || ''SHA-224'' || a3a74b89cccfe314b79418d5598aac5e94800221e5d945c74f15c004&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-256'' || 4ab1de69312f10f6b41310a5218d80c478bbd823bc0f86627318d690b128fb9f&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-384'' || 254ed29c6ad2cadc6f013d2d51c0ac78a6bbe236a2c94ca99610eba8b2c1200d1a62c445ca9ee51bb09354875d5eca8a&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-512'' || style=&amp;quot;width: 60%;&amp;quot; | 736393c0dfa32221e229890f87eb330174d70dd2a02fa0cace303816d3e7a10a332a44129748de39665d1b339e627d6028c2080268f7afdd5240c447fec8ff0b&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-512/224'' || 7e23d9ba916000782a17e23abf48e25237f45590cfe767aed9d79f10&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-512/256'' || 0c833a56046fe7e4213fcb1862c730acf313d1b8f60b51eebf64dc3e79730c1c&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | '''MD5''' || 66e5379ecf46b014688779621bcc677c&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | '''{{nowrap|SHA-1}}''' || 5b9b969ed7b6cf5534bb7350e44c09b3573b0e71&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | '''{{nowrap|CRC32}}''' || e9f5c61d&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Restart your computer after installing ''Microsoft DirectX SDK'', because otherwise the environment variable '''DXSDK_DIR''' won't be available yet. After restarting it re-run '''create-projects.bat'''&lt;br /&gt;
&lt;br /&gt;
'''Cant find d3dx9.h'''&amp;lt;br&amp;gt;&lt;br /&gt;
Add the '''$(DXSDK_DIR)Include;''' to the VC++ Directories in DirectX9GuiRenderer, GUI and Client Core projects.&lt;br /&gt;
You can find the VC++ Directories list by selecting a project, then pressing the shortcut ALT + ENTER (without the +), then under the 'Configuration properties' you can find 'VC++ Directories', and in there you can find the 'Include Directories' field, click on it and add ''';$(DXSDK_DIR)Include;''' at the end of it. &lt;br /&gt;
'''Note: You need to do the same thing in Release mode as well'''&lt;br /&gt;
&lt;br /&gt;
'''Cant find d3dx9.lib'''&amp;lt;br&amp;gt;&lt;br /&gt;
Do do same as in the error above, but instead of ''';$(DXSDK_DIR)Include;''' you must add ''';$(DXSDK_DIR)Lib/x86;''' to the '''Library directories''' field&lt;br /&gt;
'''Note: You need to do the same thing in Release mode as well'''&lt;br /&gt;
&lt;br /&gt;
'''S1023 Error'''&amp;lt;br&amp;gt;&lt;br /&gt;
[https://support.microsoft.com/en-us/kb/2728613 &amp;quot;S1023&amp;quot; error when you install the DirectX SDK (June 2010)]&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Cannot open source file &amp;quot;xxx.h&amp;quot; after upgrading to Visual Studio 2022'''&amp;lt;br&amp;gt;&lt;br /&gt;
If you've just upgraded to Visual Studio 2022 and were working on MTA using a previous version, you may receive errors about header files not being found (stdio.h, stddef.h, etc) when building the project. &lt;br /&gt;
&lt;br /&gt;
Make sure you have the latest Windows 10 SDK installed (via the Visual Studio Installer) and restart your PC. &lt;br /&gt;
&lt;br /&gt;
If that doesn't work - close Visual Studio, go into the `Build` folder (where your mtasa-blue is located) and delete the `.vs` folder. Start Visual Studio and everything should be fixed.&lt;br /&gt;
&lt;br /&gt;
=== Git Client ===&lt;br /&gt;
[[File:Git_logo.png|left|32px|link=https://git-scm.com/]]&lt;br /&gt;
&lt;br /&gt;
If you would like to contribute to MTA, you should install Git. This will allow you to collaborate with us by creating branches and pushing to your own fork. If you are not comfortable with the command line, we recommend you to download and install [https://desktop.github.com/ GitHub Desktop].&lt;br /&gt;
&lt;br /&gt;
If you only want to compile the source code and are not interested in contributing to MTA, you can download the source directly (see below).&lt;br /&gt;
&lt;br /&gt;
== Getting the latest source code ==&lt;br /&gt;
&lt;br /&gt;
To get the latest code, you will have to download the latest copy of our Git repository.&amp;lt;br&amp;gt;&lt;br /&gt;
We recommend cloning the repository in your Git client because you can pull any updates from there easily.&lt;br /&gt;
&lt;br /&gt;
* '''Repository:''' [https://github.com/multitheftauto/mtasa-blue multitheftauto/mtasa-blue]&lt;br /&gt;
* '''.zip:''' [https://github.com/multitheftauto/mtasa-blue/archive/master.zip master.zip]&lt;br /&gt;
* '''.tar.gz:''' [https://github.com/multitheftauto/mtasa-blue/archive/master.tar.gz master.tar.gz]&lt;br /&gt;
&lt;br /&gt;
== Compiling the code ==&lt;br /&gt;
# Execute the script '''win-create-projects.bat'''&lt;br /&gt;
# Open the solution file '''MTASA.sln''' in the '''Build''' directory&lt;br /&gt;
# If you are asked to upgrade the project, click '''Cancel'''&lt;br /&gt;
# Select '''Debug''' - '''Win32''' configuration in Visual Studio, then press Build &amp;gt; Build Solution... (may take some minutes)&lt;br /&gt;
# Execute the script '''win-install-data.bat'''&lt;br /&gt;
&lt;br /&gt;
= Running the software =&lt;br /&gt;
&lt;br /&gt;
== Running the client ==&lt;br /&gt;
&lt;br /&gt;
You can start your client in the '''Bin''' directory. You might find there a ''Multi Theft Auto.exe'' and/or ''Multi Theft Auto_d.exe'' executable. The ''_d'' suffix indicates a debug build of the software.&amp;lt;br&amp;gt;&lt;br /&gt;
Furthermore, you can also run your client inside the debugger from Visual Studio if you want to investigate a stack trace or set breakpoints in interesting code regions (read more in the section Debugging below).&lt;br /&gt;
&lt;br /&gt;
== Running the dedicated server ==&lt;br /&gt;
&lt;br /&gt;
If you already have run step 5 (''Install resources'') in ''Compiling the code'' to install resources then you can go to ''Starting the server''.&lt;br /&gt;
&lt;br /&gt;
=== Installing the latest resources ===&lt;br /&gt;
If you want to run the Multi Theft Auto dedicated server, you will have to install the required resources. These are required because they implement the most basic functionality (e.g. spawning players) in order to play.&lt;br /&gt;
&lt;br /&gt;
Our official resources repository is [https://github.com/multitheftauto/mtasa-resources hosted on GitHub]. You can download the latest resources from there or [http://mirror.mtasa.com/mtasa/resources/ download a zipped version]. Make sure that you have the latest resources package.&lt;br /&gt;
&lt;br /&gt;
=== Starting the server ===&lt;br /&gt;
To run the server, open the ''MTA Server.exe'' executable in the '''Bin/server''' directory. The ''_d'' suffix indicates a debug build of the software.&amp;lt;br&amp;gt;&lt;br /&gt;
You can also run the debug build ''MTA Server_d.exe'' with the Visual Studio Debugger (as of writing, you can do that by right-clicking on the Server's Launcher project and selecting ''Start a local instance'' in the ''Debugger'' menu), but you can also attach to a running debug build MTA server (see more in the section Debugging below).&lt;br /&gt;
&lt;br /&gt;
== Debugging ==&lt;br /&gt;
If you already compiled the code in the '''Debug''' configuration then continue reading, if not, then go up to ''Compiling the code'' and follow the steps for a ''Debug'' build.&amp;lt;br&amp;gt;&lt;br /&gt;
You can either launch MTA yourself and attach any debugger you want to use (also applies to the Visual Studio debugger) or you start a local debugging session in Visual Studio.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Local_Windows_Debugger.PNG]]&lt;br /&gt;
&lt;br /&gt;
=== How to enable breakpoints ===&lt;br /&gt;
If you choose to run MTA with Visual Studio then you should also attach the debugger to the executable '''gta_sa.exe''' (press ''CTRL + ALT + P'' in Visual Studio) - otherwise, your&lt;br /&gt;
breakpoints will not work for anything besides the MTA Launcher project.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Attach_to_Process.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Extending timeout duration ===&lt;br /&gt;
When you use breakpoints during debugging, you may get kicked by the server due to timeout, because the client is frozen. To prevent this, create the '''timeout.longtime''' file in your ''Bin/server/'' directory.  &lt;br /&gt;
The content of the file is the new timeout duration in seconds, so make sure you type a huge number in there. If you keep the file empty, the timeout will be set to 120 seconds.&lt;br /&gt;
&lt;br /&gt;
=== ReAttach for Visual Studio ===&lt;br /&gt;
You can use [https://marketplace.visualstudio.com/items?itemName=ErlandR.ReAttach ReAttach] to re-attach the debugger to the '''gta_sa.exe''' executable whenever you start your local debugger in Visual Studio.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:ReAttach_to_GTASA.PNG]]&lt;br /&gt;
&lt;br /&gt;
= Getting involved =&lt;br /&gt;
Please see our [[Coding guidelines]] for information on the coding practice.&lt;br /&gt;
&lt;br /&gt;
= Additional information =&lt;br /&gt;
If you need more information, try our [https://github.com/multitheftauto/mtasa-blue/issues bug tracker] or [https://discord.com/invite/mtasa Discord].&lt;br /&gt;
&lt;br /&gt;
= Errors =&lt;br /&gt;
== CL38 error. [netc_d.dll not found] ==&lt;br /&gt;
Solution: Delete '''Multi Theft Auto_d.exe''' and hit compile again.&lt;br /&gt;
&lt;br /&gt;
== After cloning the repository, it doesn't compile the project ==&lt;br /&gt;
Solution: Execute '''win-create-projects.bat''' in main directory.&lt;br /&gt;
&lt;br /&gt;
== CL17 Load field. Please ensure that the latest data files have been installed correctly ==&lt;br /&gt;
Solution: Execute '''win-install-data.bat''' in main directory.&lt;br /&gt;
&lt;br /&gt;
== ERROR: Loading network library (net_d.dll) failed! ==&lt;br /&gt;
Solution: Execute '''win-install-data.bat''' in main directory.&lt;br /&gt;
&lt;br /&gt;
[[en:Compiling MTASA]]&lt;br /&gt;
[[hu:Compiling MTASA]]&lt;br /&gt;
[[pt-br:Compilando o MTASA]]&lt;br /&gt;
[[ru:Compiling MTASA]]&lt;br /&gt;
[[Category: Development]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxCreateTexture&amp;diff=73985</id>
		<title>DxCreateTexture</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxCreateTexture&amp;diff=73985"/>
		<updated>2022-02-04T00:00:21Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add tip to pre-convert textures using dxtex texconv&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function creates a [[texture]] element that can be used in the dxDraw functions.&lt;br /&gt;
{{Important Note|This function uses significant process RAM, make sure you don't load a lot of textures, because you'll run out of memory and crash MTA on your gaming PC beyond the technical limit of 3.5 GB (weak PC users much earlier). Besides that, don't make the common mistake of causing a memory leak by not destroying textures (causing dxTextures to pile up) when they should no longer display per your script, which causes FPS lag and crashes all over MTA due to so many scripters missing it}}&lt;br /&gt;
{{Note|The times shown at the right of the page are only the time needed to add the thing to the draw queue, its not the actual time it takes to draw them.}}&lt;br /&gt;
{{Tip|It is recommended to pre-convert textures to whatever format you want to load them as. ARGB should be PNG, all other formats are self explanatory. By doing this you can load textures on the fly without any hickups (Note: There might still be some if the user has a slow HHD). See [https://github.com/microsoft/DirectXTex/releases DirectXTex texconv tool]. }}&lt;br /&gt;
[[Image:Screenshot_27.png|frame|A speedtest showing the performance of a texture created with various settings of textureFormat.[Mipmaps = true][textureEdge = &amp;quot;wrap&amp;quot;]]]&lt;br /&gt;
[[Image:DxCreateTexture_mipmaps_false.png |frame|A speedtest showing the performance of a texture created with various settings of textureFormat.[Mipmaps = false][textureEdge = &amp;quot;wrap&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
It is possible to use dxCreateTexture to load cubemaps and volume textures, but these will only be useable as inputs for a shader. The Microsoft utility [http://nightly.mtasa.com/files/shaders/DxTex.zip DxTex] can view and change cubemaps and volume textures. DxTex can also convert standard textures into DXT1/3/5 compressed .dds which should reduce file sizes.&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element dxCreateTexture ( string pixels / string filepath [, string textureFormat = &amp;quot;argb&amp;quot;, bool mipmaps = true, string textureEdge = &amp;quot;wrap&amp;quot; ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element dxCreateTexture ( int width, int height [, string textureFormat = &amp;quot;argb&amp;quot;, string textureEdge = &amp;quot;wrap&amp;quot;, string textureType = &amp;quot;2d&amp;quot;, int depth = 1 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[Texture|DxTexture]]}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''filepath:''' The filepath of the image. (.bmp, .dds, .jpg, .png, and .tga images are supported). Image files should ideally have dimensions that are a power of two, to prevent possible blurring.&lt;br /&gt;
or&lt;br /&gt;
*'''pixels:''' [[Texture_pixels|Pixels]] containing image data. ('plain', 'jpeg' or 'png' pixels can be used here)&lt;br /&gt;
or&lt;br /&gt;
*'''width:''' Desired width, preferably power of two (16, 32, 64 etc.), maximum is 16384&lt;br /&gt;
*'''height :''' Desired height, preferably power of two (16, 32, 64 etc.), maximum is 16384&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''textureFormat :''' A string representing the desired texture format, which can be one of:&lt;br /&gt;
**'''&amp;quot;argb&amp;quot;''' : ARGB uncompressed 32 bit color (default).&lt;br /&gt;
**'''&amp;quot;dxt1&amp;quot;''' : DXT1 compressed - Can take a fraction of a second longer to load (unless the file is already a DXT1 .dds). Uses 8 times less video memory than ARGB and '''can speed up drawing'''. Quality not as good as ARGB. '''It supports alpha blending, but it can only be on or off, that is: either 0 or 255.'''&lt;br /&gt;
**'''&amp;quot;dxt3&amp;quot;''' : DXT3 compressed - Can take a fraction of a second longer to load (unless the file is already a DXT3 .dds). Uses 4 times less video memory than ARGB and '''can speed up drawing'''. Quality slightly better than DXT1 and supports crisp alpha blending.&lt;br /&gt;
**'''&amp;quot;dxt5&amp;quot;''' : DXT5 compressed - Can take a fraction of a second longer to load (unless the file is already a DXT5 .dds). Uses 4 times less video memory than ARGB and '''can speed up drawing'''. Quality slightly better than DXT1 and supports smooth alpha blending.&lt;br /&gt;
*'''mipmaps :''' True to create a mip-map chain so the texture looks good when drawn at various sizes.&lt;br /&gt;
*'''textureEdge :''' A string representing the desired texture edge handling, which can be one of:&lt;br /&gt;
**'''&amp;quot;wrap&amp;quot;''' : Wrap the texture at the edges (default)&lt;br /&gt;
**'''&amp;quot;clamp&amp;quot;''' : Clamp the texture at the edges. This may help avoid edge artifacts.&lt;br /&gt;
**'''&amp;quot;mirror&amp;quot;''' : Mirror the texture at the edges.&lt;br /&gt;
*'''textureType :''' A string representing the desired texture type, which can be one of:&lt;br /&gt;
**'''&amp;quot;2d&amp;quot;''' : Standard texture (default)&lt;br /&gt;
**'''&amp;quot;3d&amp;quot;''' : Volume texture&lt;br /&gt;
**'''&amp;quot;cube&amp;quot;''' : Cube map&lt;br /&gt;
*'''depth:''' Desired number of slices when creating a volume texture&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns a [[texture]] if successful, ''false'' if invalid arguments were passed to the function.&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;onClientRender&amp;quot;, root,&lt;br /&gt;
    function()&lt;br /&gt;
        if myImage then&lt;br /&gt;
            dxDrawImage( 100, 350, 300, 350, myImage  )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
-- Use 'toggle' command to switch image on and off&lt;br /&gt;
addCommandHandler( &amp;quot;toggle&amp;quot;,&lt;br /&gt;
    function()&lt;br /&gt;
        if not myImage then&lt;br /&gt;
            myImage = dxCreateTexture( &amp;quot;moonpig.png&amp;quot; )  -- Create texture&lt;br /&gt;
        else        &lt;br /&gt;
            destroyElement( myImage )                 -- Destroy texture&lt;br /&gt;
            myImage = nil&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&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.04021|Added textureType and depth argument}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.04035|Added textureEdge argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxCreateTexture]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69737</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69737"/>
		<updated>2021-04-05T17:27:34Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Modify my previous important note to point to the code instead of giving a confusing description of the problem&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}} &lt;br /&gt;
{{Important Note|Do '''NOT''' use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when the event it's attached to is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
{{Important Note|See code for this note below}}&lt;br /&gt;
&lt;br /&gt;
Event handlers are functions that are called when a particular event happens. Each event specifies a specific set of variables that are passed to the event handler and can be read by your function. The following global variables are available for use in handler functions:&lt;br /&gt;
*'''source''': the element that triggered the event&lt;br /&gt;
*'''this''': the element that the event handler is attached to&lt;br /&gt;
*'''sourceResource''': the resource that triggered the event&lt;br /&gt;
*'''sourceResourceRoot''': the root element of the resource that triggered the event&lt;br /&gt;
*'''client''': the client that triggered the event using [[triggerServerEvent]]. Not set if the event was not triggered from a client.&lt;br /&gt;
{{New_feature|3|1.0|&lt;br /&gt;
*'''eventName''': the name of the event which triggered the handler function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is important to remember that events pass up and down the [[element tree]]. An event triggered on the root element is triggered on every element in the tree. An event triggered on any other element is triggered on its ancestors (its parent element and its parent's parent etc) and its children, grandchildren and great-grandchildren. You can use the ''getPropagated'' argument to specify if you wish your handler to receive events that have propagated up or down the tree.&lt;br /&gt;
&lt;br /&gt;
The order in which event handlers are triggered is undefined, you should not rely on one event handler being executed before another.&lt;br /&gt;
{{Note|See [[Script security]] for tips on preventing cheaters when using events and element data}}&lt;br /&gt;
{{Note|See [[Event_Source_Element|Event Source Element]] for a descriptive visualization of the event system handling an event trigger.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool propagate = true, string priority = &amp;quot;normal&amp;quot; ] )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to. '''Note: The maximum allowed length is 100 ASCII characters (that is, English letters and numerals)```&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''handlerFunction:''' The handler function you wish to call when the event is triggered. This function will be passed all of the event's parameters as arguments, but it isn't required that it takes all of them.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''propagate:''' A boolean representing whether the handler will be triggered if the event was propagated down or up the [[element tree]] (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to ''false'' will only be triggered if ''source == this''). In GUI events you will probably want to set this to ''false''.&lt;br /&gt;
{{New_feature|3.0131|1.3.1|&lt;br /&gt;
*'''priority :''' A string representing the trigger order priority relative to other event handlers of the same name. Possible values are:&lt;br /&gt;
**'''&amp;quot;high&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;normal&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;low&amp;quot;'''&lt;br /&gt;
''It is also possible to add finer priority control by appending a positive or negative number to the priority string. For example (in priority order for reference): &amp;quot;high+4&amp;quot; &amp;quot;high&amp;quot; &amp;quot;high-1&amp;quot; &amp;quot;normal-6&amp;quot; &amp;quot;normal-7&amp;quot; &amp;quot;low+1&amp;quot; &amp;quot;low&amp;quot; &amp;quot;low-1&amp;quot;''&lt;br /&gt;
{{Important Note|Anything bound to a specific element will be run before other handlers that are bound to something higher in the element tree (like root) This means that &amp;quot;high+10&amp;quot; bound to root '''won't''' trigger before &amp;quot;normal&amp;quot; bound directly to an element.}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the specified event could not be found or any parameters were invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Code for important note above&amp;quot; class=&amp;quot;Important&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This code might not work as you expect: The handler added here won't be called until the next time the event is triggered. On the other hand, removing events works as expected.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;eventName&amp;quot;)&lt;br /&gt;
addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
    print(&amp;quot;Existing called&amp;quot;)&lt;br /&gt;
    addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
        print(&amp;quot;newly added called&amp;quot;)&lt;br /&gt;
    end)&lt;br /&gt;
end)&lt;br /&gt;
-- first time calling the event&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;&lt;br /&gt;
-- second time - now both handlers are called&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;, &amp;quot;newly added called&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&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;
This serverside example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define our handler function&lt;br /&gt;
function onPlayerSpawnHandler ( )&lt;br /&gt;
	-- get the player's name, source is the player because he was spawned&lt;br /&gt;
	local playerName = getPlayerName( source )&lt;br /&gt;
	-- output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot; has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawnHandler ) -- root is a predefined global variable for getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03795|Added priority argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;br /&gt;
[[ru:addEventHandler]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69718</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69718"/>
		<updated>2021-03-30T21:21:24Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}} &lt;br /&gt;
{{Important Note|Do '''NOT''' use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when the event it's attached to is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
{{Important Note|Adding handler functions to the same event and element as the handler function isn't supported. (The handler won't be called until the next time the event is triggered). On the other hand, removing events works as expected. See code piece below. }}&lt;br /&gt;
&lt;br /&gt;
Event handlers are functions that are called when a particular event happens. Each event specifies a specific set of variables that are passed to the event handler and can be read by your function. The following global variables are available for use in handler functions:&lt;br /&gt;
*'''source''': the element that triggered the event&lt;br /&gt;
*'''this''': the element that the event handler is attached to&lt;br /&gt;
*'''sourceResource''': the resource that triggered the event&lt;br /&gt;
*'''sourceResourceRoot''': the root element of the resource that triggered the event&lt;br /&gt;
*'''client''': the client that triggered the event using [[triggerServerEvent]]. Not set if the event was not triggered from a client.&lt;br /&gt;
{{New_feature|3|1.0|&lt;br /&gt;
*'''eventName''': the name of the event which triggered the handler function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is important to remember that events pass up and down the [[element tree]]. An event triggered on the root element is triggered on every element in the tree. An event triggered on any other element is triggered on its ancestors (its parent element and its parent's parent etc) and its children, grandchildren and great-grandchildren. You can use the ''getPropagated'' argument to specify if you wish your handler to receive events that have propagated up or down the tree.&lt;br /&gt;
&lt;br /&gt;
The order in which event handlers are triggered is undefined, you should not rely on one event handler being executed before another.&lt;br /&gt;
{{Note|See [[Script security]] for tips on preventing cheaters when using events and element data}}&lt;br /&gt;
{{Note|See [[Event_Source_Element|Event Source Element]] for a descriptive visualization of the event system handling an event trigger.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool propagate = true, string priority = &amp;quot;normal&amp;quot; ] )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to. '''Note: The maximum allowed length is 100 ASCII characters (that is, English letters and numerals)```&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''handlerFunction:''' The handler function you wish to call when the event is triggered. This function will be passed all of the event's parameters as arguments, but it isn't required that it takes all of them.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''propagate:''' A boolean representing whether the handler will be triggered if the event was propagated down or up the [[element tree]] (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to ''false'' will only be triggered if ''source == this''). In GUI events you will probably want to set this to ''false''.&lt;br /&gt;
{{New_feature|3.0131|1.3.1|&lt;br /&gt;
*'''priority :''' A string representing the trigger order priority relative to other event handlers of the same name. Possible values are:&lt;br /&gt;
**'''&amp;quot;high&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;normal&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;low&amp;quot;'''&lt;br /&gt;
''It is also possible to add finer priority control by appending a positive or negative number to the priority string. For example (in priority order for reference): &amp;quot;high+4&amp;quot; &amp;quot;high&amp;quot; &amp;quot;high-1&amp;quot; &amp;quot;normal-6&amp;quot; &amp;quot;normal-7&amp;quot; &amp;quot;low+1&amp;quot; &amp;quot;low&amp;quot; &amp;quot;low-1&amp;quot;''&lt;br /&gt;
{{Important Note|Anything bound to a specific element will be run before other handlers that are bound to something higher in the element tree (like root) This means that &amp;quot;high+10&amp;quot; bound to root '''won't''' trigger before &amp;quot;normal&amp;quot; bound directly to an element.}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the specified event could not be found or any parameters were invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Code for important note above&amp;quot; class=&amp;quot;Important&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This code might not work as you expect: The handler added here won't be called until the next time the event is triggered. On the other hand, removing events works as expected.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;eventName&amp;quot;)&lt;br /&gt;
addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
    print(&amp;quot;Existing called&amp;quot;)&lt;br /&gt;
    addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
        print(&amp;quot;newly added called&amp;quot;)&lt;br /&gt;
    end)&lt;br /&gt;
end)&lt;br /&gt;
-- first time calling the event&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;&lt;br /&gt;
-- second time - now both handlers are called&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;, &amp;quot;newly added called&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&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;
This serverside example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define our handler function&lt;br /&gt;
function onPlayerSpawnHandler ( )&lt;br /&gt;
	-- get the player's name, source is the player because he was spawned&lt;br /&gt;
	local playerName = getPlayerName( source )&lt;br /&gt;
	-- output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot; has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawnHandler ) -- root is a predefined global variable for getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03795|Added priority argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;br /&gt;
[[ru:addEventHandler]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69717</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69717"/>
		<updated>2021-03-30T21:20:54Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}} &lt;br /&gt;
{{Important Note|Do '''NOT''' use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when the event it's attached to is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
{{Important Note|Adding handler functions to the same event and element as the handler function isn't supported. (The handler won't be called until the next time the event is triggered). See code piece below.}}&lt;br /&gt;
&lt;br /&gt;
Event handlers are functions that are called when a particular event happens. Each event specifies a specific set of variables that are passed to the event handler and can be read by your function. The following global variables are available for use in handler functions:&lt;br /&gt;
*'''source''': the element that triggered the event&lt;br /&gt;
*'''this''': the element that the event handler is attached to&lt;br /&gt;
*'''sourceResource''': the resource that triggered the event&lt;br /&gt;
*'''sourceResourceRoot''': the root element of the resource that triggered the event&lt;br /&gt;
*'''client''': the client that triggered the event using [[triggerServerEvent]]. Not set if the event was not triggered from a client.&lt;br /&gt;
{{New_feature|3|1.0|&lt;br /&gt;
*'''eventName''': the name of the event which triggered the handler function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is important to remember that events pass up and down the [[element tree]]. An event triggered on the root element is triggered on every element in the tree. An event triggered on any other element is triggered on its ancestors (its parent element and its parent's parent etc) and its children, grandchildren and great-grandchildren. You can use the ''getPropagated'' argument to specify if you wish your handler to receive events that have propagated up or down the tree.&lt;br /&gt;
&lt;br /&gt;
The order in which event handlers are triggered is undefined, you should not rely on one event handler being executed before another.&lt;br /&gt;
{{Note|See [[Script security]] for tips on preventing cheaters when using events and element data}}&lt;br /&gt;
{{Note|See [[Event_Source_Element|Event Source Element]] for a descriptive visualization of the event system handling an event trigger.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool propagate = true, string priority = &amp;quot;normal&amp;quot; ] )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to. '''Note: The maximum allowed length is 100 ASCII characters (that is, English letters and numerals)```&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''handlerFunction:''' The handler function you wish to call when the event is triggered. This function will be passed all of the event's parameters as arguments, but it isn't required that it takes all of them.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''propagate:''' A boolean representing whether the handler will be triggered if the event was propagated down or up the [[element tree]] (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to ''false'' will only be triggered if ''source == this''). In GUI events you will probably want to set this to ''false''.&lt;br /&gt;
{{New_feature|3.0131|1.3.1|&lt;br /&gt;
*'''priority :''' A string representing the trigger order priority relative to other event handlers of the same name. Possible values are:&lt;br /&gt;
**'''&amp;quot;high&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;normal&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;low&amp;quot;'''&lt;br /&gt;
''It is also possible to add finer priority control by appending a positive or negative number to the priority string. For example (in priority order for reference): &amp;quot;high+4&amp;quot; &amp;quot;high&amp;quot; &amp;quot;high-1&amp;quot; &amp;quot;normal-6&amp;quot; &amp;quot;normal-7&amp;quot; &amp;quot;low+1&amp;quot; &amp;quot;low&amp;quot; &amp;quot;low-1&amp;quot;''&lt;br /&gt;
{{Important Note|Anything bound to a specific element will be run before other handlers that are bound to something higher in the element tree (like root) This means that &amp;quot;high+10&amp;quot; bound to root '''won't''' trigger before &amp;quot;normal&amp;quot; bound directly to an element.}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the specified event could not be found or any parameters were invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Code for important note above&amp;quot; class=&amp;quot;Important&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This code might not work as you expect: The handler added here won't be called until the next time the event is triggered. On the other hand, removing events works as expected.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;eventName&amp;quot;)&lt;br /&gt;
addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
    print(&amp;quot;Existing called&amp;quot;)&lt;br /&gt;
    addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
        print(&amp;quot;newly added called&amp;quot;)&lt;br /&gt;
    end)&lt;br /&gt;
end)&lt;br /&gt;
-- first time calling the event&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;&lt;br /&gt;
-- second time - now both handlers are called&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;, &amp;quot;newly added called&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&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;
This serverside example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define our handler function&lt;br /&gt;
function onPlayerSpawnHandler ( )&lt;br /&gt;
	-- get the player's name, source is the player because he was spawned&lt;br /&gt;
	local playerName = getPlayerName( source )&lt;br /&gt;
	-- output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot; has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawnHandler ) -- root is a predefined global variable for getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03795|Added priority argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;br /&gt;
[[ru:addEventHandler]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69716</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=69716"/>
		<updated>2021-03-30T21:20:02Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add important note regarding event triggering behaviour&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}} &lt;br /&gt;
{{Important Note|Do '''NOT''' use the same name for your handler function as the event name, as this can lead to confusion if multiple handler functions are used}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when the event it's attached to is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
{{Important Note|Adding handler functions to the same event and element as the handler function isn't supported. (The handler won't be called until the next time the event is triggered). See code piece below.}}&lt;br /&gt;
&lt;br /&gt;
Event handlers are functions that are called when a particular event happens. Each event specifies a specific set of variables that are passed to the event handler and can be read by your function. The following global variables are available for use in handler functions:&lt;br /&gt;
*'''source''': the element that triggered the event&lt;br /&gt;
*'''this''': the element that the event handler is attached to&lt;br /&gt;
*'''sourceResource''': the resource that triggered the event&lt;br /&gt;
*'''sourceResourceRoot''': the root element of the resource that triggered the event&lt;br /&gt;
*'''client''': the client that triggered the event using [[triggerServerEvent]]. Not set if the event was not triggered from a client.&lt;br /&gt;
{{New_feature|3|1.0|&lt;br /&gt;
*'''eventName''': the name of the event which triggered the handler function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is important to remember that events pass up and down the [[element tree]]. An event triggered on the root element is triggered on every element in the tree. An event triggered on any other element is triggered on its ancestors (its parent element and its parent's parent etc) and its children, grandchildren and great-grandchildren. You can use the ''getPropagated'' argument to specify if you wish your handler to receive events that have propagated up or down the tree.&lt;br /&gt;
&lt;br /&gt;
The order in which event handlers are triggered is undefined, you should not rely on one event handler being executed before another.&lt;br /&gt;
{{Note|See [[Script security]] for tips on preventing cheaters when using events and element data}}&lt;br /&gt;
{{Note|See [[Event_Source_Element|Event Source Element]] for a descriptive visualization of the event system handling an event trigger.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool propagate = true, string priority = &amp;quot;normal&amp;quot; ] )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to. '''Note: The maximum allowed length is 100 ASCII characters (that is, English letters and numerals)```&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''handlerFunction:''' The handler function you wish to call when the event is triggered. This function will be passed all of the event's parameters as arguments, but it isn't required that it takes all of them.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''propagate:''' A boolean representing whether the handler will be triggered if the event was propagated down or up the [[element tree]] (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to ''false'' will only be triggered if ''source == this''). In GUI events you will probably want to set this to ''false''.&lt;br /&gt;
{{New_feature|3.0131|1.3.1|&lt;br /&gt;
*'''priority :''' A string representing the trigger order priority relative to other event handlers of the same name. Possible values are:&lt;br /&gt;
**'''&amp;quot;high&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;normal&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;low&amp;quot;'''&lt;br /&gt;
''It is also possible to add finer priority control by appending a positive or negative number to the priority string. For example (in priority order for reference): &amp;quot;high+4&amp;quot; &amp;quot;high&amp;quot; &amp;quot;high-1&amp;quot; &amp;quot;normal-6&amp;quot; &amp;quot;normal-7&amp;quot; &amp;quot;low+1&amp;quot; &amp;quot;low&amp;quot; &amp;quot;low-1&amp;quot;''&lt;br /&gt;
{{Important Note|Anything bound to a specific element will be run before other handlers that are bound to something higher in the element tree (like root) This means that &amp;quot;high+10&amp;quot; bound to root '''won't''' trigger before &amp;quot;normal&amp;quot; bound directly to an element.}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the specified event could not be found or any parameters were invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Code for important note above&amp;quot; class=&amp;quot;Important&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This code might not work as you expect: The handler added here won't be called until the next time the event is triggered.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEvent(&amp;quot;eventName&amp;quot;)&lt;br /&gt;
addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
    print(&amp;quot;Existing called&amp;quot;)&lt;br /&gt;
    addEventHandler(&amp;quot;eventName&amp;quot;, root, function()&lt;br /&gt;
        print(&amp;quot;newly added called&amp;quot;)&lt;br /&gt;
    end)&lt;br /&gt;
end)&lt;br /&gt;
-- first time calling the event&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;&lt;br /&gt;
-- second time - now both handlers are called&lt;br /&gt;
triggerEvent(&amp;quot;eventName&amp;quot;, root) -- prints &amp;quot;Existing called&amp;quot;, &amp;quot;newly added called&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&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;
This serverside example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define our handler function&lt;br /&gt;
function onPlayerSpawnHandler ( )&lt;br /&gt;
	-- get the player's name, source is the player because he was spawned&lt;br /&gt;
	local playerName = getPlayerName( source )&lt;br /&gt;
	-- output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot; has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawnHandler ) -- root is a predefined global variable for getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03795|Added priority argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;br /&gt;
[[ru:addEventHandler]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ToJSON&amp;diff=69692</id>
		<title>ToJSON</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ToJSON&amp;diff=69692"/>
		<updated>2021-03-24T15:58:57Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add important note: keys will be truncated to 255 characters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function converts a '''single''' value (preferably a Lua table) into a [[JSON]] encoded string. You can use this to store the data and then load it again using [[fromJSON]].&lt;br /&gt;
&lt;br /&gt;
{{Important Note|Due to tehnical limitations (partly of json-c) the stringified keys will be truncated to the first 255 characters}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string toJSON ( var value [, bool compact = false ][, string prettyType = &amp;quot;none&amp;quot; ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''var:''' An argument of any type. Arguments that are elements will be stored as element IDs that are liable to change between sessions. As such, do not save elements across sessions as you will get unpredictable results.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
*'''compact:''' a [[boolean]] representing whether the string will contain whitespaces. To remove whitespaces from JSON string, use ''true''. String will contain whitespaces per default.&lt;br /&gt;
}}&lt;br /&gt;
{{New feature/item|3.0154|1.5.3|8046|&lt;br /&gt;
*'''prettyType:''' a type [[string]] from below:&lt;br /&gt;
** none&lt;br /&gt;
** spaces&lt;br /&gt;
** tabs&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a JSON formatted string.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example shows how you can encode an array. The string json should equal ''&amp;quot;[ { &amp;quot;1&amp;quot;: &amp;quot;dogs&amp;quot;, &amp;quot;mouse&amp;quot;: &amp;quot;food&amp;quot;, &amp;quot;cat&amp;quot;: &amp;quot;hungry&amp;quot;, &amp;quot;birds&amp;quot;: 4 } ]&amp;quot; after executed.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local json = toJSON ( { &amp;quot;dogs&amp;quot;, cat = &amp;quot;hungry&amp;quot;, mouse = &amp;quot;food&amp;quot;, birds = 4 } )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.0|1.1.1-9.03316|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Server_functions}}&lt;br /&gt;
&lt;br /&gt;
[[ru:toJSON]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddVehicleUpgrade&amp;diff=69665</id>
		<title>AddVehicleUpgrade</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddVehicleUpgrade&amp;diff=69665"/>
		<updated>2021-03-19T21:24:46Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add documentation for &amp;quot;all&amp;quot; upgrade&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function adds an upgrade to a [[vehicle]], e.g. nitrous, hydraulics.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool addVehicleUpgrade ( vehicle theVehicle, string/int upgrade )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[vehicle]]:addUpgrade}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theVehicle''': The [[element]] representing the [[vehicle]] you wish to add the upgrade to.&lt;br /&gt;
*'''upgrade''': The id of the upgrade you wish to add: 1000 to 1193 (''see [[Vehicle Upgrades]]'') or &amp;quot;'''all&amp;quot;''' to add all upgrades.&lt;br /&gt;
'''Note:''' setCameraTarget will behave strangely if you use hydraulics (upgrade id: 1087) server sided and when your camera target is the player inside the vehicle with hydraulics and if the player is not you.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if the upgrade was successfully added to the vehicle, otherwise ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This serverside function allows the user to get an upgrade by typing a command:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define the handler function for our command&lt;br /&gt;
function consoleAddUpgrade ( thePlayer, commandName, id )&lt;br /&gt;
        -- make sure the player is in a vehicle&lt;br /&gt;
        if ( isPedInVehicle ( thePlayer ) ) then&lt;br /&gt;
            -- convert the given ID from a string to a number&lt;br /&gt;
            local id = tonumber ( id )&lt;br /&gt;
            -- get the player's vehicle&lt;br /&gt;
            local theVehicle = getPedOccupiedVehicle ( thePlayer )&lt;br /&gt;
            -- add the requested upgrade to the vehicle&lt;br /&gt;
            local success = addVehicleUpgrade ( theVehicle, id )&lt;br /&gt;
            -- inform the player of whether the upgrade was added successfully&lt;br /&gt;
            if ( success ) then&lt;br /&gt;
                outputConsole ( getVehicleUpgradeSlotName ( id ) .. &amp;quot; upgrade added.&amp;quot;, thePlayer )&lt;br /&gt;
            else&lt;br /&gt;
                outputConsole ( &amp;quot;Failed to add upgrade.&amp;quot;, thePlayer )&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            outputConsole ( &amp;quot;You must be in a vehicle!&amp;quot;, thePlayer )&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
-- add the function as a handler for the &amp;quot;addupgrade&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;addupgrade&amp;quot;, consoleAddUpgrade )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This client-side script gives vehicles a nitro upgrade whenever they pass through a certain collision shape:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create a collision shape&lt;br /&gt;
local nitroColShape = createColSphere ( 1337, 100, 12, 2 )&lt;br /&gt;
&lt;br /&gt;
-- attach the collision shape to an 'onClientColShapeHit' event&lt;br /&gt;
function onNitroColShapeHit ( hitElement, matchingDimension )&lt;br /&gt;
    if ( getElementType ( hitElement ) == &amp;quot;vehicle&amp;quot; ) then&lt;br /&gt;
        -- add a nitro upgrade if the element that hit the colshape is a vehicle&lt;br /&gt;
        addVehicleUpgrade ( hitElement, 1010 )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientColShapeHit&amp;quot;, nitroColShape, onNitroColShapeHit )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementData&amp;diff=69604</id>
		<title>SetElementData</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementData&amp;diff=69604"/>
		<updated>2021-03-07T23:06:30Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Key length is actually maximum 128, not 31 characters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This function stores [[element data]] under a certain key, attached to an element. Element data set using this is then synced with all clients and the server. The data can contain server created elements, but you should avoid passing data that is not able to be synced such as xmlnodes, acls, aclgroups etc.&lt;br /&gt;
&lt;br /&gt;
As element data is synced to all clients, it can generate a lot of network traffic and be heavy on performance. Events are much more efficient for sending data from a client to the server only, or from the server to a specific client. &amp;lt;br/&amp;gt;&lt;br /&gt;
Usage of element data should be disencouraged where your goal can be achieved with events like above, and [[table|tables]] for storing and retrieving data.&lt;br /&gt;
&lt;br /&gt;
{{Tip|A simple and efficient way to make a variable known to the server and clients is to use setElementData on the [[root]] element.}}&lt;br /&gt;
{{Note|See [[Script security]] for tips on preventing cheaters when using events and element data}}&lt;br /&gt;
{{Note|For performance reasons, never use setElementData in events that fire often (like [[onClientRender]]) without further optimization or conditions. In fact, using element data in general can take such a toll on performance that not using it unless strictly neccesary (e.g use alternatives such as storing data in tables) is recommended.}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|5.0157|1.5.7-9.20477|A subscription mode has been introduced for [[setElementData]] serverside. When setting data in subscription mode, only clients that are added through [[addElementDataSubscriber]] will receive the data, which is good for performance.&lt;br /&gt;
Note this mode only works when setting element data serverside. Setting data clientside still sends the update to all clients if 'synchronize' is set to true.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setData||getElementData}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The [[element]] you wish to attach the data to.&lt;br /&gt;
*'''key:''' The key you wish to store the data under. (Maximum 128 characters.) &lt;br /&gt;
*'''value:''' The value you wish to store. See [[element data]] for a list of acceptable datatypes.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''synchronize:''' Determines whether or not the data will be synchronized with the clients(server-side variation) or server(client-side variation)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the data was set succesfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
{{New items|5.0157|1.5.7-9.20477|&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;
bool setElementData ( element theElement, string key, var value [, var syncMode=&amp;quot;broadcast&amp;quot;] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setData||getElementData}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The [[element]] you wish to attach the data to.&lt;br /&gt;
*'''key:''' The key you wish to store the data under. (Maximum 31 characters.) &lt;br /&gt;
*'''value:''' The value you wish to store. See [[element data]] for a list of acceptable datatypes.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''syncMode:''' Synchronisation mode.&lt;br /&gt;
**''&amp;quot;broadcast&amp;quot;'' - Synchronise to all clients (default behavior). You can also parse ''true'' for this option.&lt;br /&gt;
**''&amp;quot;local&amp;quot;'' - Don't synchronise. You can also parse ''false'' for this option.&lt;br /&gt;
**''&amp;quot;subscribe&amp;quot;'' - Only synchronise to specific clients. See [[addElementDataSubscriber]] and [[removeElementDataSubscriber]].&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;
bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setData||getElementData}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The [[element]] you wish to attach the data to.&lt;br /&gt;
*'''key:''' The key you wish to store the data under. (Maximum 31 characters.) &lt;br /&gt;
*'''value:''' The value you wish to store. See [[element data]] for a list of acceptable datatypes.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''synchronize:''' Determines whether or not the data will be synchronized with the server.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the data was set succesfully, ''false'' otherwise.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Issues===&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{Issue|7389|[Fixed in 1.3.5-7389] Problem with floating numbers}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Example== &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;
This example allows a player to add a custom tag onto their nickname, and also reverts it back to normal if they wish.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function addPlayerCustomTag ( thePlayer, command, newTag )&lt;br /&gt;
	--Let's make sure the newTag param has been entered...&lt;br /&gt;
	if ( newTag ) then&lt;br /&gt;
		--Grab their current playername for saving.&lt;br /&gt;
		local sPlayerNickname = getPlayerName ( thePlayer )&lt;br /&gt;
		--Create their new nickname with their tag&lt;br /&gt;
		local sNewPlayerNickname = newTag .. &amp;quot; &amp;quot; .. sPlayerNickname&lt;br /&gt;
		&lt;br /&gt;
		--Let's first load the element data, see if it's there already&lt;br /&gt;
		--The reason for this is that if a player were to do /addtag twice,&lt;br /&gt;
		--the tag would be prepended a second time&lt;br /&gt;
		local sOldNick = getElementData( thePlayer, &amp;quot;tempdata.originalnick&amp;quot; )&lt;br /&gt;
		if ( sOldNick == false ) then&lt;br /&gt;
			--Save their orignal nickname in their element data&lt;br /&gt;
			setElementData ( thePlayer, &amp;quot;tempdata.originalnick&amp;quot;, sPlayerNickname )&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		--Set their new nickname globally&lt;br /&gt;
		setPlayerName ( thePlayer, sNewPlayerNickname )&lt;br /&gt;
		&lt;br /&gt;
		--Tell them it's done&lt;br /&gt;
		outputChatBox ( &amp;quot;Your new nickname has been set, to put it back to its original state you can use /deltag&amp;quot;, thePlayer )&lt;br /&gt;
	else&lt;br /&gt;
		--The newTag param was not entered, give an error message&lt;br /&gt;
		outputChatBox ( &amp;quot;/addtag - Incorrect syntax, Correct: /addtag &amp;lt;newtag&amp;gt;&amp;quot;, thePlayer )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;addtag&amp;quot;, addPlayerCustomTag )&lt;br /&gt;
&lt;br /&gt;
function removePlayerCustomTag ( thePlayer, command )&lt;br /&gt;
	--We first need to check that they have already used /addtag, let's do that now&lt;br /&gt;
	local sOldNick = getElementData( thePlayer, &amp;quot;tempdata.originalnick&amp;quot; )&lt;br /&gt;
	if ( sOldNick ) then&lt;br /&gt;
		--Great, they have a tag added, let's reset them&lt;br /&gt;
		&lt;br /&gt;
		--First we will want to reset the element data back to its default (that being false)&lt;br /&gt;
		setElementData ( thePlayer, &amp;quot;tempdata.originalnick&amp;quot;, false )&lt;br /&gt;
		&lt;br /&gt;
		--Now set the client name back&lt;br /&gt;
		setPlayerName( thePlayer, sOldNick )&lt;br /&gt;
		&lt;br /&gt;
		--Notify them&lt;br /&gt;
		outputChatBox ( &amp;quot;Your old nickname has been set&amp;quot;, thePlayer )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;deltag&amp;quot;, removePlayerCustomTag )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
[[tr:setElementData]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[pt-br:SetElementData]]&lt;br /&gt;
{{Element_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetTickCount&amp;diff=68680</id>
		<title>GetTickCount</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetTickCount&amp;diff=68680"/>
		<updated>2021-02-04T14:04:13Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns amount of time that your system has been running in milliseconds. By comparing two values of [[getTickCount]], you can determine how much time has passed (in milliseconds) between two events. This could be used to determine how efficient your code is, or to time how long a player takes to complete a task.&lt;br /&gt;
&lt;br /&gt;
{{Server client function}}{{Important Note|The value returned by this function client-side may not be reliable if a client is maliciously modifying their operating system speed.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int getTickCount ()&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an integer containing the number of milliseconds since the system the server is running on started. This has the potential to wrap-around.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The below code is a good example on how to implement basic anti-spam protection for a command, for which using getTickCount is better than the regular timer functions.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local spam = {}&lt;br /&gt;
&lt;br /&gt;
function setSkin(player, cmd, skin)&lt;br /&gt;
    if spam[player] and getTickCount() - spam[player] &amp;lt; 4000 then&lt;br /&gt;
        return outputChatBox(&amp;quot;You cannot change skin that often!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    skin = skin and tonumber(skin)&lt;br /&gt;
&lt;br /&gt;
    if getElementModel(player) == skin or isPedDead(player) then&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if skin and skin &amp;lt;= 99999 then -- what do we know about dynamic ped ID range?&lt;br /&gt;
        setElementModel(player, skin)&lt;br /&gt;
        spam[player] = getTickCount()&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Invalid skin ID!&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;skin&amp;quot;, setSkin)&lt;br /&gt;
&lt;br /&gt;
function cleanUp()&lt;br /&gt;
    if spam[source] then&lt;br /&gt;
        spam[source] = nil&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerQuit&amp;quot;, root, cleanUp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example will start a timer displayed at the top of the screen displayed every frame. You can log any specific moment in time by outputting the currentCount variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;screenX,screenY = guiGetScreenSize()&lt;br /&gt;
function startTheClock ()&lt;br /&gt;
	&lt;br /&gt;
	if not systemUpTime then&lt;br /&gt;
            systemUpTime = getTickCount() --Store the system tick count, this will be 0 for us&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	currentCount = getTickCount()&lt;br /&gt;
	&lt;br /&gt;
	dxDrawRectangle (screenX *.40, screenY * .09, 250, 50, tocolor(0,0,0,150))&lt;br /&gt;
	dxDrawText (currentCount - systemUpTime, screenX * .48, screenY * .1, screenX, screenY, tocolor(255,255,255), 2)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler (&amp;quot;onClientRender&amp;quot;, root, startTheClock)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Utility functions}}&lt;br /&gt;
[[ru:GetTickCount]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxSetShaderValue&amp;diff=68679</id>
		<title>DxSetShaderValue</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxSetShaderValue&amp;diff=68679"/>
		<updated>2021-02-04T14:00:10Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This sets a named parameter for a [[shader]] element&lt;br /&gt;
&lt;br /&gt;
{{Important Note|It's enough to set the texture only once if it's a render target}}&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 dxSetShaderValue ( element theShader, string parameterName, mixed value )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[shader]]:setValue}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theShader:''' The shader element whose parameter is to be changed&lt;br /&gt;
*'''parameterName:''' The name of parameter&lt;br /&gt;
*'''value:''' The value to set, which can be a [[texture]], a bool, a number or a list of numbers('''max 16 floats(numbers)''')&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the shader element's parameter 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;
myShader = dxCreateShader( &amp;quot;hello.fx&amp;quot; )&lt;br /&gt;
myTexture = dxCreateTexture( &amp;quot;man.png&amp;quot; )&lt;br /&gt;
dxSetShaderValue( myShader, &amp;quot;texture0&amp;quot;, myTexture )                -- Set a texture&lt;br /&gt;
dxSetShaderValue( myShader, &amp;quot;bShowThing&amp;quot;, true )                  -- Set a bool                  &lt;br /&gt;
dxSetShaderValue( myShader, &amp;quot;speed&amp;quot;, 2.4 )                        -- Set a float&lt;br /&gt;
dxSetShaderValue( myShader, &amp;quot;positionOfCheese&amp;quot;, 100, 200, 300 )   -- Set a list of numbers, with max 16 numbers. Btw, this is a float: 3.4. This can be used to fill an array in HLSL.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxSetShaderValue]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementsWithinRange&amp;diff=68117</id>
		<title>GetElementsWithinRange</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementsWithinRange&amp;diff=68117"/>
		<updated>2020-12-29T01:15:04Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Correct circle to sphere&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0156|1.5.5|13823|This function is used to retrieve a list of all elements of specified type within a range of 3D coordinates.}}&lt;br /&gt;
{{Note|&lt;br /&gt;
* This function doesn't verify whether elements are in the same dimension and interior, additional checks could be implemented manually if they are needed.&lt;br /&gt;
* This function checks if elements are in a box, not in a sphere.&lt;br /&gt;
* Z argument isn't in use currently, but make your scripts like it is for future compatibility reasons.&lt;br /&gt;
* This function doesn't work with elements which is created by createElement.}}&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 getElementsWithinRange ( float x, float y, float z, float range [, string elemType = &amp;quot;&amp;quot; ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP| |[[Element]].getWithinRange}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''x:''' the x coordinate at which to retrieve elements&lt;br /&gt;
*'''y:''' the y coordinate at which to retrieve elements&lt;br /&gt;
*'''z:''' the z coordinate at which to retrieve elements&lt;br /&gt;
*'''range:''' the range at the coordinates in which to retrieve elements&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''elemType:''' The type of element you want a list of. This can be any element type, such as:&lt;br /&gt;
**'''&amp;quot;player&amp;quot;:''' A player connected to the server&lt;br /&gt;
**'''&amp;quot;ped&amp;quot;:''' A ped&lt;br /&gt;
**'''&amp;quot;vehicle&amp;quot;:''' A vehicle&lt;br /&gt;
**'''&amp;quot;object&amp;quot;:''' An object&lt;br /&gt;
**'''&amp;quot;pickup&amp;quot;:''' A pickup&lt;br /&gt;
**'''&amp;quot;marker&amp;quot;:''' A marker&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[table]] containing all the elements of the specified type within range. Returns an empty [[table]] if there are no elements within range. Returns ''false'' if the arguments are invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example allows admins to destroy all vehicles in close proximity.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function deleteNearbyVehicles(p)&lt;br /&gt;
	local acc = getPlayerAccount(p)&lt;br /&gt;
	if not isGuestAccount(acc) and isObjectInACLGroup(&amp;quot;user.&amp;quot;..getAccountName(acc), aclGetGroup(&amp;quot;Admin&amp;quot;)) then&lt;br /&gt;
		local x, y, z = getElementPosition(p)&lt;br /&gt;
		local nearbyVehicles = getElementsWithinRange(x, y, z, 300, &amp;quot;vehicle&amp;quot;)&lt;br /&gt;
		for i,v in ipairs(nearbyVehicles) do&lt;br /&gt;
			if v and isElement(v) then&lt;br /&gt;
				destroyElement(v)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler (&amp;quot;delnearvehs&amp;quot;, deleteNearbyVehicles)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example retrieves a table of players within range of the 3D coordinates and prints their name to the chat.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local players = getElementsWithinRange( 0, 0, 3, 20, &amp;quot;player&amp;quot; )    -- get all player elements within 20 units of 0, 0, 3&lt;br /&gt;
for _, player in pairs( players ) do                               -- use a generic for loop to step through each player&lt;br /&gt;
    outputChatBox( getPlayerName( player ) .. &amp;quot; is within range&amp;quot; ) -- print their name to the chat&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateVehicle&amp;diff=67892</id>
		<title>CreateVehicle</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateVehicle&amp;diff=67892"/>
		<updated>2020-12-04T08:17:07Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Fix previous edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}{{Note|Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only.}}&lt;br /&gt;
{{Note|Due to how GTA works, creating a lot of vehicles in the same place will cause lag. The more geometries and unique textures has model the bigger the lag is. Even a lot of default vehicles will cause lag if in the same place.}}&lt;br /&gt;
This function creates a vehicle at the specified location.&lt;br /&gt;
&lt;br /&gt;
Its worth nothing that the position of the vehicle is the center point of the vehicle, not its base. As such, you need to ensure that the z value (vertical axis) is some height above the ground. You can find the exact height using the client side function [[getElementDistanceFromCentreOfMassToBaseOfModel]], or you can estimate it yourself and just spawn the vehicle so it drops to the ground.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
vehicle createVehicle ( int model, float x, float y, float z [, float rx, float ry, float rz, string numberplate, bool bDirection, int variant1, int variant2 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Vehicle]]||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''model''': The [[Vehicle IDs|vehicle ID]] of the vehicle being created.&lt;br /&gt;
* '''x''': A floating point number representing the X coordinate on the map.&lt;br /&gt;
* '''y''': A floating point number representing the Y coordinate on the map.&lt;br /&gt;
* '''z''': A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''rx''': A floating point number representing the rotation about the X axis in degrees.&lt;br /&gt;
* '''ry''': A floating point number representing the rotation about the Y axis in degrees.&lt;br /&gt;
* '''rz''': A floating point number representing the rotation about the Z axis in degrees.&lt;br /&gt;
* '''numberplate''': A string that will go on the number plate of the vehicle (max 8 characters).&lt;br /&gt;
* '''bDirection''' ''(serverside only)'': Placeholder [[boolean]] which provides backward compatibility with some scripts. It never had any effect, but it is read by the code. It is recommended to ignore this argument, passing ''false'' or the ''variant1'' argument in its place.&lt;br /&gt;
{{New feature/item|3.0120|1.2|| &lt;br /&gt;
* '''variant1''': An integer for the first vehicle variant. See [[vehicle variants]].&lt;br /&gt;
* '''variant2''': An integer for the second vehicle variant. See [[vehicle variants]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the [[vehicle]] element that was created. Returns ''false'' if the arguments are incorrect, or if the vehicle limit of 65535 is exceeded.&lt;br /&gt;
&lt;br /&gt;
==Using trains==&lt;br /&gt;
Trains are created using the createVehicle function. They are placed at the nearest point of the GTASA train pathing (they usually are railroad tracks) from their spawning point.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a 'vehicle spawner' marker that gives the player a vehicle as soon they step into it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local vehMark = createMarker(-2426.34106, -639.12714, 132.93631,&amp;quot;cylinder&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
function vehicleSpawner(hitElement,matchingDimension)&lt;br /&gt;
	if getElementType(hitElement) == &amp;quot;player&amp;quot; then&lt;br /&gt;
		if getPedOccupiedVehicle(hitElement) == false then&lt;br /&gt;
		local x,y,z = getElementPosition(hitElement)&lt;br /&gt;
			local veh = createVehicle(551, x,y,z)&lt;br /&gt;
			warpPedIntoVehicle(hitElement,veh)&lt;br /&gt;
		end&lt;br /&gt;
	end &lt;br /&gt;
end &lt;br /&gt;
addEventHandler(&amp;quot;onMarkerHit&amp;quot;,vehMark,vehicleSpawner)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a vehicle five units to the right of a player when they type ''createvehicle'' and its name in the console:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local distance = 5 --units&lt;br /&gt;
&lt;br /&gt;
-- define our handler (we'll take a variable number of parameters where the name goes, because there are vehicle names with more than one word)&lt;br /&gt;
function consoleCreateVehicle ( sourcePlayer, commandName, ... )&lt;br /&gt;
   -- if a player triggered it, not the admin,&lt;br /&gt;
   if ( sourcePlayer ) then&lt;br /&gt;
      -- calculate the position of the vehicle based on the player's position and rotation:&lt;br /&gt;
      local x, y, z = getElementPosition ( sourcePlayer ) -- get the player's position&lt;br /&gt;
      local rotZ = getElementRotation ( sourcePlayer ) -- get the player's rotation around the Z axis in degrees&lt;br /&gt;
      x = x + ( ( math.cos ( math.rad ( rotZ ) ) ) * distance ) -- calculate the X position of the vehicle&lt;br /&gt;
      y = y + ( ( math.sin ( math.rad ( rotZ ) ) ) * distance ) -- calculate the Y position of the vehicle&lt;br /&gt;
&lt;br /&gt;
      -- get the complete vehicle name by joining all passed parameters using Lua function table.concat&lt;br /&gt;
      local vehicleName = table.concat({...}, &amp;quot; &amp;quot;)&lt;br /&gt;
      -- get the vehicle's model ID from the name&lt;br /&gt;
      local vehicleID = getVehicleModelFromName ( vehicleName )&lt;br /&gt;
      -- if vehicle ID is valid,&lt;br /&gt;
      if vehicleID then&lt;br /&gt;
            -- create the vehicle using the information gathered above:&lt;br /&gt;
            local newVehicle = createVehicle ( vehicleID, x, y, z, 0, 0, rotZ )&lt;br /&gt;
            -- if vehicle creation failed, give the player a message&lt;br /&gt;
            if not newVehicle then&lt;br /&gt;
               outputConsole ( &amp;quot;Failed to create vehicle.&amp;quot;, sourcePlayer )&lt;br /&gt;
            end&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Attach the 'consoleCreateVehicle' function to the &amp;quot;createvehicle&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;createvehicle&amp;quot;, consoleCreateVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 3: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This script spawns a Rhino on top of one lucky individual.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scriptCreateTank ( player, command )&lt;br /&gt;
      local luckyBugger = getRandomPlayer() -- get a random player&lt;br /&gt;
      local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position&lt;br /&gt;
      createVehicle ( 432, x, y, z + 10 ) -- create the tank 10 units above them&lt;br /&gt;
      outputChatBox ( &amp;quot;You got Tank'd!&amp;quot;, luckyBugger )&lt;br /&gt;
end&lt;br /&gt;
--Attach the 'scriptCreateTank' function to the &amp;quot;tank&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;tank&amp;quot;, scriptCreateTank )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 4: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a ''/spveh'' command to spawn a car model in the provided coordinates. If any car created by this command gets blown up, it will respawn where it was created.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Do not allow the following IDs to be spawned&lt;br /&gt;
local forbiddenCars = { [435] = true, [441] = true, [449] = true, [450] = true, [464] = true, [465] = true, [501] = true,&lt;br /&gt;
                        [537] = true, [538] = true, [564] = true, [569] = true, [570] = true, [584] = true, [590] = true,&lt;br /&gt;
                        [591] = true, [594] = true, [606] = true, [607] = true, [608] = true, [610] = true, [611] = true }&lt;br /&gt;
&lt;br /&gt;
local cmdVehRoot = createElement(&amp;quot;commandVehicles&amp;quot;) -- Dummy element containing the cars that this command has created&lt;br /&gt;
addCommandHandler(&amp;quot;spveh&amp;quot;,&lt;br /&gt;
    function(player, cmd, modelID, x, y, z, platetext)&lt;br /&gt;
        -- Check whether arguments are correct&lt;br /&gt;
        local modelID, x, y, z = tonumber(modelID), tonumber(x), tonumber(y), tonumber(z)&lt;br /&gt;
        if modelID and x and y and z then&lt;br /&gt;
            -- Do not continue if we shouldn't&lt;br /&gt;
            if forbiddenCars[modelID] then&lt;br /&gt;
                outputChatBox(&amp;quot;The car model you provided is not allowed.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
                return&lt;br /&gt;
            end&lt;br /&gt;
            local platetext = type(platetext) == &amp;quot;string&amp;quot; and platetext or &amp;quot;PRIVATE&amp;quot;&lt;br /&gt;
            -- Create the actual vehicle and set it as a children of our dummy element&lt;br /&gt;
            setElementParent(createVehicle(modelID, x, y, z, 0, 0, 0, platetext), cmdVehRoot)&lt;br /&gt;
            -- Inform the player about what we did&lt;br /&gt;
            outputChatBox(&amp;quot;You have created a &amp;quot; .. getVehicleNameFromModel(modelID) .. &amp;quot; (model ID: &amp;quot; .. modelID .. &amp;quot;) at &amp;quot; .. table.concat({ x, y, z }, &amp;quot;, &amp;quot;) .. &amp;quot; with numberplate &amp;quot; .. platetext .. &amp;quot; successfully.&amp;quot;, player, 0, 255, 0)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Syntax: /&amp;quot; .. cmd .. &amp;quot; (modelID) (x) (y) (z) [numberplate]&amp;quot;, player, 255, 255, 255)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
-- If a vehicle that has been created using the command blows up, respawn it where it was created&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;, cmdVehRoot,&lt;br /&gt;
    function()&lt;br /&gt;
        respawnVehicle(source)&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;
&amp;lt;section name=&amp;quot;Example 5: Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This script spawns a Rhino on top of the local player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scriptCreateTank ( commandName )&lt;br /&gt;
      local x, y, z = getElementPosition ( localPlayer ) -- retrive the player's position&lt;br /&gt;
      createVehicle ( 432, x, y, z + 10 ) -- create the tank 10 units above them&lt;br /&gt;
      outputChatBox ( &amp;quot;You got Tank'd!&amp;quot;, 255, 0, 0)&lt;br /&gt;
end&lt;br /&gt;
--Attach the 'scriptCreateTank' function to the &amp;quot;tank&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;tank&amp;quot;, scriptCreateTank )&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;
{{New items|3.0132|1.4|&lt;br /&gt;
This is an example of how this function is executed in an OOP environment.&lt;br /&gt;
&amp;lt;section name=&amp;quot;OOP server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This script will create an Infernus at the center (0, 0, 3) of San Andreas upon execution.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;, resourceRoot,&lt;br /&gt;
    function()&lt;br /&gt;
        infernus = Vehicle(411, Vector3(0, 0, 3)); -- Create an Infernus and spawn it at the middle of SA.&lt;br /&gt;
        infernus:setColor(0, 0, 0); -- Set its color to black.&lt;br /&gt;
        infernus.damageProof = true; -- Make it damage proof&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
	&lt;br /&gt;
addCommandHandler( &amp;quot;blowinfernus&amp;quot;,&lt;br /&gt;
    function(p)&lt;br /&gt;
        if not infernus.blown then -- Check if the Infernus is blown up or not.&lt;br /&gt;
            infernus:blow();&lt;br /&gt;
        else -- Ouch, it's blown up, let's output an error to the player.&lt;br /&gt;
            outputChatBox( &amp;quot;The Infernus has already been blown up by you.&amp;quot;, p, 255, 0, 0, false );&lt;br /&gt;
        end&lt;br /&gt;
    end)&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;
==See Also==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Vehicle functions}}&lt;br /&gt;
[[de:createVehicle]]&lt;br /&gt;
[[pl:createVehicle]]&lt;br /&gt;
[[ru:CreateVehicle]]&lt;br /&gt;
[[pt-br:CreateVehicle]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateVehicle&amp;diff=67891</id>
		<title>CreateVehicle</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateVehicle&amp;diff=67891"/>
		<updated>2020-12-04T08:16:38Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Added a note regarding lag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}{{Note|Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only.}}&lt;br /&gt;
{{Note|Due to how GTA works, creating a lot of vehicles in the same place will cause lag. The more geometries and unique textures has model the bigger the lag is. Even a lot of default vehicles will cause lag if in the same place.}&lt;br /&gt;
This function creates a vehicle at the specified location.&lt;br /&gt;
&lt;br /&gt;
Its worth nothing that the position of the vehicle is the center point of the vehicle, not its base. As such, you need to ensure that the z value (vertical axis) is some height above the ground. You can find the exact height using the client side function [[getElementDistanceFromCentreOfMassToBaseOfModel]], or you can estimate it yourself and just spawn the vehicle so it drops to the ground.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
vehicle createVehicle ( int model, float x, float y, float z [, float rx, float ry, float rz, string numberplate, bool bDirection, int variant1, int variant2 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Vehicle]]||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''model''': The [[Vehicle IDs|vehicle ID]] of the vehicle being created.&lt;br /&gt;
* '''x''': A floating point number representing the X coordinate on the map.&lt;br /&gt;
* '''y''': A floating point number representing the Y coordinate on the map.&lt;br /&gt;
* '''z''': A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''rx''': A floating point number representing the rotation about the X axis in degrees.&lt;br /&gt;
* '''ry''': A floating point number representing the rotation about the Y axis in degrees.&lt;br /&gt;
* '''rz''': A floating point number representing the rotation about the Z axis in degrees.&lt;br /&gt;
* '''numberplate''': A string that will go on the number plate of the vehicle (max 8 characters).&lt;br /&gt;
* '''bDirection''' ''(serverside only)'': Placeholder [[boolean]] which provides backward compatibility with some scripts. It never had any effect, but it is read by the code. It is recommended to ignore this argument, passing ''false'' or the ''variant1'' argument in its place.&lt;br /&gt;
{{New feature/item|3.0120|1.2|| &lt;br /&gt;
* '''variant1''': An integer for the first vehicle variant. See [[vehicle variants]].&lt;br /&gt;
* '''variant2''': An integer for the second vehicle variant. See [[vehicle variants]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the [[vehicle]] element that was created. Returns ''false'' if the arguments are incorrect, or if the vehicle limit of 65535 is exceeded.&lt;br /&gt;
&lt;br /&gt;
==Using trains==&lt;br /&gt;
Trains are created using the createVehicle function. They are placed at the nearest point of the GTASA train pathing (they usually are railroad tracks) from their spawning point.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a 'vehicle spawner' marker that gives the player a vehicle as soon they step into it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local vehMark = createMarker(-2426.34106, -639.12714, 132.93631,&amp;quot;cylinder&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
function vehicleSpawner(hitElement,matchingDimension)&lt;br /&gt;
	if getElementType(hitElement) == &amp;quot;player&amp;quot; then&lt;br /&gt;
		if getPedOccupiedVehicle(hitElement) == false then&lt;br /&gt;
		local x,y,z = getElementPosition(hitElement)&lt;br /&gt;
			local veh = createVehicle(551, x,y,z)&lt;br /&gt;
			warpPedIntoVehicle(hitElement,veh)&lt;br /&gt;
		end&lt;br /&gt;
	end &lt;br /&gt;
end &lt;br /&gt;
addEventHandler(&amp;quot;onMarkerHit&amp;quot;,vehMark,vehicleSpawner)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a vehicle five units to the right of a player when they type ''createvehicle'' and its name in the console:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local distance = 5 --units&lt;br /&gt;
&lt;br /&gt;
-- define our handler (we'll take a variable number of parameters where the name goes, because there are vehicle names with more than one word)&lt;br /&gt;
function consoleCreateVehicle ( sourcePlayer, commandName, ... )&lt;br /&gt;
   -- if a player triggered it, not the admin,&lt;br /&gt;
   if ( sourcePlayer ) then&lt;br /&gt;
      -- calculate the position of the vehicle based on the player's position and rotation:&lt;br /&gt;
      local x, y, z = getElementPosition ( sourcePlayer ) -- get the player's position&lt;br /&gt;
      local rotZ = getElementRotation ( sourcePlayer ) -- get the player's rotation around the Z axis in degrees&lt;br /&gt;
      x = x + ( ( math.cos ( math.rad ( rotZ ) ) ) * distance ) -- calculate the X position of the vehicle&lt;br /&gt;
      y = y + ( ( math.sin ( math.rad ( rotZ ) ) ) * distance ) -- calculate the Y position of the vehicle&lt;br /&gt;
&lt;br /&gt;
      -- get the complete vehicle name by joining all passed parameters using Lua function table.concat&lt;br /&gt;
      local vehicleName = table.concat({...}, &amp;quot; &amp;quot;)&lt;br /&gt;
      -- get the vehicle's model ID from the name&lt;br /&gt;
      local vehicleID = getVehicleModelFromName ( vehicleName )&lt;br /&gt;
      -- if vehicle ID is valid,&lt;br /&gt;
      if vehicleID then&lt;br /&gt;
            -- create the vehicle using the information gathered above:&lt;br /&gt;
            local newVehicle = createVehicle ( vehicleID, x, y, z, 0, 0, rotZ )&lt;br /&gt;
            -- if vehicle creation failed, give the player a message&lt;br /&gt;
            if not newVehicle then&lt;br /&gt;
               outputConsole ( &amp;quot;Failed to create vehicle.&amp;quot;, sourcePlayer )&lt;br /&gt;
            end&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Attach the 'consoleCreateVehicle' function to the &amp;quot;createvehicle&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;createvehicle&amp;quot;, consoleCreateVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 3: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This script spawns a Rhino on top of one lucky individual.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scriptCreateTank ( player, command )&lt;br /&gt;
      local luckyBugger = getRandomPlayer() -- get a random player&lt;br /&gt;
      local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position&lt;br /&gt;
      createVehicle ( 432, x, y, z + 10 ) -- create the tank 10 units above them&lt;br /&gt;
      outputChatBox ( &amp;quot;You got Tank'd!&amp;quot;, luckyBugger )&lt;br /&gt;
end&lt;br /&gt;
--Attach the 'scriptCreateTank' function to the &amp;quot;tank&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;tank&amp;quot;, scriptCreateTank )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 4: Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a ''/spveh'' command to spawn a car model in the provided coordinates. If any car created by this command gets blown up, it will respawn where it was created.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Do not allow the following IDs to be spawned&lt;br /&gt;
local forbiddenCars = { [435] = true, [441] = true, [449] = true, [450] = true, [464] = true, [465] = true, [501] = true,&lt;br /&gt;
                        [537] = true, [538] = true, [564] = true, [569] = true, [570] = true, [584] = true, [590] = true,&lt;br /&gt;
                        [591] = true, [594] = true, [606] = true, [607] = true, [608] = true, [610] = true, [611] = true }&lt;br /&gt;
&lt;br /&gt;
local cmdVehRoot = createElement(&amp;quot;commandVehicles&amp;quot;) -- Dummy element containing the cars that this command has created&lt;br /&gt;
addCommandHandler(&amp;quot;spveh&amp;quot;,&lt;br /&gt;
    function(player, cmd, modelID, x, y, z, platetext)&lt;br /&gt;
        -- Check whether arguments are correct&lt;br /&gt;
        local modelID, x, y, z = tonumber(modelID), tonumber(x), tonumber(y), tonumber(z)&lt;br /&gt;
        if modelID and x and y and z then&lt;br /&gt;
            -- Do not continue if we shouldn't&lt;br /&gt;
            if forbiddenCars[modelID] then&lt;br /&gt;
                outputChatBox(&amp;quot;The car model you provided is not allowed.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
                return&lt;br /&gt;
            end&lt;br /&gt;
            local platetext = type(platetext) == &amp;quot;string&amp;quot; and platetext or &amp;quot;PRIVATE&amp;quot;&lt;br /&gt;
            -- Create the actual vehicle and set it as a children of our dummy element&lt;br /&gt;
            setElementParent(createVehicle(modelID, x, y, z, 0, 0, 0, platetext), cmdVehRoot)&lt;br /&gt;
            -- Inform the player about what we did&lt;br /&gt;
            outputChatBox(&amp;quot;You have created a &amp;quot; .. getVehicleNameFromModel(modelID) .. &amp;quot; (model ID: &amp;quot; .. modelID .. &amp;quot;) at &amp;quot; .. table.concat({ x, y, z }, &amp;quot;, &amp;quot;) .. &amp;quot; with numberplate &amp;quot; .. platetext .. &amp;quot; successfully.&amp;quot;, player, 0, 255, 0)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Syntax: /&amp;quot; .. cmd .. &amp;quot; (modelID) (x) (y) (z) [numberplate]&amp;quot;, player, 255, 255, 255)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
-- If a vehicle that has been created using the command blows up, respawn it where it was created&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;, cmdVehRoot,&lt;br /&gt;
    function()&lt;br /&gt;
        respawnVehicle(source)&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;
&amp;lt;section name=&amp;quot;Example 5: Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This script spawns a Rhino on top of the local player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scriptCreateTank ( commandName )&lt;br /&gt;
      local x, y, z = getElementPosition ( localPlayer ) -- retrive the player's position&lt;br /&gt;
      createVehicle ( 432, x, y, z + 10 ) -- create the tank 10 units above them&lt;br /&gt;
      outputChatBox ( &amp;quot;You got Tank'd!&amp;quot;, 255, 0, 0)&lt;br /&gt;
end&lt;br /&gt;
--Attach the 'scriptCreateTank' function to the &amp;quot;tank&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;tank&amp;quot;, scriptCreateTank )&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;
{{New items|3.0132|1.4|&lt;br /&gt;
This is an example of how this function is executed in an OOP environment.&lt;br /&gt;
&amp;lt;section name=&amp;quot;OOP server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This script will create an Infernus at the center (0, 0, 3) of San Andreas upon execution.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;, resourceRoot,&lt;br /&gt;
    function()&lt;br /&gt;
        infernus = Vehicle(411, Vector3(0, 0, 3)); -- Create an Infernus and spawn it at the middle of SA.&lt;br /&gt;
        infernus:setColor(0, 0, 0); -- Set its color to black.&lt;br /&gt;
        infernus.damageProof = true; -- Make it damage proof&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
	&lt;br /&gt;
addCommandHandler( &amp;quot;blowinfernus&amp;quot;,&lt;br /&gt;
    function(p)&lt;br /&gt;
        if not infernus.blown then -- Check if the Infernus is blown up or not.&lt;br /&gt;
            infernus:blow();&lt;br /&gt;
        else -- Ouch, it's blown up, let's output an error to the player.&lt;br /&gt;
            outputChatBox( &amp;quot;The Infernus has already been blown up by you.&amp;quot;, p, 255, 0, 0, false );&lt;br /&gt;
        end&lt;br /&gt;
    end)&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;
==See Also==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Vehicle functions}}&lt;br /&gt;
[[de:createVehicle]]&lt;br /&gt;
[[pl:createVehicle]]&lt;br /&gt;
[[ru:CreateVehicle]]&lt;br /&gt;
[[pt-br:CreateVehicle]]&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Vehicle_Components&amp;diff=67888</id>
		<title>Vehicle Components</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Vehicle_Components&amp;diff=67888"/>
		<updated>2020-12-02T12:09:43Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Corrected misc_a description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page aims to provide an overview of vehicle components. The list is currently incomplete.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Note|Changing wheel position on Z axis doesn't work.}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;150&amp;quot; scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#8f8f8f;&amp;quot;| Component Name&lt;br /&gt;
! width=&amp;quot;300&amp;quot; scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#8f8f8f;&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|boot_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Trunk door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_nitro&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Nitro (tuning part)&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_rf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Front Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_lf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Front Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_rb_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Back Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_lb_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Back Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|chassis&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Chassis&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|chassis_vlo&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Chassis (lod)[Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_roof&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Roof [Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_rf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Front Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_lf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Front Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_rr_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Back Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_lr_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Back Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|bonnet_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Hood&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_wing_right &lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right wing (tuning part) [Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|bump_front_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Front bumper&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|bump_rear_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Back bumper&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|windscreen_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Windscreen&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|misc_a&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Tow bar position on models: 514, 515, 403, 591, 552, 485, 583, 606, 607, 608.&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_wing_left&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Leftwing (tuning part) [Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|exhaust_ok&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Exhausts&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Related scripting functions==&lt;br /&gt;
*[[setVehicleComponentVisible]]&lt;br /&gt;
*[[setVehicleComponentPosition]]&lt;br /&gt;
*[[setVehicleComponentRotation]]&lt;br /&gt;
*[[setVehicleComponentScale]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*[[resetVehicleComponentPosition]]&lt;br /&gt;
*[[resetVehicleComponentRotation]]&lt;br /&gt;
*[[resetVehicleComponentScale]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*[[getVehicleComponents]]&lt;br /&gt;
*[[getVehicleComponentVisible]]&lt;br /&gt;
*[[getVehicleComponentScale]]&lt;br /&gt;
*[[getVehicleComponentRotation]]&lt;br /&gt;
*[[getVehicleComponentPosition]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Vehicle functions==&lt;br /&gt;
{{Client_vehicle_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Vehicle_Components&amp;diff=67887</id>
		<title>Vehicle Components</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Vehicle_Components&amp;diff=67887"/>
		<updated>2020-12-02T11:55:58Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add misc_a component&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page aims to provide an overview of vehicle components. The list is currently incomplete.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{Note|Changing wheel position on Z axis doesn't work.}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;150&amp;quot; scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#8f8f8f;&amp;quot;| Component Name&lt;br /&gt;
! width=&amp;quot;300&amp;quot; scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#8f8f8f;&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|boot_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Trunk door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_nitro&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Nitro (tuning part)&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_rf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Front Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_lf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Front Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_rb_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Back Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|wheel_lb_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Back Wheel&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|chassis&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Chassis&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|chassis_vlo&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Chassis (lod)[Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_roof&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Roof [Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_rf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Front Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_lf_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Front Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_rr_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right Back Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|door_lr_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Left Back Door&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|bonnet_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Hood&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_wing_right &lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Right wing (tuning part) [Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|bump_front_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Front bumper&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|bump_rear_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Back bumper&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|windscreen_dummy&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Windscreen&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|misc_a&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Tow bar position. By default it exists on model: 514, 515, 403, 591, 552, 485, 583, 606, 607, 608.&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|ug_wing_left&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Leftwing (tuning part) [Can't be hid]&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|exhaust_ok&lt;br /&gt;
|style=&amp;quot;background:#cfcfcf;&amp;quot;|Exhausts&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Related scripting functions==&lt;br /&gt;
*[[setVehicleComponentVisible]]&lt;br /&gt;
*[[setVehicleComponentPosition]]&lt;br /&gt;
*[[setVehicleComponentRotation]]&lt;br /&gt;
*[[setVehicleComponentScale]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*[[resetVehicleComponentPosition]]&lt;br /&gt;
*[[resetVehicleComponentRotation]]&lt;br /&gt;
*[[resetVehicleComponentScale]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*[[getVehicleComponents]]&lt;br /&gt;
*[[getVehicleComponentVisible]]&lt;br /&gt;
*[[getVehicleComponentScale]]&lt;br /&gt;
*[[getVehicleComponentRotation]]&lt;br /&gt;
*[[getVehicleComponentPosition]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Vehicle functions==&lt;br /&gt;
{{Client_vehicle_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineRequestModel&amp;diff=67752</id>
		<title>EngineRequestModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineRequestModel&amp;diff=67752"/>
		<updated>2020-11-19T00:50:10Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: parentID is an optional argument&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20147|This function is used to assign the next available model ID to a certain element type. After release 1.5.8-20716 this function supports &amp;quot;vehicle&amp;quot; and &amp;quot;object&amp;quot; too.}}&lt;br /&gt;
{{note|IMPORTANT:&lt;br /&gt;
*before release 1.5.8-20716 this must be &amp;quot;ped&amp;quot;.&lt;br /&gt;
}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int engineRequestModel ( str elementType )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int engineRequestModel( &amp;quot;vehicle&amp;quot;, [int parentID] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''elementType''': &amp;quot;ped&amp;quot;, &amp;quot;vehicle&amp;quot; and &amp;quot;object&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''parentID''': The [[Vehicle IDs|vehicle ID]] of the vehicle being allocated. '''(By default this is: 1337 - objects, 400 - vehicles, 7 or PSYCHO for peds)'''&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20147| Returns an ''integer'' of the model ID that was available to be assigned to the element type, ''false'' if no free model ID available or invalid element type.}}&lt;br /&gt;
Do not rely on the model numbers returned being consistent across multiple clients or multiple runs of resources. There is no guarantee for the order of the numbers or that the same numbers will always correspond to the same element type. Any patterns are coincidental&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example creates a ped and then gives you the opportunity to change its model. If the resource stops, then the IDs allocated will be deallocated. Use ''/cap'' for creating the ped and ''/sap'' to skin the ped. You will need some skins added to a folder and to the meta.xml for ''/sap'' to work.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local peds = {}&lt;br /&gt;
function createAllocatedPed()&lt;br /&gt;
    local x, y, z = getElementPosition(localPlayer)&lt;br /&gt;
    local id = engineRequestModel(&amp;quot;ped&amp;quot;)&lt;br /&gt;
    peds[id] = createPed(id, x+0.5, y, z+0.5)&lt;br /&gt;
    outputChatBox(&amp;quot;New ped with ID &amp;quot;..id..&amp;quot; created.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;cap&amp;quot;, createAllocatedPed, false, false)&lt;br /&gt;
&lt;br /&gt;
function skinAllocatedPeds()&lt;br /&gt;
    local txd, dff;&lt;br /&gt;
    for id,ped in pairs(peds) do&lt;br /&gt;
        if fileExists(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.txd&amp;quot;) and fileExists(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.dff&amp;quot;) then&lt;br /&gt;
            txd = engineLoadTXD(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.txd&amp;quot;)&lt;br /&gt;
            engineImportTXD(txd, id)&lt;br /&gt;
            dff = engineLoadDFF(&amp;quot;skins/&amp;quot; .. id .. &amp;quot;.dff&amp;quot;)&lt;br /&gt;
            engineReplaceModel(dff, id)&lt;br /&gt;
            outputChatBox(&amp;quot;Model ID &amp;quot;..id..&amp;quot; changed correctly.&amp;quot;)&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Model ID &amp;quot;..id..&amp;quot; couldn't change. REASON: skins/&amp;quot; .. id .. &amp;quot;.txd or skins/&amp;quot; .. id .. &amp;quot;.dff does not exist.&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;sap&amp;quot;, skinAllocatedPeds, false, false)&lt;br /&gt;
&lt;br /&gt;
function onStop()&lt;br /&gt;
    for id,ped in pairs(peds) do&lt;br /&gt;
        engineFreeModel(id)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStop&amp;quot;, resourceRoot, onStop)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.7-9.20147|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineGetModelTextures&amp;diff=67737</id>
		<title>EngineGetModelTextures</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineGetModelTextures&amp;diff=67737"/>
		<updated>2020-11-12T19:48:17Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Undo revision 67736 by Pirulax (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20416|This function allows you to get the textures of any model.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table engineGetModelTextures( string/int modelName/modelID [, string/table textureNames ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''model''': either the model ID or model name.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''textureNames''': Only return textures with specified name(s). You can provide a single string or a table of strings. Wildcard matching e.g. &amp;quot;ro?ds*&amp;quot; can be used.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table of texture elements [textureName, texture], '''false''' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &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;
Get the textures for model ID 3722 and draw them with dxDrawImage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function init()&lt;br /&gt;
	textures = engineGetModelTextures(3722)&lt;br /&gt;
	addEventHandler(&amp;quot;onClientRender&amp;quot;, root, render)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, init)&lt;br /&gt;
&lt;br /&gt;
function render()&lt;br /&gt;
	local offset = 0&lt;br /&gt;
	for name,texture in pairs(textures) do&lt;br /&gt;
		local size = dxGetPixelsSize(dxGetTexturePixels(texture))&lt;br /&gt;
		dxDrawImage(0+offset, 0, size, size, texture)&lt;br /&gt;
		offset = offset + size&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.7-9.20416|}}&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineGetModelTextures&amp;diff=67736</id>
		<title>EngineGetModelTextures</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineGetModelTextures&amp;diff=67736"/>
		<updated>2020-11-12T19:39:37Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Add note that the return value structure is differente than stated (according to the source code)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20416|This function allows you to get the textures of any model.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table engineGetModelTextures( string/int modelName/modelID [, string/table textureNames ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''model''': either the model ID or model name.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''textureNames''': Only return textures with specified name(s). You can provide a single string or a table of strings. Wildcard matching e.g. &amp;quot;ro?ds*&amp;quot; can be used.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table of texture elements [textureName, texture], '''false''' otherwise. &amp;lt;/br&amp;gt;&lt;br /&gt;
'''Note: According to the [https://github.com/multitheftauto/mtasa-blue/blob/bafbae00cdcca392f10ffc9f450ed45e019253c4/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp#L1192 source code] the actual structure is: t[texture] = textureName'''&lt;br /&gt;
&lt;br /&gt;
==Example== &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;
Get the textures for model ID 3722 and draw them with dxDrawImage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function init()&lt;br /&gt;
	textures = engineGetModelTextures(3722)&lt;br /&gt;
	addEventHandler(&amp;quot;onClientRender&amp;quot;, root, render)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, init)&lt;br /&gt;
&lt;br /&gt;
function render()&lt;br /&gt;
	local offset = 0&lt;br /&gt;
	for name,texture in pairs(textures) do&lt;br /&gt;
		local size = dxGetPixelsSize(dxGetTexturePixels(texture))&lt;br /&gt;
		dxDrawImage(0+offset, 0, size, size, texture)&lt;br /&gt;
		offset = offset + size&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.7-9.20416|}}&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AbortRemoteRequest&amp;diff=67563</id>
		<title>AbortRemoteRequest</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AbortRemoteRequest&amp;diff=67563"/>
		<updated>2020-10-16T21:26:39Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20307|&lt;br /&gt;
Aborts a [[FetchRemote|fetchRemote]] or [[CallRemote|callRemote]] request.&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 abortRemoteRequest( request theRequest )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theRequest''': returned from [[FetchRemote|fetchRemote]], [[CallRemote|callRemote]] or [[GetRemoteRequests|getRemoteRequests]]&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns true on success, false when invalid request was provided&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example aborts all requests.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function CMD_abortRequests()&lt;br /&gt;
    local requests = getRemoteRequests()&lt;br /&gt;
	&lt;br /&gt;
    for _, request in ipairs(requests) do&lt;br /&gt;
        abortRemoteRequest(request)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;abortrequests&amp;quot;, CMD_abortRequests)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Requirements|1.5.7-9.20307|1.5.7-9.20307}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Resource functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AbortRemoteRequest&amp;diff=67562</id>
		<title>AbortRemoteRequest</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AbortRemoteRequest&amp;diff=67562"/>
		<updated>2020-10-16T21:24:58Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Undo revision 67561 by Pirulax (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20307|&lt;br /&gt;
Aborts a [[FetchRemote|fetchRemote]] or [[CallRemote|callRemote]] request.&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 abortRemoteRequest( request theRequest )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theRequest''': returned from [[FetchRemote|fetchRemote]], [[CallRemote|callRemote]] or [[GetRemoteRequests|getRemoteRequests]]&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns true on success, false when invalid request was provided&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
this example aborts all pending requests of currently running resource.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function CMD_abortRequests()&lt;br /&gt;
    local requests = getRemoteRequests()&lt;br /&gt;
	&lt;br /&gt;
    for _, request in ipairs(requests) do&lt;br /&gt;
        abortRemoteRequest(request)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;abortrequests&amp;quot;, CMD_abortRequests)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Requirements|1.5.7-9.20307|1.5.7-9.20307}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Resource functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AbortRemoteRequest&amp;diff=67561</id>
		<title>AbortRemoteRequest</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AbortRemoteRequest&amp;diff=67561"/>
		<updated>2020-10-16T21:23:52Z</updated>

		<summary type="html">&lt;p&gt;Pirulax: Fix the example - make the description match what the code actually does..&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0158|1.5.7|20307|&lt;br /&gt;
Aborts a [[FetchRemote|fetchRemote]] or [[CallRemote|callRemote]] request.&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 abortRemoteRequest( request theRequest )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theRequest''': returned from [[FetchRemote|fetchRemote]], [[CallRemote|callRemote]] or [[GetRemoteRequests|getRemoteRequests]]&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns true on success, false when invalid request was provided&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
this example aborts all pending requests of currently running resource.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function CMD_abortRequests()&lt;br /&gt;
    local requests = getRemoteRequests(getThisResource())&lt;br /&gt;
	&lt;br /&gt;
    for _, request in ipairs(requests) do&lt;br /&gt;
        abortRemoteRequest(request)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;abortrequests&amp;quot;, CMD_abortRequests)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Requirements|1.5.7-9.20307|1.5.7-9.20307}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Resource functions}}&lt;/div&gt;</summary>
		<author><name>Pirulax</name></author>
	</entry>
</feed>