<?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=Botder</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=Botder"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Botder"/>
	<updated>2026-04-07T11:36:03Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetCameraFieldOfView&amp;diff=82260</id>
		<title>SetCameraFieldOfView</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetCameraFieldOfView&amp;diff=82260"/>
		<updated>2025-07-24T01:08:59Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{client function}}&lt;br /&gt;
{{New feature/item|3.0151|1.5.1|7397|This function sets the field of view of the ''dynamic camera'' - this is the field of view of the ''non-fixed camera'' - yes, the camera that the user can control whilst on foot or in a vehicle. The higher the field of view angle, the more you will be able to see to your sides.}}&lt;br /&gt;
{{Note|This function omits (but doesn't override) the user game option in '''''Settings -&amp;gt; Video -&amp;gt; FOV'''''}}&lt;br /&gt;
{{Note|It doesn't affect the FOV for the following camera modes: 1) Player aiming 2) Vehicle front bumper camera 3) Fixed camera}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setCameraFieldOfView ( string cameraMode, float fieldOfView [, bool instant = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Camera.setFieldOfView||getCameraFieldOfView}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
'''Note:''' after 100, some unexpected things may happen to the camera, particularly in vehicles, use carefully!&lt;br /&gt;
*'''cameraMode:''' the camera mode to set the field of view of:&lt;br /&gt;
** &amp;quot;player&amp;quot;: whilst walking/running&lt;br /&gt;
** &amp;quot;vehicle&amp;quot;: whilst in vehicle&lt;br /&gt;
** &amp;quot;vehicle_max&amp;quot;: the max the field of view can go to when the vehicle is moving at a high speed (must be higher than &amp;quot;vehicle&amp;quot;)&lt;br /&gt;
*'''fieldOfView:''' The field of view angle, 0 to 179.&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|23300|&lt;br /&gt;
*'''instant''': If set to ''true'', the value is applied immediately, without delay (does not work with &amp;quot;vehicle_max&amp;quot;).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the arguments are valid, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
In this example, the field of view for 'player walking/running' is set to 20 when the player joins.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function setCameraFOVOnResStart()&lt;br /&gt;
    setCameraFieldOfView(&amp;quot;player&amp;quot;,20)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, setCameraFOVOnResStart)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client camera functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:setCameraFieldOfView]]&lt;br /&gt;
[[RO:setCameraFieldOfView]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:File_functions&amp;diff=82259</id>
		<title>Template:File functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:File_functions&amp;diff=82259"/>
		<updated>2025-07-23T18:58:51Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileClose]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileCopy]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileCreate]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileDelete]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileExists]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileFlush]]&amp;lt;/li&amp;gt;&lt;br /&gt;
{{New items|3.0161|1.6.0|&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetContents]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|21938}}&lt;br /&gt;
{{New items|3.0161|1.6.0|&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetHash]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|23289}}&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetPath]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetPos]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetSize]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileIsEOF]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileOpen]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileRead]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileRename]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileSetPos]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileWrite]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Functions templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:File_functions&amp;diff=82258</id>
		<title>Template:File functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:File_functions&amp;diff=82258"/>
		<updated>2025-07-23T18:58:05Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileClose]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileCopy]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileCreate]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileDelete]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileExists]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileFlush]]&amp;lt;/li&amp;gt;&lt;br /&gt;
{{New items|3.0161|1.6.0|&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetContents]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|21938}}&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetPath]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetPos]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetSize]]&amp;lt;/li&amp;gt;&lt;br /&gt;
{{New items|3.0161|1.6.0|&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetHash]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|23289}}&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileIsEOF]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileOpen]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileRead]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileRename]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileSetPos]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileWrite]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Functions templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileGetHash&amp;diff=82257</id>
		<title>FileGetHash</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileGetHash&amp;diff=82257"/>
		<updated>2025-07-23T18:48:35Z</updated>

		<summary type="html">&lt;p&gt;Botder: Created page with &amp;quot;__NOTOC__ {{Server client function}}  {{Added feature/item|1.6.1|1.6.0|23289| This function returns a hash of the entire file in the specified algorithm. This function ''does not'' move the file pointer/position. Beware though, there will always be a minuscule period of time between checking the hash and loading the contents of the file, which can be abused by a potential attacker to modify the contents. }}  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; nil|string fileGetHash...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
{{Added feature/item|1.6.1|1.6.0|23289|&lt;br /&gt;
This function returns a hash of the entire file in the specified algorithm. This function ''does not'' move the file pointer/position. Beware though, there will always be a minuscule period of time between checking the hash and loading the contents of the file, which can be abused by a potential attacker to modify the contents.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
nil|string fileGetHash ( file theFile, string algorithm [, table options ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[file]]:getHash}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theFile:''' A handle to the file you wish to get the hash from. Use [[fileOpen]] to obtain this handle.&lt;br /&gt;
*'''algorithm''': A string which must be one of these: &amp;quot;md5&amp;quot;, &amp;quot;sha1&amp;quot;, &amp;quot;sha224&amp;quot;, &amp;quot;sha256&amp;quot;, &amp;quot;sha384&amp;quot;, &amp;quot;sha512&amp;quot;, &amp;quot;hmac&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''options''': A table with options and other necessary data for the algorithm, as detailed below.&lt;br /&gt;
&lt;br /&gt;
===Options for each algorithm===&lt;br /&gt;
* ''hmac'' ([https://en.wikipedia.org/wiki/HMAC HMAC])&lt;br /&gt;
** '''key''': a key to encode the input with.&lt;br /&gt;
** '''algorithm''': a string which must be one of these: &amp;quot;md5&amp;quot;, &amp;quot;sha1&amp;quot;, &amp;quot;sha224&amp;quot;, &amp;quot;sha256&amp;quot;, &amp;quot;sha384&amp;quot;, &amp;quot;sha512&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the hash of the entire file on success, and ''nil'' on failure.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens the code.lua file, computes the hash with every algorithm, and then displays them.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handle = fileOpen(&amp;quot;code.lua&amp;quot;, true)&lt;br /&gt;
local hashMD5 = fileGetHash(handle, &amp;quot;md5&amp;quot;)&lt;br /&gt;
local hashSHA1 = fileGetHash(handle, &amp;quot;sha1&amp;quot;)&lt;br /&gt;
local hashSHA224 = fileGetHash(handle, &amp;quot;sha224&amp;quot;)&lt;br /&gt;
local hashSHA256 = fileGetHash(handle, &amp;quot;sha256&amp;quot;)&lt;br /&gt;
local hashSHA384 = fileGetHash(handle, &amp;quot;sha384&amp;quot;)&lt;br /&gt;
local hashSHA512 = fileGetHash(handle, &amp;quot;sha512&amp;quot;)&lt;br /&gt;
local hashHMAC = fileGetHash(handle, &amp;quot;hmac&amp;quot;, { algorithm = &amp;quot;sha256&amp;quot;, key = &amp;quot;blue apple tree&amp;quot; })&lt;br /&gt;
fileClose(handle)&lt;br /&gt;
&lt;br /&gt;
iprint(&amp;quot;MD5&amp;quot;, hashMD5)&lt;br /&gt;
iprint(&amp;quot;SHA1&amp;quot;, hashSHA1)&lt;br /&gt;
iprint(&amp;quot;SHA224&amp;quot;, hashSHA224)&lt;br /&gt;
iprint(&amp;quot;SHA256&amp;quot;, hashSHA256)&lt;br /&gt;
iprint(&amp;quot;SHA384&amp;quot;, hashSHA384)&lt;br /&gt;
iprint(&amp;quot;SHA512&amp;quot;, hashSHA512)&lt;br /&gt;
iprint(&amp;quot;HMAC-SHA256&amp;quot;, hashHMAC )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Lua_compilation_API&amp;diff=82014</id>
		<title>Lua compilation API</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Lua_compilation_API&amp;diff=82014"/>
		<updated>2025-05-26T18:44:34Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is a guide for Lua compilation API.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
POST &amp;quot;https://luac.mtasa.com/index.php&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
*'''luasource:''' type '''file''' the file content&lt;br /&gt;
*'''compile:''' type '''value''' set to 1 to enable compilation&lt;br /&gt;
*'''debug:''' type '''value''' set to 1 to enable debug information&lt;br /&gt;
*'''obfuscate:''' type '''value'''&lt;br /&gt;
**Set to 1 to enable some obfuscation&lt;br /&gt;
**Set to 2 to enable more obfuscation (From 1.5.2-9.07903)&lt;br /&gt;
**Set to 3 to enable even more obfuscation (From 1.5.6-9.18728)&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
===Linux example using curl===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
FROM=&amp;quot;example.lua&amp;quot;&lt;br /&gt;
TO=&amp;quot;compiled.lua&amp;quot;&lt;br /&gt;
curl -s -X POST -F compile=1 -F debug=0 -F obfuscate=3 -F luasource=@$FROM https://luac.mtasa.com/ &amp;gt; $TO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Linux example using luac replacement===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
luac_mta -e3 -o compiled.lua example.lua&lt;br /&gt;
if [ $? -ne 0 ]; then&lt;br /&gt;
   echo &amp;quot;Error&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Need luac_mta (R13 2019-07-12) for [//luac.mtasa.com/files/linux/x86/luac_mta Linux 32 bit] or [//luac.mtasa.com/files/linux/x64/luac_mta Linux 64 bit]&lt;br /&gt;
&lt;br /&gt;
===Windows batch file example using curl===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;batch&amp;quot;&amp;gt;&lt;br /&gt;
set FROM=&amp;quot;example.lua&amp;quot;&lt;br /&gt;
set TO=&amp;quot;compiled.lua&amp;quot;&lt;br /&gt;
curl.exe -s -X POST -F compile=1 -F debug=0 -F obfuscate=3 -F luasource=@%FROM% https://luac.mtasa.com/ &amp;gt; %TO%&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Get [https://curl.se/windows/latest.cgi?p=win64-mingw.zip curl for win64]&amp;lt;/br&amp;gt;&lt;br /&gt;
(Original from https://curl.haxx.se/download.html)&lt;br /&gt;
&lt;br /&gt;
===Windows example using luac.exe replacement===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;batch&amp;quot;&amp;gt;&lt;br /&gt;
luac_mta.exe -e3 -o compiled.lua example.lua&lt;br /&gt;
IF NOT ERRORLEVEL 1 goto lp1&lt;br /&gt;
   echo &amp;quot;Error&amp;quot;&lt;br /&gt;
:lp1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Get [//luac.mtasa.com/files/windows/x86/luac_mta.exe luac_mta.exe] (R12 2019-07-12) '''only x86'''&lt;br /&gt;
===Lua example===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This example allows you to compile all resource scripts by using /compilelua command.&lt;br /&gt;
&lt;br /&gt;
local compileEnabled = 1&lt;br /&gt;
local debugLevel = 0&lt;br /&gt;
local obfuscateLevel = 3&lt;br /&gt;
local apiCodes = {&lt;br /&gt;
	[&amp;quot;ERROR Nothing to do - Please select compile and/or obfuscate&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Could not compile file&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Could not read file&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Already compiled&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Already encrypted&amp;quot;] = true,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function loadScriptsFromMeta()&lt;br /&gt;
	local metaFile = xmlLoadFile(&amp;quot;meta.xml&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	if not metaFile then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: Failed to load scripts from meta.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local metaChildren = xmlNodeGetChildren(metaFile)&lt;br /&gt;
	local scriptsTable = {}&lt;br /&gt;
&lt;br /&gt;
	for nodeID = 1, #metaChildren do&lt;br /&gt;
		local metaNode = metaChildren[nodeID]&lt;br /&gt;
		local fileSrc = xmlNodeGetAttribute(metaNode, &amp;quot;src&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
		if fileSrc then&lt;br /&gt;
			local luaScript = string.find(fileSrc, &amp;quot;.lua&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
			if luaScript then&lt;br /&gt;
				scriptsTable[#scriptsTable + 1] = fileSrc&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	xmlUnloadFile(metaFile)&lt;br /&gt;
&lt;br /&gt;
	return scriptsTable&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function loadResourceScript(pPath)&lt;br /&gt;
	local scriptExists = fileExists(pPath)&lt;br /&gt;
&lt;br /&gt;
	if not scriptExists then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pPath..&amp;quot;' doesn't exists.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local scriptHandler = fileOpen(pPath)&lt;br /&gt;
&lt;br /&gt;
	if not scriptHandler then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pPath..&amp;quot;' failed to open.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local scriptSize = fileGetSize(scriptHandler)&lt;br /&gt;
	local scriptRaw = fileRead(scriptHandler, scriptSize)&lt;br /&gt;
&lt;br /&gt;
	fileClose(scriptHandler)&lt;br /&gt;
&lt;br /&gt;
	return scriptRaw&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function onScriptCompile(pCompiledLUA, pErrors, pScript)&lt;br /&gt;
	local compileSuccess = pErrors == 0&lt;br /&gt;
&lt;br /&gt;
	if not compileSuccess then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' failed to compile.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local compileError = apiCodes[pCompiledLUA]&lt;br /&gt;
&lt;br /&gt;
	if compileError then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' failed to compile - &amp;quot;..pCompiledLUA, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local compiledScript = fileCreate(&amp;quot;luac/&amp;quot;..pScript)&lt;br /&gt;
&lt;br /&gt;
	if not compiledScript then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' failed to create.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	fileWrite(compiledScript, pCompiledLUA)&lt;br /&gt;
	fileClose(compiledScript)&lt;br /&gt;
&lt;br /&gt;
	outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' compiled successfully.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
	return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function compileLuaScripts(pPlayer)&lt;br /&gt;
	local fetchURL = string.format(&amp;quot;https://luac.mtasa.com/?compile=%i&amp;amp;debug=%i&amp;amp;obfuscate=%i&amp;quot;, compileEnabled, debugLevel, obfuscateLevel)&lt;br /&gt;
	local resourceScripts = loadScriptsFromMeta()&lt;br /&gt;
	local postData = true&lt;br /&gt;
&lt;br /&gt;
	for scriptID = 1, #resourceScripts do&lt;br /&gt;
		local scriptPath = resourceScripts[scriptID]&lt;br /&gt;
		local scriptRaw = loadResourceScript(scriptPath)&lt;br /&gt;
&lt;br /&gt;
		fetchRemote(fetchURL, onScriptCompile, scriptRaw, postData, scriptPath)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;compilelua&amp;quot;, compileLuaScripts)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Python example===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import requests&lt;br /&gt;
&lt;br /&gt;
url_raw = 'luac.mtasa.com'&lt;br /&gt;
url = f'https://{url_raw}'&lt;br /&gt;
url_file = f'{url}/index.php'&lt;br /&gt;
&lt;br /&gt;
newLine = '\r\n'&lt;br /&gt;
boundary = '------WebKitFormBoundary'&lt;br /&gt;
boundaryLine = f'{boundary}{newLine}'&lt;br /&gt;
&lt;br /&gt;
headers = {&lt;br /&gt;
    'Host': url_raw,&lt;br /&gt;
    'Origin': url,&lt;br /&gt;
    'Referer': url_file,&lt;br /&gt;
    'Content-Type': f'multipart/form-data; boundary={boundary[2:]}',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fileContent = 'print(&amp;quot;Hello, World!&amp;quot;)'&lt;br /&gt;
fileName = 'main.lua'&lt;br /&gt;
docompile = 1&lt;br /&gt;
obfuscateLevel = 3&lt;br /&gt;
debug = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def req() -&amp;gt; requests.Response:&lt;br /&gt;
    payload = [&lt;br /&gt;
        [&lt;br /&gt;
            f'Content-Disposition: form-data; name=&amp;quot;luasource&amp;quot;; filename=&amp;quot;{fileName}&amp;quot;'.encode('utf-8'),&lt;br /&gt;
            b'Content-Type: application/octet-stream',&lt;br /&gt;
            f'{newLine}{fileContent}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;compile&amp;quot;',&lt;br /&gt;
            f'{newLine}{docompile}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;obfuscate&amp;quot;',&lt;br /&gt;
            f'{newLine}{obfuscateLevel}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;debug&amp;quot;',&lt;br /&gt;
            f'{newLine}{debug}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;Submit&amp;quot;',&lt;br /&gt;
            f'{newLine}Submit'.encode('utf-8')&lt;br /&gt;
        ]&lt;br /&gt;
    ]&lt;br /&gt;
&lt;br /&gt;
    data = boundaryLine&lt;br /&gt;
    for c in payload:&lt;br /&gt;
        for cc in c:&lt;br /&gt;
            data += cc.decode('utf-8') + '\r\n'&lt;br /&gt;
        data += boundaryLine&lt;br /&gt;
&lt;br /&gt;
    return requests.post(url_file, headers=headers, data=data)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == '__main__':&lt;br /&gt;
    fileName = input('Filename (with extension): ')&lt;br /&gt;
    with open(fileName, 'r+') as f:&lt;br /&gt;
        fileContent = f.read()&lt;br /&gt;
    obfuscateLevel = int(input('Obfuscate level [0-3]: '))&lt;br /&gt;
    _docompile = input('Compile [true/false]: ').lower()&lt;br /&gt;
    if _docompile == 'true' or _docompile == 't' or _docompile == '1':&lt;br /&gt;
        docompile = '1'&lt;br /&gt;
    else:&lt;br /&gt;
        docompile = '0'&lt;br /&gt;
    _debug = input('Debug [true/false]: ').lower()&lt;br /&gt;
    if _debug == 'true' or _debug == 't' or _debug == '1':&lt;br /&gt;
        debug = '1'&lt;br /&gt;
    else:&lt;br /&gt;
        debug = '0'&lt;br /&gt;
&lt;br /&gt;
    try:&lt;br /&gt;
        content = req().content&lt;br /&gt;
        if content == b'ERROR Could not compile file':&lt;br /&gt;
            print('Could not compile file!')&lt;br /&gt;
            exit(1)&lt;br /&gt;
&lt;br /&gt;
        with open(fileName, 'wb+') as f:&lt;br /&gt;
            f.write(content)&lt;br /&gt;
        print('Done!')&lt;br /&gt;
    except Exception as e:&lt;br /&gt;
        print('An error occured:', e)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|2014-08-10|''encrypt'' has been renamed to ''obfuscate''.&amp;lt;br&amp;gt;''blockdecompile'' has been removed.}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Lua_compilation_API&amp;diff=82013</id>
		<title>Lua compilation API</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Lua_compilation_API&amp;diff=82013"/>
		<updated>2025-05-26T18:32:49Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is a guide for Lua compilation API.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
POST &amp;quot;http://luac.mtasa.com/index.php&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
*'''luasource:''' type '''file''' the file content&lt;br /&gt;
*'''compile:''' type '''value''' set to 1 to enable compilation&lt;br /&gt;
*'''debug:''' type '''value''' set to 1 to enable debug information&lt;br /&gt;
*'''obfuscate:''' type '''value'''&lt;br /&gt;
**Set to 1 to enable some obfuscation&lt;br /&gt;
**Set to 2 to enable more obfuscation (From 1.5.2-9.07903)&lt;br /&gt;
**Set to 3 to enable even more obfuscation (From 1.5.6-9.18728)&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
===Linux example using curl===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
FROM=&amp;quot;example.lua&amp;quot;&lt;br /&gt;
TO=&amp;quot;compiled.lua&amp;quot;&lt;br /&gt;
curl -s -X POST -F compile=1 -F debug=0 -F obfuscate=3 -F luasource=@$FROM http://luac.mtasa.com/ &amp;gt; $TO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Linux example using luac replacement===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
luac_mta -e3 -o compiled.lua example.lua&lt;br /&gt;
if [ $? -ne 0 ]; then&lt;br /&gt;
   echo &amp;quot;Error&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Need luac_mta (R13 2019-07-12) for [//luac.mtasa.com/files/linux/x86/luac_mta Linux 32 bit] or [//luac.mtasa.com/files/linux/x64/luac_mta Linux 64 bit]&lt;br /&gt;
&lt;br /&gt;
===Windows batch file example using curl===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;batch&amp;quot;&amp;gt;&lt;br /&gt;
set FROM=&amp;quot;example.lua&amp;quot;&lt;br /&gt;
set TO=&amp;quot;compiled.lua&amp;quot;&lt;br /&gt;
curl.exe -s -X POST -F compile=1 -F debug=0 -F obfuscate=3 -F luasource=@%FROM% http://luac.mtasa.com/ &amp;gt; %TO%&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Get [https://curl.se/windows/latest.cgi?p=win64-mingw.zip curl for win64]&amp;lt;/br&amp;gt;&lt;br /&gt;
(Original from http://curl.haxx.se/download.html)&lt;br /&gt;
&lt;br /&gt;
===Windows example using luac.exe replacement===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;batch&amp;quot;&amp;gt;&lt;br /&gt;
luac_mta.exe -e3 -o compiled.lua example.lua&lt;br /&gt;
IF NOT ERRORLEVEL 1 goto lp1&lt;br /&gt;
   echo &amp;quot;Error&amp;quot;&lt;br /&gt;
:lp1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Get [//luac.mtasa.com/files/windows/x86/luac_mta.exe luac_mta.exe] (R12 2019-07-12) '''only x86'''&lt;br /&gt;
===Lua example===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This example allows you to compile all resource scripts by using /compilelua command.&lt;br /&gt;
&lt;br /&gt;
local compileEnabled = 1&lt;br /&gt;
local debugLevel = 0&lt;br /&gt;
local obfuscateLevel = 3&lt;br /&gt;
local apiCodes = {&lt;br /&gt;
	[&amp;quot;ERROR Nothing to do - Please select compile and/or obfuscate&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Could not compile file&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Could not read file&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Already compiled&amp;quot;] = true,&lt;br /&gt;
	[&amp;quot;ERROR Already encrypted&amp;quot;] = true,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function loadScriptsFromMeta()&lt;br /&gt;
	local metaFile = xmlLoadFile(&amp;quot;meta.xml&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	if not metaFile then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: Failed to load scripts from meta.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local metaChildren = xmlNodeGetChildren(metaFile)&lt;br /&gt;
	local scriptsTable = {}&lt;br /&gt;
&lt;br /&gt;
	for nodeID = 1, #metaChildren do&lt;br /&gt;
		local metaNode = metaChildren[nodeID]&lt;br /&gt;
		local fileSrc = xmlNodeGetAttribute(metaNode, &amp;quot;src&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
		if fileSrc then&lt;br /&gt;
			local luaScript = string.find(fileSrc, &amp;quot;.lua&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
			if luaScript then&lt;br /&gt;
				scriptsTable[#scriptsTable + 1] = fileSrc&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	xmlUnloadFile(metaFile)&lt;br /&gt;
&lt;br /&gt;
	return scriptsTable&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function loadResourceScript(pPath)&lt;br /&gt;
	local scriptExists = fileExists(pPath)&lt;br /&gt;
&lt;br /&gt;
	if not scriptExists then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pPath..&amp;quot;' doesn't exists.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local scriptHandler = fileOpen(pPath)&lt;br /&gt;
&lt;br /&gt;
	if not scriptHandler then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pPath..&amp;quot;' failed to open.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local scriptSize = fileGetSize(scriptHandler)&lt;br /&gt;
	local scriptRaw = fileRead(scriptHandler, scriptSize)&lt;br /&gt;
&lt;br /&gt;
	fileClose(scriptHandler)&lt;br /&gt;
&lt;br /&gt;
	return scriptRaw&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function onScriptCompile(pCompiledLUA, pErrors, pScript)&lt;br /&gt;
	local compileSuccess = pErrors == 0&lt;br /&gt;
&lt;br /&gt;
	if not compileSuccess then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' failed to compile.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local compileError = apiCodes[pCompiledLUA]&lt;br /&gt;
&lt;br /&gt;
	if compileError then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' failed to compile - &amp;quot;..pCompiledLUA, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local compiledScript = fileCreate(&amp;quot;luac/&amp;quot;..pScript)&lt;br /&gt;
&lt;br /&gt;
	if not compiledScript then&lt;br /&gt;
		outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' failed to create.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	fileWrite(compiledScript, pCompiledLUA)&lt;br /&gt;
	fileClose(compiledScript)&lt;br /&gt;
&lt;br /&gt;
	outputDebugString(&amp;quot;[LUAC]: '&amp;quot;..pScript..&amp;quot;' compiled successfully.&amp;quot;, 4, 255, 127, 0)&lt;br /&gt;
&lt;br /&gt;
	return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function compileLuaScripts(pPlayer)&lt;br /&gt;
	local fetchURL = string.format(&amp;quot;https://luac.mtasa.com/?compile=%i&amp;amp;debug=%i&amp;amp;obfuscate=%i&amp;quot;, compileEnabled, debugLevel, obfuscateLevel)&lt;br /&gt;
	local resourceScripts = loadScriptsFromMeta()&lt;br /&gt;
	local postData = true&lt;br /&gt;
&lt;br /&gt;
	for scriptID = 1, #resourceScripts do&lt;br /&gt;
		local scriptPath = resourceScripts[scriptID]&lt;br /&gt;
		local scriptRaw = loadResourceScript(scriptPath)&lt;br /&gt;
&lt;br /&gt;
		fetchRemote(fetchURL, onScriptCompile, scriptRaw, postData, scriptPath)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;compilelua&amp;quot;, compileLuaScripts)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Python example===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import requests&lt;br /&gt;
&lt;br /&gt;
url_raw = 'luac.mtasa.com'&lt;br /&gt;
url = f'https://{url_raw}'&lt;br /&gt;
url_file = f'{url}/index.php'&lt;br /&gt;
&lt;br /&gt;
newLine = '\r\n'&lt;br /&gt;
boundary = '------WebKitFormBoundary'&lt;br /&gt;
boundaryLine = f'{boundary}{newLine}'&lt;br /&gt;
&lt;br /&gt;
headers = {&lt;br /&gt;
    'Host': url_raw,&lt;br /&gt;
    'Origin': url,&lt;br /&gt;
    'Referer': url_file,&lt;br /&gt;
    'Content-Type': f'multipart/form-data; boundary={boundary[2:]}',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
fileContent = 'print(&amp;quot;Hello, World!&amp;quot;)'&lt;br /&gt;
fileName = 'main.lua'&lt;br /&gt;
docompile = 1&lt;br /&gt;
obfuscateLevel = 3&lt;br /&gt;
debug = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def req() -&amp;gt; requests.Response:&lt;br /&gt;
    payload = [&lt;br /&gt;
        [&lt;br /&gt;
            f'Content-Disposition: form-data; name=&amp;quot;luasource&amp;quot;; filename=&amp;quot;{fileName}&amp;quot;'.encode('utf-8'),&lt;br /&gt;
            b'Content-Type: application/octet-stream',&lt;br /&gt;
            f'{newLine}{fileContent}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;compile&amp;quot;',&lt;br /&gt;
            f'{newLine}{docompile}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;obfuscate&amp;quot;',&lt;br /&gt;
            f'{newLine}{obfuscateLevel}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;debug&amp;quot;',&lt;br /&gt;
            f'{newLine}{debug}'.encode('utf-8')&lt;br /&gt;
        ],&lt;br /&gt;
        [&lt;br /&gt;
            b'Content-Disposition: form-data; name=&amp;quot;Submit&amp;quot;',&lt;br /&gt;
            f'{newLine}Submit'.encode('utf-8')&lt;br /&gt;
        ]&lt;br /&gt;
    ]&lt;br /&gt;
&lt;br /&gt;
    data = boundaryLine&lt;br /&gt;
    for c in payload:&lt;br /&gt;
        for cc in c:&lt;br /&gt;
            data += cc.decode('utf-8') + '\r\n'&lt;br /&gt;
        data += boundaryLine&lt;br /&gt;
&lt;br /&gt;
    return requests.post(url_file, headers=headers, data=data)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == '__main__':&lt;br /&gt;
    fileName = input('Filename (with extension): ')&lt;br /&gt;
    with open(fileName, 'r+') as f:&lt;br /&gt;
        fileContent = f.read()&lt;br /&gt;
    obfuscateLevel = int(input('Obfuscate level [0-3]: '))&lt;br /&gt;
    _docompile = input('Compile [true/false]: ').lower()&lt;br /&gt;
    if _docompile == 'true' or _docompile == 't' or _docompile == '1':&lt;br /&gt;
        docompile = '1'&lt;br /&gt;
    else:&lt;br /&gt;
        docompile = '0'&lt;br /&gt;
    _debug = input('Debug [true/false]: ').lower()&lt;br /&gt;
    if _debug == 'true' or _debug == 't' or _debug == '1':&lt;br /&gt;
        debug = '1'&lt;br /&gt;
    else:&lt;br /&gt;
        debug = '0'&lt;br /&gt;
&lt;br /&gt;
    try:&lt;br /&gt;
        content = req().content&lt;br /&gt;
        if content == b'ERROR Could not compile file':&lt;br /&gt;
            print('Could not compile file!')&lt;br /&gt;
            exit(1)&lt;br /&gt;
&lt;br /&gt;
        with open(fileName, 'wb+') as f:&lt;br /&gt;
            f.write(content)&lt;br /&gt;
        print('Done!')&lt;br /&gt;
    except Exception as e:&lt;br /&gt;
        print('An error occured:', e)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|2014-08-10|''encrypt'' has been renamed to ''obfuscate''.&amp;lt;br&amp;gt;''blockdecompile'' has been removed.}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetServerIp&amp;diff=81681</id>
		<title>GetServerIp</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetServerIp&amp;diff=81681"/>
		<updated>2025-01-08T20:07:57Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22890|This function returns the IP of the server the client is currently connected to.}}&lt;br /&gt;
{{Note|On server-side there is the [[getServerIpFromMasterServer]] function, which might return the server IP under certain conditions.&amp;lt;/br&amp;gt;You should consider using a third-party service via [[fetchServerIp]] ''(not an MTA function)'' if the previous function is unreliable for you.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getServerIp ( [ bool includePort = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''includePort:''' If set to ''true'', the string will include the port of the server at the end of the string, after a colon (:) character.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string containing the remote address of the server the client is currently connected to.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a console command that outputs the server's IP to the chatbox.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputServerIp()&lt;br /&gt;
    outputChatBox(&amp;quot;You are currently connected to &amp;quot;.. getServerIp(true))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;serverIp&amp;quot;, outputServerIp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Utility_functions|client}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetServerIp&amp;diff=81680</id>
		<title>GetServerIp</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetServerIp&amp;diff=81680"/>
		<updated>2025-01-08T20:05:16Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22890|This function returns the IP of the server the client is currently connected to.}}&lt;br /&gt;
{{Note|On server-side there is the [[getServerIpFromMasterServer]] function, which might return the server IP under certain conditions.&amp;lt;/br&amp;gt;You should consider using a third-party service via [[fetchServerIp]] ''(not an MTA function)'' if the previous function is unreliable for you.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getServerIp ( [ bool includePort = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a console command that outputs the server's IP to the chatbox.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputServerIp()&lt;br /&gt;
    outputChatBox(&amp;quot;You are currently connected to &amp;quot;.. getServerIp(true))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;serverIp&amp;quot;, outputServerIp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Utility_functions|client}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FetchServerIp&amp;diff=81679</id>
		<title>FetchServerIp</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FetchServerIp&amp;diff=81679"/>
		<updated>2025-01-08T19:55:38Z</updated>

		<summary type="html">&lt;p&gt;Botder: Created page with &amp;quot;{{Useful_Function}} &amp;lt;lowercasetitle/&amp;gt; __NOTOC__ This function returns the server ip as reported by a third-party service.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; string fetchServerIp ( ) &amp;lt;/syntaxhighlight&amp;gt;  ==Code== &amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt; &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; SERVER_IP = &amp;quot;127.0.0.1&amp;quot;  function fetchServerIp()     return SERVER_IP end  fetchRemote(&amp;quot;http://checkip.dyndns.com/&amp;quot;,     function (response)         if response ~= &amp;quot;ERROR&amp;quot; then...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful_Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function returns the server ip as reported by a third-party service.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string fetchServerIp ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code==&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;
SERVER_IP = &amp;quot;127.0.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function fetchServerIp()&lt;br /&gt;
    return SERVER_IP&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
fetchRemote(&amp;quot;http://checkip.dyndns.com/&amp;quot;,&lt;br /&gt;
    function (response)&lt;br /&gt;
        if response ~= &amp;quot;ERROR&amp;quot; then&lt;br /&gt;
            SERVER_IP = response:match(&amp;quot;&amp;lt;body&amp;gt;Current IP Address: (.-)&amp;lt;/body&amp;gt;&amp;quot;) or &amp;quot;127.0.0.1&amp;quot;&lt;br /&gt;
        end&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;
==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;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputServerLog(&amp;quot;Public server IP: &amp;quot; .. fetchServerIp())&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetServerIp&amp;diff=81678</id>
		<title>GetServerIp</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetServerIp&amp;diff=81678"/>
		<updated>2025-01-08T19:50:54Z</updated>

		<summary type="html">&lt;p&gt;Botder: Removed redirect to GetServerConfigSetting#Example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful_Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the server ip.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string getServerIp ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code==&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;
&lt;br /&gt;
function getServerIp()&lt;br /&gt;
    return getServerConfigSetting (&amp;quot;serverip&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
or&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;
SERVER_IP = &amp;quot;127.0.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function getServerIp()&lt;br /&gt;
    return SERVER_IP&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
fetchRemote(&amp;quot;http://checkip.dyndns.com/&amp;quot;,&lt;br /&gt;
    function (response)&lt;br /&gt;
        if response ~= &amp;quot;ERROR&amp;quot; then&lt;br /&gt;
            SERVER_IP = response:match(&amp;quot;&amp;lt;body&amp;gt;Current IP Address: (.-)&amp;lt;/body&amp;gt;&amp;quot;) or &amp;quot;127.0.0.1&amp;quot;&lt;br /&gt;
        end&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;
==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;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputServerLog(&amp;quot;Public server IP: &amp;quot; .. getServerIp())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Credits==&lt;br /&gt;
* '''Author:''' MJNONFIK&lt;br /&gt;
* '''Edited by:''' CastiaL&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetServerIpFromMasterServer&amp;diff=81677</id>
		<title>GetServerIpFromMasterServer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetServerIpFromMasterServer&amp;diff=81677"/>
		<updated>2025-01-08T19:47:33Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22890|This function returns the remote address as reported by the first master server that provides this value.}}&lt;br /&gt;
{{Note|It might take a while until the master server responds to the query sent out by the server, which in turn means that this function will not return any IP until the information has been received.}}&lt;br /&gt;
{{Note|On client-side there is the [[getServerIp]] function, in case you need the remote address of the currently connected server.}}&lt;br /&gt;
{{Note|If you want to retrieve the server IP address from the server configuration, then you should use &amp;lt;code&amp;gt;getServerConfigSetting(&amp;quot;serverip&amp;quot;)&amp;lt;/code&amp;gt;, but this might yield only &amp;lt;code&amp;gt;&amp;quot;auto&amp;quot;&amp;lt;/code&amp;gt; if the default value was used.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getServerIpFromMasterServer ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string containing the remote address of the server as reported, once it's available.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a console command that outputs the server's IP to the chatbox.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputServerIp()&lt;br /&gt;
    outputChatBox(getServerIpFromMasterServer())&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;serverIp&amp;quot;, outputServerIp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetServerIpFromMasterServer&amp;diff=81676</id>
		<title>GetServerIpFromMasterServer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetServerIpFromMasterServer&amp;diff=81676"/>
		<updated>2025-01-08T19:45:59Z</updated>

		<summary type="html">&lt;p&gt;Botder: Created page with &amp;quot;__NOTOC__  {{Server function}} {{New feature/item|3.0161|1.6.0|22890|This function returns the remote address as reported by the first master server that provides this value.}} {{Note|It might take a while until the master server responds to the query sent out by the server, which in turn means that this function will not return any IP until the information has been received.}} {{Note|On client-side there is the getServerIp function, in case you need the remote addre...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22890|This function returns the remote address as reported by the first master server that provides this value.}}&lt;br /&gt;
{{Note|It might take a while until the master server responds to the query sent out by the server, which in turn means that this function will not return any IP until the information has been received.}}&lt;br /&gt;
{{Note|On client-side there is the [[getServerIp]] function, in case you need the remote address of the currently connected server.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getServerIpFromMasterServer ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string containing the remote address of the server as reported, once it's available.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a console command that outputs the server's IP to the chatbox.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputServerIp()&lt;br /&gt;
    outputChatBox(getServerIpFromMasterServer())&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;serverIp&amp;quot;, outputServerIp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Server_functions&amp;diff=81675</id>
		<title>Template:Server functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Server_functions&amp;diff=81675"/>
		<updated>2025-01-08T19:35:23Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getMaxPlayers]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getServerConfigSetting]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getServerHttpPort]]&amp;lt;/li&amp;gt;&lt;br /&gt;
{{New items|3.0161|1.6.0|&lt;br /&gt;
&amp;lt;li&amp;gt;[[getServerIpFromMasterServer]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|22890}}&lt;br /&gt;
&amp;lt;li&amp;gt;[[getServerName]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getServerPassword]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getServerPort]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[isGlitchEnabled]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setGlitchEnabled]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setMaxPlayers]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setServerConfigSetting]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setServerPassword]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[shutdown]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Functions templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Utility_functions&amp;diff=81674</id>
		<title>Template:Utility functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Utility_functions&amp;diff=81674"/>
		<updated>2025-01-08T19:33:08Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
{{#if: {{{1|}}}&lt;br /&gt;
 | {{#ifeq: {{lc:{{{1}}}}} | client&lt;br /&gt;
 |&lt;br /&gt;
    &amp;lt;!-- CLIENT functions --&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[createTrayNotification]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[downloadFile]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[getDevelopmentMode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[getKeyboardLayout]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[getLocalization]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    {{New items|3.0161|1.6.0|&lt;br /&gt;
    &amp;lt;li&amp;gt;[[getServerIp]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    |22890}}&lt;br /&gt;
    &amp;lt;li&amp;gt;[[isShowCollisionsEnabled]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[isShowSoundEnabled]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[isTransferBoxAlwaysVisible]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[isTransferBoxVisible]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[isTrayNotificationEnabled]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[setClipboard]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[setDevelopmentMode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[setTransferBoxVisible]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[setWindowFlashing]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[showCol]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[showSound]]&amp;lt;/li&amp;gt;&lt;br /&gt;
 | {{#ifeq: {{lc:{{{1}}}}} | server&lt;br /&gt;
 |&lt;br /&gt;
    &amp;lt;!-- SERVER functions --&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[setServerConfigSetting]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;[[getServerConfigSetting]]&amp;lt;/li&amp;gt;&lt;br /&gt;
    }}&lt;br /&gt;
  }}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;li style=&amp;quot;list-style: none; margin-left: -1.6em;&amp;quot;&amp;gt;'''Shared'''&amp;lt;/li&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- SHARED functions--&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[addDebugHook]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[base64Decode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[base64Encode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[debugSleep]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[decodeString]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[encodeString]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fromJSON]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[generateKeyPair]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getColorFromString]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getDevelopmentMode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getDistanceBetweenPoints2D]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getDistanceBetweenPoints3D]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getEasingValue]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getNetworkStats]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getNetworkUsageData]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getPerformanceStats]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getRealTime]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getTickCount]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getTimerDetails]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getTimers]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getFPSLimit]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getUserdataType]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getVersion]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[gettok]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[isTransferBoxVisible]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setTransferBoxVisible]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[hash]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[inspect]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[interpolateBetween]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[iprint]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[isOOPEnabled]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[isTimer]]&amp;lt;/li&amp;gt;&lt;br /&gt;
{{New items|3.0161|1.6.0|&lt;br /&gt;
&amp;lt;li&amp;gt;[[isTimerPaused]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setTimerPaused]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|22701}}&lt;br /&gt;
&amp;lt;li&amp;gt;[[killTimer]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[md5]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[passwordHash]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[passwordVerify]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[pregFind]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[pregMatch]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[pregReplace]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[removeDebugHook]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[resetTimer]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setDevelopmentMode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setFPSLimit]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[setTimer]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[ref]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[deref]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[sha256]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[split]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[teaDecode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[teaEncode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[toJSON]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[tocolor]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[getProcessMemoryStats]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[utfChar]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[utfCode]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[utfLen]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[utfSeek]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[utfSub]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
{{Bit_functions}}&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Functions list info}}&lt;br /&gt;
[[Category:Functions templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80069</id>
		<title>Resource Web Access</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80069"/>
		<updated>2024-08-25T14:32:30Z</updated>

		<summary type="html">&lt;p&gt;Botder: Add new-feature-item wrapper for router&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Multi Theft Auto Server provides a web interface that resources can use in a variety of ways. This document's purpose is to explain what these ways are and how to go about using them.&lt;br /&gt;
{{Note|If you are looking for a tutorial on how to use the in-game web browser and create websites using CEF, please visit [[CEF_Tutorial|CEF Tutorial]] instead.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
There are three key parts that make up this system.&lt;br /&gt;
* '''Pages:''' The ability to serve any http items (specified the meta.xml) as a page or file.&lt;br /&gt;
* '''Calls:''' The ability to call any exported http functions (specified in the meta.xml).&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22639|* '''Router:''' Use a designated http function to route requests within a resource manually (overriding the two parts above).}}&lt;br /&gt;
&lt;br /&gt;
==Pages==&lt;br /&gt;
===Specifying a file in the meta===&lt;br /&gt;
You can specify in your resource's meta file that certain files are accessible through the web server. To do this, you add a line:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;filename.ext&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can then access this file from your web browser by visiting: http://host:port/resourcename/filename.ext&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, on a locally hosted server using default http port with webmap started: http://127.0.0.1:22005/webmap/map.htm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Binary files===&lt;br /&gt;
Despite the misleading name, files specified using the html node can be of any type. If they are binary files (like images, zip files) then you need to specify this in the meta file, by adding ''raw=&amp;quot;true&amp;quot;'' to the ''html'' node. This means that the files are not preprocessed before being sent to the web browser.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;image.gif&amp;quot; raw=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parsed files===&lt;br /&gt;
If a file is not specified in the metafile as &amp;quot;raw&amp;quot;, then it is passed through a pre-processor before it is returned to the client. This pre-processor works much like PHP or ASP but uses Lua. You can embed standard MTA scripts within HTML pages, controlling the output. Almost all standard MTA functions work, plus a number of special [[Template:HTTP functions|HTTP Functions]], such as [[httpWrite]], a function that outputs text to the buffer.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* httpWrite( getResourceName(getThisResource()) ) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a shorthand (in common with PHP and ASP) for this code, meaning that you can also write the above code as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* = getResourceName(getThisResource()) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aside from HTTP functions, embedded Lua has access to the following environment variables that contain information about how the page was requested:&lt;br /&gt;
* table '''requestHeaders''': This is a table containing all the headers that were requested with the page. You can set returned headers using [[httpSetResponseHeader]]. &lt;br /&gt;
* table '''form''': This is a table containing all the form data submitted to the page using HTTP POST combined with any variables passed in the querystring with HTTP GET.&lt;br /&gt;
* table '''cookies''': This is a table of all the cookies. You can modify cookies using [[httpSetResponseCookie]].&lt;br /&gt;
* string '''hostname''': This is a string containing the IP address or hostname that requested the page.&lt;br /&gt;
* string '''url''': This is the URL of the page.&lt;br /&gt;
* account '''user''': This is the account of the current user.&lt;br /&gt;
{{New feature/item|3.0159|1.5.8|20828|&lt;br /&gt;
* string '''requestBody''': This is the request body.&lt;br /&gt;
* string '''method''': This is the request method.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It's important to note that parsed files are run in a separate virtual machine from the rest of your resource's code. As such, if you want to call a function in your resource's main code, you need to export the function and use the [[call]] function from your parsed file.&lt;br /&gt;
&lt;br /&gt;
==Calls==&lt;br /&gt;
You can specify that certain exported functions in your resource are able to be called from the HTTP interface. All the SDKs (listed below) allow you to call these functions from a remote location. &lt;br /&gt;
&lt;br /&gt;
To specify an exported http-accessible function, add the following to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function='functionName' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can code your function just as you would any normal function, returning as many values as you want, including tables and resources and most important elements. You ''cannot'' however return other 'userdata' values such as [[xmlnode|xmlnodes]] or functions.&lt;br /&gt;
&lt;br /&gt;
===Protocol===&lt;br /&gt;
{{Note|You don't need to know this unless you're writing your own HTTP request code. You can just use one of the [[#SDK|SDKs listed below]].}}&lt;br /&gt;
&lt;br /&gt;
Calls are done by requesting ''&amp;lt;nowiki&amp;gt;http://&amp;lt;your IP&amp;gt;:&amp;lt;your port&amp;gt;/&amp;lt;resource_name&amp;gt;/call/&amp;lt;exported_function_name&amp;gt;&amp;lt;/nowiki&amp;gt;'' using HTTP POST. The body of the request should be a JSON array of the arguments for the function.&lt;br /&gt;
&lt;br /&gt;
The request will return a JSON array of the value(s) returned from the function as the HTTP response.&lt;br /&gt;
&lt;br /&gt;
The server supports HTTP Basic authentication and you can configure access via the ACL and the built-in accounts system.&lt;br /&gt;
&lt;br /&gt;
===Calls from the HTTP web interface===&lt;br /&gt;
Using calls is probably easiest from the web interface and can be done almost seamlessly.&lt;br /&gt;
&lt;br /&gt;
First, add this to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Secondly, add the following to the &amp;lt;head&amp;gt; section of the page you want to call from:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you can create a javascript block on your page and call your functions almost as if they were local. The only difference is that the calls are asynchronous - you should specify a callback function as the last argument for your call. This is called when the function returns.&lt;br /&gt;
&lt;br /&gt;
Here's a simple example.&lt;br /&gt;
&lt;br /&gt;
'''meta.xml'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;script src='code.lua' /&amp;gt;&lt;br /&gt;
   &amp;lt;html src='page.htm' default='true' /&amp;gt;&lt;br /&gt;
   &amp;lt;export function='showChatMessage' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''code.lua'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showChatMessage ( message )&lt;br /&gt;
    outputChatBox ( message )&lt;br /&gt;
    return 5;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''page.htm'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
        &amp;lt;script type='text/javascript'&amp;gt;&lt;br /&gt;
            function say() {&lt;br /&gt;
                var message = document.getElementById('message')&lt;br /&gt;
                showChatMessage ( message.value, &lt;br /&gt;
                    function ( number ) {&lt;br /&gt;
                        // the function has been called and returned something&lt;br /&gt;
                        message.value = &amp;quot;The function returned &amp;quot; + number;&lt;br /&gt;
                    }&lt;br /&gt;
                );&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;input type='text' id='message' /&amp;gt;&amp;lt;input type='button' value='say' onclick='say();' /&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see (fairly complex) examples of how this can be done in the resources ''resourcebrowser'', ''resourcemanager'' and ''webadmin''.&lt;br /&gt;
&lt;br /&gt;
==Router==&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22639|&lt;br /&gt;
A router is a function that overrides both the function call mechanism and basic web server functionality, to allow a scripter to personalize the routing and client-response for each resource separately. For example, this allows a scripter to write an '''api''' named resource with a router function, that can serve any sort of information in a RESTy fashion. You may also take this further, and name the resource '''v1''' (or '''v2'''...) for easy API versioning. You can spin up and down the different resources as you wish, and users of your API can continue using an older version this way.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===How to setup a router function===&lt;br /&gt;
A router function has to be specified in the meta.xml (see example below). You can name the function however you like, there are no restrictions, as long as the function can be found in the global Lua scope in your scripts. '''Note:''' You can have only one router function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function=&amp;quot;httpRouter&amp;quot; http=&amp;quot;true&amp;quot; router=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you have to specify the function in any Lua script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 200 -- see below for a more complex return value&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Request===&lt;br /&gt;
This section describes all the fields, that can be found in the '''request''' table passed to the router function for every call. The descriptions below use the following example URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;http://127.0.0.1:22005/api/vehicles/123?meow=true&amp;lt;/code&amp;gt; ('''api''' is the resource name)&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; || [[Account]] || An account that was used for this request (can be a [[isGuestAccount|guest account]]).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; || [[string]] || One of the following: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PATCH, *&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;path&amp;lt;/code&amp;gt; || [[string]] || The requested path within your resource: &amp;lt;code&amp;gt;&amp;quot;/vehicles/123&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;absolute_path&amp;lt;/code&amp;gt; || [[string]] || The absolute path from the URL: &amp;lt;code&amp;gt;&amp;quot;/api/vehicles/123?meow=true&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; || [[string]] || The hostname of the web server: &amp;lt;code&amp;gt;&amp;quot;127.0.0.1&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;port&amp;lt;/code&amp;gt; || [[integer]] || The client port used by the web server: &amp;lt;code&amp;gt;56758&amp;lt;/code&amp;gt; (can be anything, but never 22005)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || The body portion of the request sent by the client&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;query&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the path's query fields (only query)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;formData&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request form data (both query and body fields)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request cookies&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request headers (like User-Agent)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
This section describes all the possible variants, that can be returned by the router function. There are three variants in total:&lt;br /&gt;
* Return literally nothing: response will use http status code ''200'' and an empty body.&lt;br /&gt;
* Return an [[integer]]: response will convert the number to an http status code and use an empty body.&lt;br /&gt;
* Return a table: response will be filled with the fields from the table (defaults to http status code ''200'' and empty body, if not overriden by a table field).&lt;br /&gt;
&lt;br /&gt;
====Response table fields====&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; || [[integer]] || A number that will be converted to an http status code.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || A string that will be used for the response body.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) that will be written to the header section of the response.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A table with simple [[string]] key and value entries, or any-type key with [[table]] values (key is not used), entries. Check the examples below, if it's unclear.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    -- HTTP status code 200 &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 404 --&amp;lt; HTTP status code &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 404,&lt;br /&gt;
        body = &amp;quot;not found&amp;quot;,&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 505,&lt;br /&gt;
        body = &amp;quot;foo&amp;quot;,&lt;br /&gt;
        cookies = {&lt;br /&gt;
            foo = &amp;quot;1234&amp;quot;,&lt;br /&gt;
            {&lt;br /&gt;
                name = &amp;quot;bar&amp;quot;,  -- Cookie name must always be a lowercase &amp;quot;name&amp;quot; key&lt;br /&gt;
                value = &amp;quot;6666&amp;quot;,  -- Cookie value must always be a lowercase &amp;quot;value&amp;quot; key&lt;br /&gt;
                Version = &amp;quot;2&amp;quot;,  -- Any other cookie field can use any case&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        headers = {&lt;br /&gt;
            [&amp;quot;content-type&amp;quot;] = &amp;quot;text/html&amp;quot;,&lt;br /&gt;
            [&amp;quot;etag&amp;quot;] = &amp;quot;c561c68d0ba92bbeb8b0f612a9199f722e3a621a&amp;quot;,&lt;br /&gt;
            [&amp;quot;access-control-allow-origin&amp;quot;] = &amp;quot;*&amp;quot;,&lt;br /&gt;
            [&amp;quot;x-custom-header&amp;quot;] = &amp;quot;MTA server&amp;quot;,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Securing the web interface==&lt;br /&gt;
The [[ACL]] has a number of rights that can affect what files can be accessed.&lt;br /&gt;
{{Deprecated feature|3.0139|1.3.1|&lt;br /&gt;
* general.http: If disabled, none of the HTTP files can be accessed (except by game clients)&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled, HTTP access to all resources (for that ACL) is enabled by default. To disable HTTP access you have to explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled on an ACL which has a user with no password (i.e. user.* or user.guest or user.http_guest), it is essential that you explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
* resource.'''ResourceName''': If disabled, none of the files in the resource can be accessed&lt;br /&gt;
* resource.'''ResourceName'''.file.'''FileName''': If disabled, the file named cannot be accessed&lt;br /&gt;
* resource.'''ResourceName'''.function.'''FunctionName''': If disabled, the function cannot be called&lt;br /&gt;
These work as with other ACL rights - you can disable them for normal users and just enable them for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
{{New_feature|3.0139|1.3.1|&lt;br /&gt;
* '''resource.ResourceName.http''': If enabled, the resource will be accessible from http://server_ip:22005/ResourceName/&lt;br /&gt;
This works as with other ACL rights - You can enable it just for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==SDK==&lt;br /&gt;
There are a number of so-called 'SDKs' available that allow you to interface with the server from other programming languages. With these, you could (in theory) write whole gamemodes. In practice, this is probably a bad idea, but it is useful for statistics and administration. The PHP SDK is the most developed version. Feel free to modify or create your own SDKs - if you do please send us a copy.&lt;br /&gt;
&lt;br /&gt;
* [[JavaSDK|Java SDK]]&lt;br /&gt;
* [[Javascript SDK]]&lt;br /&gt;
* [https://www.npmjs.com/package/mtasa Node.js SDK]&lt;br /&gt;
* [https://crates.io/crates/mta-sdk Rust SDK]&lt;br /&gt;
* [https://pypi.org/project/MTA-SDK-Python/ Python SDK]&lt;br /&gt;
* [[Perl SDK]]&lt;br /&gt;
* [[PHP SDK]]&lt;br /&gt;
* [[CSharp SDK|C# SDK]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[callRemote]] - Allows game servers to call functions on PHP pages (with the PHP SDK) and on other game servers.&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
&lt;br /&gt;
[[en:Resource Web Access]]&lt;br /&gt;
[[fr:Ressource Acces Internet]]&lt;br /&gt;
[[hu:Resource Web Access]]&lt;br /&gt;
[[pt-br:Acesso_web_via_recursos]]&lt;br /&gt;
[[ru:Resource Web Access]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80068</id>
		<title>Resource Web Access</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80068"/>
		<updated>2024-08-24T19:37:26Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Multi Theft Auto Server provides a web interface that resources can use in a variety of ways. This document's purpose is to explain what these ways are and how to go about using them.&lt;br /&gt;
{{Note|If you are looking for a tutorial on how to use the in-game web browser and create websites using CEF, please visit [[CEF_Tutorial|CEF Tutorial]] instead.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
There are three key parts that make up this system.&lt;br /&gt;
* '''Pages:''' The ability to serve any http items (specified the meta.xml) as a page or file.&lt;br /&gt;
* '''Calls:''' The ability to call any exported http functions (specified in the meta.xml).&lt;br /&gt;
* '''Router:''' Use a designated http function to route requests within a resource manually (overriding the two parts above).&lt;br /&gt;
&lt;br /&gt;
==Pages==&lt;br /&gt;
===Specifying a file in the meta===&lt;br /&gt;
You can specify in your resource's meta file that certain files are accessible through the web server. To do this, you add a line:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;filename.ext&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can then access this file from your web browser by visiting: http://host:port/resourcename/filename.ext&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, on a locally hosted server using default http port with webmap started: http://127.0.0.1:22005/webmap/map.htm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Binary files===&lt;br /&gt;
Despite the misleading name, files specified using the html node can be of any type. If they are binary files (like images, zip files) then you need to specify this in the meta file, by adding ''raw=&amp;quot;true&amp;quot;'' to the ''html'' node. This means that the files are not preprocessed before being sent to the web browser.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;image.gif&amp;quot; raw=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parsed files===&lt;br /&gt;
If a file is not specified in the metafile as &amp;quot;raw&amp;quot;, then it is passed through a pre-processor before it is returned to the client. This pre-processor works much like PHP or ASP but uses Lua. You can embed standard MTA scripts within HTML pages, controlling the output. Almost all standard MTA functions work, plus a number of special [[Template:HTTP functions|HTTP Functions]], such as [[httpWrite]], a function that outputs text to the buffer.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* httpWrite( getResourceName(getThisResource()) ) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a shorthand (in common with PHP and ASP) for this code, meaning that you can also write the above code as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* = getResourceName(getThisResource()) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aside from HTTP functions, embedded Lua has access to the following environment variables that contain information about how the page was requested:&lt;br /&gt;
* table '''requestHeaders''': This is a table containing all the headers that were requested with the page. You can set returned headers using [[httpSetResponseHeader]]. &lt;br /&gt;
* table '''form''': This is a table containing all the form data submitted to the page using HTTP POST combined with any variables passed in the querystring with HTTP GET.&lt;br /&gt;
* table '''cookies''': This is a table of all the cookies. You can modify cookies using [[httpSetResponseCookie]].&lt;br /&gt;
* string '''hostname''': This is a string containing the IP address or hostname that requested the page.&lt;br /&gt;
* string '''url''': This is the URL of the page.&lt;br /&gt;
* account '''user''': This is the account of the current user.&lt;br /&gt;
{{New feature/item|3.0159|1.5.8|20828|&lt;br /&gt;
* string '''requestBody''': This is the request body.&lt;br /&gt;
* string '''method''': This is the request method.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It's important to note that parsed files are run in a separate virtual machine from the rest of your resource's code. As such, if you want to call a function in your resource's main code, you need to export the function and use the [[call]] function from your parsed file.&lt;br /&gt;
&lt;br /&gt;
==Calls==&lt;br /&gt;
You can specify that certain exported functions in your resource are able to be called from the HTTP interface. All the SDKs (listed below) allow you to call these functions from a remote location. &lt;br /&gt;
&lt;br /&gt;
To specify an exported http-accessible function, add the following to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function='functionName' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can code your function just as you would any normal function, returning as many values as you want, including tables and resources and most important elements. You ''cannot'' however return other 'userdata' values such as [[xmlnode|xmlnodes]] or functions.&lt;br /&gt;
&lt;br /&gt;
===Protocol===&lt;br /&gt;
{{Note|You don't need to know this unless you're writing your own HTTP request code. You can just use one of the [[#SDK|SDKs listed below]].}}&lt;br /&gt;
&lt;br /&gt;
Calls are done by requesting ''&amp;lt;nowiki&amp;gt;http://&amp;lt;your IP&amp;gt;:&amp;lt;your port&amp;gt;/&amp;lt;resource_name&amp;gt;/call/&amp;lt;exported_function_name&amp;gt;&amp;lt;/nowiki&amp;gt;'' using HTTP POST. The body of the request should be a JSON array of the arguments for the function.&lt;br /&gt;
&lt;br /&gt;
The request will return a JSON array of the value(s) returned from the function as the HTTP response.&lt;br /&gt;
&lt;br /&gt;
The server supports HTTP Basic authentication and you can configure access via the ACL and the built-in accounts system.&lt;br /&gt;
&lt;br /&gt;
===Calls from the HTTP web interface===&lt;br /&gt;
Using calls is probably easiest from the web interface and can be done almost seamlessly.&lt;br /&gt;
&lt;br /&gt;
First, add this to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Secondly, add the following to the &amp;lt;head&amp;gt; section of the page you want to call from:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you can create a javascript block on your page and call your functions almost as if they were local. The only difference is that the calls are asynchronous - you should specify a callback function as the last argument for your call. This is called when the function returns.&lt;br /&gt;
&lt;br /&gt;
Here's a simple example.&lt;br /&gt;
&lt;br /&gt;
'''meta.xml'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;script src='code.lua' /&amp;gt;&lt;br /&gt;
   &amp;lt;html src='page.htm' default='true' /&amp;gt;&lt;br /&gt;
   &amp;lt;export function='showChatMessage' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''code.lua'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showChatMessage ( message )&lt;br /&gt;
    outputChatBox ( message )&lt;br /&gt;
    return 5;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''page.htm'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
        &amp;lt;script type='text/javascript'&amp;gt;&lt;br /&gt;
            function say() {&lt;br /&gt;
                var message = document.getElementById('message')&lt;br /&gt;
                showChatMessage ( message.value, &lt;br /&gt;
                    function ( number ) {&lt;br /&gt;
                        // the function has been called and returned something&lt;br /&gt;
                        message.value = &amp;quot;The function returned &amp;quot; + number;&lt;br /&gt;
                    }&lt;br /&gt;
                );&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;input type='text' id='message' /&amp;gt;&amp;lt;input type='button' value='say' onclick='say();' /&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see (fairly complex) examples of how this can be done in the resources ''resourcebrowser'', ''resourcemanager'' and ''webadmin''.&lt;br /&gt;
&lt;br /&gt;
==Router==&lt;br /&gt;
A router is a function that overrides both the function call mechanism and basic web server functionality, to allow a scripter to personalize the routing and client-response for each resource separately. For example, this allows a scripter to write an '''api''' named resource with a router function, that can serve any sort of information in a RESTy fashion. You may also take this further, and name the resource '''v1''' (or '''v2'''...) for easy API versioning. You can spin up and down the different resources as you wish, and users of your API can continue using an older version this way.&lt;br /&gt;
&lt;br /&gt;
===How to setup a router function===&lt;br /&gt;
A router function has to be specified in the meta.xml (see example below). You can name the function however you like, there are no restrictions, as long as the function can be found in the global Lua scope in your scripts. '''Note:''' You can have only one router function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function=&amp;quot;httpRouter&amp;quot; http=&amp;quot;true&amp;quot; router=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you have to specify the function in any Lua script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 200 -- see below for a more complex return value&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Request===&lt;br /&gt;
This section describes all the fields, that can be found in the '''request''' table passed to the router function for every call. The descriptions below use the following example URL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;http://127.0.0.1:22005/api/vehicles/123?meow=true&amp;lt;/code&amp;gt; ('''api''' is the resource name)&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; || [[Account]] || An account that was used for this request (can be a [[isGuestAccount|guest account]]).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; || [[string]] || One of the following: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PATCH, *&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;path&amp;lt;/code&amp;gt; || [[string]] || The requested path within your resource: &amp;lt;code&amp;gt;&amp;quot;/vehicles/123&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;absolute_path&amp;lt;/code&amp;gt; || [[string]] || The absolute path from the URL: &amp;lt;code&amp;gt;&amp;quot;/api/vehicles/123?meow=true&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; || [[string]] || The hostname of the web server: &amp;lt;code&amp;gt;&amp;quot;127.0.0.1&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;port&amp;lt;/code&amp;gt; || [[integer]] || The client port used by the web server: &amp;lt;code&amp;gt;56758&amp;lt;/code&amp;gt; (can be anything, but never 22005)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || The body portion of the request sent by the client&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;query&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the path's query fields (only query)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;formData&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request form data (both query and body fields)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request cookies&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request headers (like User-Agent)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
This section describes all the possible variants, that can be returned by the router function. There are three variants in total:&lt;br /&gt;
* Return literally nothing: response will use http status code ''200'' and an empty body.&lt;br /&gt;
* Return an [[integer]]: response will convert the number to an http status code and use an empty body.&lt;br /&gt;
* Return a table: response will be filled with the fields from the table (defaults to http status code ''200'' and empty body, if not overriden by a table field).&lt;br /&gt;
&lt;br /&gt;
====Response table fields====&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; || [[integer]] || A number that will be converted to an http status code.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || A string that will be used for the response body.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) that will be written to the header section of the response.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A table with simple [[string]] key and value entries, or any-type key with [[table]] values (key is not used), entries. Check the examples below, if it's unclear.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    -- HTTP status code 200 &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 404 --&amp;lt; HTTP status code &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 404,&lt;br /&gt;
        body = &amp;quot;not found&amp;quot;,&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 505,&lt;br /&gt;
        body = &amp;quot;foo&amp;quot;,&lt;br /&gt;
        cookies = {&lt;br /&gt;
            foo = &amp;quot;1234&amp;quot;,&lt;br /&gt;
            {&lt;br /&gt;
                name = &amp;quot;bar&amp;quot;,  -- Cookie name must always be a lowercase &amp;quot;name&amp;quot; key&lt;br /&gt;
                value = &amp;quot;6666&amp;quot;,  -- Cookie value must always be a lowercase &amp;quot;value&amp;quot; key&lt;br /&gt;
                Version = &amp;quot;2&amp;quot;,  -- Any other cookie field can use any case&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        headers = {&lt;br /&gt;
            [&amp;quot;content-type&amp;quot;] = &amp;quot;text/html&amp;quot;,&lt;br /&gt;
            [&amp;quot;etag&amp;quot;] = &amp;quot;c561c68d0ba92bbeb8b0f612a9199f722e3a621a&amp;quot;,&lt;br /&gt;
            [&amp;quot;access-control-allow-origin&amp;quot;] = &amp;quot;*&amp;quot;,&lt;br /&gt;
            [&amp;quot;x-custom-header&amp;quot;] = &amp;quot;MTA server&amp;quot;,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Securing the web interface==&lt;br /&gt;
The [[ACL]] has a number of rights that can affect what files can be accessed.&lt;br /&gt;
{{Deprecated feature|3.0139|1.3.1|&lt;br /&gt;
* general.http: If disabled, none of the HTTP files can be accessed (except by game clients)&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled, HTTP access to all resources (for that ACL) is enabled by default. To disable HTTP access you have to explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled on an ACL which has a user with no password (i.e. user.* or user.guest or user.http_guest), it is essential that you explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
* resource.'''ResourceName''': If disabled, none of the files in the resource can be accessed&lt;br /&gt;
* resource.'''ResourceName'''.file.'''FileName''': If disabled, the file named cannot be accessed&lt;br /&gt;
* resource.'''ResourceName'''.function.'''FunctionName''': If disabled, the function cannot be called&lt;br /&gt;
These work as with other ACL rights - you can disable them for normal users and just enable them for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
{{New_feature|3.0139|1.3.1|&lt;br /&gt;
* '''resource.ResourceName.http''': If enabled, the resource will be accessible from http://server_ip:22005/ResourceName/&lt;br /&gt;
This works as with other ACL rights - You can enable it just for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==SDK==&lt;br /&gt;
There are a number of so-called 'SDKs' available that allow you to interface with the server from other programming languages. With these, you could (in theory) write whole gamemodes. In practice, this is probably a bad idea, but it is useful for statistics and administration. The PHP SDK is the most developed version. Feel free to modify or create your own SDKs - if you do please send us a copy.&lt;br /&gt;
&lt;br /&gt;
* [[JavaSDK|Java SDK]]&lt;br /&gt;
* [[Javascript SDK]]&lt;br /&gt;
* [https://www.npmjs.com/package/mtasa Node.js SDK]&lt;br /&gt;
* [https://crates.io/crates/mta-sdk Rust SDK]&lt;br /&gt;
* [https://pypi.org/project/MTA-SDK-Python/ Python SDK]&lt;br /&gt;
* [[Perl SDK]]&lt;br /&gt;
* [[PHP SDK]]&lt;br /&gt;
* [[CSharp SDK|C# SDK]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[callRemote]] - Allows game servers to call functions on PHP pages (with the PHP SDK) and on other game servers.&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
&lt;br /&gt;
[[en:Resource Web Access]]&lt;br /&gt;
[[fr:Ressource Acces Internet]]&lt;br /&gt;
[[hu:Resource Web Access]]&lt;br /&gt;
[[pt-br:Acesso_web_via_recursos]]&lt;br /&gt;
[[ru:Resource Web Access]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80067</id>
		<title>Resource Web Access</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80067"/>
		<updated>2024-08-24T19:36:27Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Multi Theft Auto Server provides a web interface that resources can use in a variety of ways. This document's purpose is to explain what these ways are and how to go about using them.&lt;br /&gt;
{{Note|If you are looking for a tutorial on how to use the in-game web browser and create websites using CEF, please visit [[CEF_Tutorial|CEF Tutorial]] instead.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
There are three key parts that make up this system.&lt;br /&gt;
* '''Pages:''' The ability to serve any http items (specified the meta.xml) as a page or file.&lt;br /&gt;
* '''Calls:''' The ability to call any exported http functions (specified in the meta.xml).&lt;br /&gt;
* '''Router:''' Use a designated http function to route requests within a resource manually (overriding the two parts above).&lt;br /&gt;
&lt;br /&gt;
==Pages==&lt;br /&gt;
===Specifying a file in the meta===&lt;br /&gt;
You can specify in your resource's meta file that certain files are accessible through the web server. To do this, you add a line:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;filename.ext&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can then access this file from your web browser by visiting: http://host:port/resourcename/filename.ext&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, on a locally hosted server using default http port with webmap started: http://127.0.0.1:22005/webmap/map.htm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Binary files===&lt;br /&gt;
Despite the misleading name, files specified using the html node can be of any type. If they are binary files (like images, zip files) then you need to specify this in the meta file, by adding ''raw=&amp;quot;true&amp;quot;'' to the ''html'' node. This means that the files are not preprocessed before being sent to the web browser.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;image.gif&amp;quot; raw=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parsed files===&lt;br /&gt;
If a file is not specified in the metafile as &amp;quot;raw&amp;quot;, then it is passed through a pre-processor before it is returned to the client. This pre-processor works much like PHP or ASP but uses Lua. You can embed standard MTA scripts within HTML pages, controlling the output. Almost all standard MTA functions work, plus a number of special [[Template:HTTP functions|HTTP Functions]], such as [[httpWrite]], a function that outputs text to the buffer.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* httpWrite( getResourceName(getThisResource()) ) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a shorthand (in common with PHP and ASP) for this code, meaning that you can also write the above code as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* = getResourceName(getThisResource()) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aside from HTTP functions, embedded Lua has access to the following environment variables that contain information about how the page was requested:&lt;br /&gt;
* table '''requestHeaders''': This is a table containing all the headers that were requested with the page. You can set returned headers using [[httpSetResponseHeader]]. &lt;br /&gt;
* table '''form''': This is a table containing all the form data submitted to the page using HTTP POST combined with any variables passed in the querystring with HTTP GET.&lt;br /&gt;
* table '''cookies''': This is a table of all the cookies. You can modify cookies using [[httpSetResponseCookie]].&lt;br /&gt;
* string '''hostname''': This is a string containing the IP address or hostname that requested the page.&lt;br /&gt;
* string '''url''': This is the URL of the page.&lt;br /&gt;
* account '''user''': This is the account of the current user.&lt;br /&gt;
{{New feature/item|3.0159|1.5.8|20828|&lt;br /&gt;
* string '''requestBody''': This is the request body.&lt;br /&gt;
* string '''method''': This is the request method.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It's important to note that parsed files are run in a separate virtual machine from the rest of your resource's code. As such, if you want to call a function in your resource's main code, you need to export the function and use the [[call]] function from your parsed file.&lt;br /&gt;
&lt;br /&gt;
==Calls==&lt;br /&gt;
You can specify that certain exported functions in your resource are able to be called from the HTTP interface. All the SDKs (listed below) allow you to call these functions from a remote location. &lt;br /&gt;
&lt;br /&gt;
To specify an exported http-accessible function, add the following to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function='functionName' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can code your function just as you would any normal function, returning as many values as you want, including tables and resources and most important elements. You ''cannot'' however return other 'userdata' values such as [[xmlnode|xmlnodes]] or functions.&lt;br /&gt;
&lt;br /&gt;
===Protocol===&lt;br /&gt;
{{Note|You don't need to know this unless you're writing your own HTTP request code. You can just use one of the [[#SDK|SDKs listed below]].}}&lt;br /&gt;
&lt;br /&gt;
Calls are done by requesting ''&amp;lt;nowiki&amp;gt;http://&amp;lt;your IP&amp;gt;:&amp;lt;your port&amp;gt;/&amp;lt;resource_name&amp;gt;/call/&amp;lt;exported_function_name&amp;gt;&amp;lt;/nowiki&amp;gt;'' using HTTP POST. The body of the request should be a JSON array of the arguments for the function.&lt;br /&gt;
&lt;br /&gt;
The request will return a JSON array of the value(s) returned from the function as the HTTP response.&lt;br /&gt;
&lt;br /&gt;
The server supports HTTP Basic authentication and you can configure access via the ACL and the built-in accounts system.&lt;br /&gt;
&lt;br /&gt;
===Calls from the HTTP web interface===&lt;br /&gt;
Using calls is probably easiest from the web interface and can be done almost seamlessly.&lt;br /&gt;
&lt;br /&gt;
First, add this to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Secondly, add the following to the &amp;lt;head&amp;gt; section of the page you want to call from:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you can create a javascript block on your page and call your functions almost as if they were local. The only difference is that the calls are asynchronous - you should specify a callback function as the last argument for your call. This is called when the function returns.&lt;br /&gt;
&lt;br /&gt;
Here's a simple example.&lt;br /&gt;
&lt;br /&gt;
'''meta.xml'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;script src='code.lua' /&amp;gt;&lt;br /&gt;
   &amp;lt;html src='page.htm' default='true' /&amp;gt;&lt;br /&gt;
   &amp;lt;export function='showChatMessage' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''code.lua'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showChatMessage ( message )&lt;br /&gt;
    outputChatBox ( message )&lt;br /&gt;
    return 5;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''page.htm'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
        &amp;lt;script type='text/javascript'&amp;gt;&lt;br /&gt;
            function say() {&lt;br /&gt;
                var message = document.getElementById('message')&lt;br /&gt;
                showChatMessage ( message.value, &lt;br /&gt;
                    function ( number ) {&lt;br /&gt;
                        // the function has been called and returned something&lt;br /&gt;
                        message.value = &amp;quot;The function returned &amp;quot; + number;&lt;br /&gt;
                    }&lt;br /&gt;
                );&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;input type='text' id='message' /&amp;gt;&amp;lt;input type='button' value='say' onclick='say();' /&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see (fairly complex) examples of how this can be done in the resources ''resourcebrowser'', ''resourcemanager'' and ''webadmin''.&lt;br /&gt;
&lt;br /&gt;
==Router==&lt;br /&gt;
A router is a function that overrides both the function call mechanism and basic web server functionality, to allow a scripter to personalize the routing and client-response for each resource separately. For example, this allows a scripter to write an '''api''' named resource with a router function, that can serve any sort of information in a RESTy fashion. You may also take this further, and name the resource '''v1''' (or '''v2'''...) for easy API versioning. You can spin up and down the different resources as you wish, and users of your API can continue using an older version this way.&lt;br /&gt;
&lt;br /&gt;
===How to setup a router function===&lt;br /&gt;
A router function has to be specified in the meta.xml (see example below). You can name the function however you like, there are no restrictions, as long as the function can be found in the global Lua scope in your scripts. '''Note:''' You can have only one router function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function=&amp;quot;httpRouter&amp;quot; http=&amp;quot;true&amp;quot; router=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you have to specify the function in any Lua script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 200 -- see below for a more complex return value&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Request===&lt;br /&gt;
This section describes all the fields, that can be found in the '''request''' table passed to the router function for every call. The descriptions below use the following example URL for the descriptions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;http://127.0.0.1:22005/api/vehicles/123?meow=true&amp;lt;/code&amp;gt; ('''api''' is the resource name)&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; || [[Account]] || An account that was used for this request (can be a [[isGuestAccount|guest account]]).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; || [[string]] || One of the following: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PATCH, *&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;path&amp;lt;/code&amp;gt; || [[string]] || The requested path within your resource: &amp;lt;code&amp;gt;&amp;quot;/vehicles/123&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;absolute_path&amp;lt;/code&amp;gt; || [[string]] || The absolute path from the URL: &amp;lt;code&amp;gt;&amp;quot;/api/vehicles/123?meow=true&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; || [[string]] || The hostname of the web server: &amp;lt;code&amp;gt;&amp;quot;127.0.0.1&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;port&amp;lt;/code&amp;gt; || [[integer]] || The client port used by the web server: &amp;lt;code&amp;gt;56758&amp;lt;/code&amp;gt; (can be anything, but never 22005)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || The body portion of the request sent by the client&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;query&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the path's query fields (only query)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;formData&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request form data (both query and body fields)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request cookies&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request headers (like User-Agent)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
This section describes all the possible variants, that can be returned by the router function. There are three variants in total:&lt;br /&gt;
* Return literally nothing: response will use http status code ''200'' and an empty body.&lt;br /&gt;
* Return an [[integer]]: response will convert the number to an http status code and use an empty body.&lt;br /&gt;
* Return a table: response will be filled with the fields from the table (defaults to http status code ''200'' and empty body, if not overriden by a table field).&lt;br /&gt;
&lt;br /&gt;
====Response table fields====&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; || [[integer]] || A number that will be converted to an http status code.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || A string that will be used for the response body.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) that will be written to the header section of the response.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A table with simple [[string]] key and value entries, or any-type key with [[table]] values (key is not used), entries. Check the examples below, if it's unclear.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    -- HTTP status code 200 &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 404 --&amp;lt; HTTP status code &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 404,&lt;br /&gt;
        body = &amp;quot;not found&amp;quot;,&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 505,&lt;br /&gt;
        body = &amp;quot;foo&amp;quot;,&lt;br /&gt;
        cookies = {&lt;br /&gt;
            foo = &amp;quot;1234&amp;quot;,&lt;br /&gt;
            {&lt;br /&gt;
                name = &amp;quot;bar&amp;quot;,  -- Cookie name must always be a lowercase &amp;quot;name&amp;quot; key&lt;br /&gt;
                value = &amp;quot;6666&amp;quot;,  -- Cookie value must always be a lowercase &amp;quot;value&amp;quot; key&lt;br /&gt;
                Version = &amp;quot;2&amp;quot;,  -- Any other cookie field can use any case&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        headers = {&lt;br /&gt;
            [&amp;quot;content-type&amp;quot;] = &amp;quot;text/html&amp;quot;,&lt;br /&gt;
            [&amp;quot;etag&amp;quot;] = &amp;quot;c561c68d0ba92bbeb8b0f612a9199f722e3a621a&amp;quot;,&lt;br /&gt;
            [&amp;quot;access-control-allow-origin&amp;quot;] = &amp;quot;*&amp;quot;,&lt;br /&gt;
            [&amp;quot;x-custom-header&amp;quot;] = &amp;quot;MTA server&amp;quot;,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Securing the web interface==&lt;br /&gt;
The [[ACL]] has a number of rights that can affect what files can be accessed.&lt;br /&gt;
{{Deprecated feature|3.0139|1.3.1|&lt;br /&gt;
* general.http: If disabled, none of the HTTP files can be accessed (except by game clients)&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled, HTTP access to all resources (for that ACL) is enabled by default. To disable HTTP access you have to explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled on an ACL which has a user with no password (i.e. user.* or user.guest or user.http_guest), it is essential that you explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
* resource.'''ResourceName''': If disabled, none of the files in the resource can be accessed&lt;br /&gt;
* resource.'''ResourceName'''.file.'''FileName''': If disabled, the file named cannot be accessed&lt;br /&gt;
* resource.'''ResourceName'''.function.'''FunctionName''': If disabled, the function cannot be called&lt;br /&gt;
These work as with other ACL rights - you can disable them for normal users and just enable them for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
{{New_feature|3.0139|1.3.1|&lt;br /&gt;
* '''resource.ResourceName.http''': If enabled, the resource will be accessible from http://server_ip:22005/ResourceName/&lt;br /&gt;
This works as with other ACL rights - You can enable it just for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==SDK==&lt;br /&gt;
There are a number of so-called 'SDKs' available that allow you to interface with the server from other programming languages. With these, you could (in theory) write whole gamemodes. In practice, this is probably a bad idea, but it is useful for statistics and administration. The PHP SDK is the most developed version. Feel free to modify or create your own SDKs - if you do please send us a copy.&lt;br /&gt;
&lt;br /&gt;
* [[JavaSDK|Java SDK]]&lt;br /&gt;
* [[Javascript SDK]]&lt;br /&gt;
* [https://www.npmjs.com/package/mtasa Node.js SDK]&lt;br /&gt;
* [https://crates.io/crates/mta-sdk Rust SDK]&lt;br /&gt;
* [https://pypi.org/project/MTA-SDK-Python/ Python SDK]&lt;br /&gt;
* [[Perl SDK]]&lt;br /&gt;
* [[PHP SDK]]&lt;br /&gt;
* [[CSharp SDK|C# SDK]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[callRemote]] - Allows game servers to call functions on PHP pages (with the PHP SDK) and on other game servers.&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
&lt;br /&gt;
[[en:Resource Web Access]]&lt;br /&gt;
[[fr:Ressource Acces Internet]]&lt;br /&gt;
[[hu:Resource Web Access]]&lt;br /&gt;
[[pt-br:Acesso_web_via_recursos]]&lt;br /&gt;
[[ru:Resource Web Access]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80066</id>
		<title>Resource Web Access</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=80066"/>
		<updated>2024-08-24T19:34:23Z</updated>

		<summary type="html">&lt;p&gt;Botder: Add HTTP router function information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Multi Theft Auto Server provides a web interface that resources can use in a variety of ways. This document's purpose is to explain what these ways are and how to go about using them.&lt;br /&gt;
{{Note|If you are looking for a tutorial on how to use the in-game web browser and create websites using CEF, please visit [[CEF_Tutorial|CEF Tutorial]] instead.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
There are three key parts that make up this system.&lt;br /&gt;
* '''Pages:''' The ability to serve any http items (specified the meta.xml) as a page or file.&lt;br /&gt;
* '''Calls:''' The ability to call any exported http functions (specified in the meta.xml).&lt;br /&gt;
* '''Router:''' Use a designated http function to route requests within a resource manually (overriding the two parts above).&lt;br /&gt;
&lt;br /&gt;
==Pages==&lt;br /&gt;
===Specifying a file in the meta===&lt;br /&gt;
You can specify in your resource's meta file that certain files are accessible through the web server. To do this, you add a line:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;filename.ext&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can then access this file from your web browser by visiting: http://host:port/resourcename/filename.ext&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, on a locally hosted server using default http port with webmap started: http://127.0.0.1:22005/webmap/map.htm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Binary files===&lt;br /&gt;
Despite the misleading name, files specified using the html node can be of any type. If they are binary files (like images, zip files) then you need to specify this in the meta file, by adding ''raw=&amp;quot;true&amp;quot;'' to the ''html'' node. This means that the files are not preprocessed before being sent to the web browser.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;image.gif&amp;quot; raw=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parsed files===&lt;br /&gt;
If a file is not specified in the metafile as &amp;quot;raw&amp;quot;, then it is passed through a pre-processor before it is returned to the client. This pre-processor works much like PHP or ASP but uses Lua. You can embed standard MTA scripts within HTML pages, controlling the output. Almost all standard MTA functions work, plus a number of special [[Template:HTTP functions|HTTP Functions]], such as [[httpWrite]], a function that outputs text to the buffer.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* httpWrite( getResourceName(getThisResource()) ) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a shorthand (in common with PHP and ASP) for this code, meaning that you can also write the above code as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* = getResourceName(getThisResource()) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aside from HTTP functions, embedded Lua has access to the following environment variables that contain information about how the page was requested:&lt;br /&gt;
* table '''requestHeaders''': This is a table containing all the headers that were requested with the page. You can set returned headers using [[httpSetResponseHeader]]. &lt;br /&gt;
* table '''form''': This is a table containing all the form data submitted to the page using HTTP POST combined with any variables passed in the querystring with HTTP GET.&lt;br /&gt;
* table '''cookies''': This is a table of all the cookies. You can modify cookies using [[httpSetResponseCookie]].&lt;br /&gt;
* string '''hostname''': This is a string containing the IP address or hostname that requested the page.&lt;br /&gt;
* string '''url''': This is the URL of the page.&lt;br /&gt;
* account '''user''': This is the account of the current user.&lt;br /&gt;
{{New feature/item|3.0159|1.5.8|20828|&lt;br /&gt;
* string '''requestBody''': This is the request body.&lt;br /&gt;
* string '''method''': This is the request method.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It's important to note that parsed files are run in a separate virtual machine from the rest of your resource's code. As such, if you want to call a function in your resource's main code, you need to export the function and use the [[call]] function from your parsed file.&lt;br /&gt;
&lt;br /&gt;
==Calls==&lt;br /&gt;
You can specify that certain exported functions in your resource are able to be called from the HTTP interface. All the SDKs (listed below) allow you to call these functions from a remote location. &lt;br /&gt;
&lt;br /&gt;
To specify an exported http-accessible function, add the following to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function='functionName' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can code your function just as you would any normal function, returning as many values as you want, including tables and resources and most important elements. You ''cannot'' however return other 'userdata' values such as [[xmlnode|xmlnodes]] or functions.&lt;br /&gt;
&lt;br /&gt;
===Protocol===&lt;br /&gt;
{{Note|You don't need to know this unless you're writing your own HTTP request code. You can just use one of the [[#SDK|SDKs listed below]].}}&lt;br /&gt;
&lt;br /&gt;
Calls are done by requesting ''&amp;lt;nowiki&amp;gt;http://&amp;lt;your IP&amp;gt;:&amp;lt;your port&amp;gt;/&amp;lt;resource_name&amp;gt;/call/&amp;lt;exported_function_name&amp;gt;&amp;lt;/nowiki&amp;gt;'' using HTTP POST. The body of the request should be a JSON array of the arguments for the function.&lt;br /&gt;
&lt;br /&gt;
The request will return a JSON array of the value(s) returned from the function as the HTTP response.&lt;br /&gt;
&lt;br /&gt;
The server supports HTTP Basic authentication and you can configure access via the ACL and the built-in accounts system.&lt;br /&gt;
&lt;br /&gt;
===Calls from the HTTP web interface===&lt;br /&gt;
Using calls is probably easiest from the web interface and can be done almost seamlessly.&lt;br /&gt;
&lt;br /&gt;
First, add this to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Secondly, add the following to the &amp;lt;head&amp;gt; section of the page you want to call from:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you can create a javascript block on your page and call your functions almost as if they were local. The only difference is that the calls are asynchronous - you should specify a callback function as the last argument for your call. This is called when the function returns.&lt;br /&gt;
&lt;br /&gt;
Here's a simple example.&lt;br /&gt;
&lt;br /&gt;
'''meta.xml'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;script src='code.lua' /&amp;gt;&lt;br /&gt;
   &amp;lt;html src='page.htm' default='true' /&amp;gt;&lt;br /&gt;
   &amp;lt;export function='showChatMessage' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''code.lua'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showChatMessage ( message )&lt;br /&gt;
    outputChatBox ( message )&lt;br /&gt;
    return 5;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''page.htm'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;* = exports.ajax:start(getResourceName(getThisResource())) *&amp;gt;&lt;br /&gt;
        &amp;lt;script type='text/javascript'&amp;gt;&lt;br /&gt;
            function say() {&lt;br /&gt;
                var message = document.getElementById('message')&lt;br /&gt;
                showChatMessage ( message.value, &lt;br /&gt;
                    function ( number ) {&lt;br /&gt;
                        // the function has been called and returned something&lt;br /&gt;
                        message.value = &amp;quot;The function returned &amp;quot; + number;&lt;br /&gt;
                    }&lt;br /&gt;
                );&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;input type='text' id='message' /&amp;gt;&amp;lt;input type='button' value='say' onclick='say();' /&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see (fairly complex) examples of how this can be done in the resources ''resourcebrowser'', ''resourcemanager'' and ''webadmin''.&lt;br /&gt;
&lt;br /&gt;
==Router==&lt;br /&gt;
A router is a function that overrides both the function call mechanism and basic web server functionality, to allow a scripter to personalize the routing and client-response for a single resource. For example, this allows a scripter to write an '''api''' named resource with a router function, that can serve any sort of information in a RESTy fashion. You may also take this further, and name the resource '''v1''' (or '''v2'''...) for easy API versioning. You can spin up and down the different resources as you wish, and users of your API can continue using an older version this way.&lt;br /&gt;
&lt;br /&gt;
===How to setup a router function===&lt;br /&gt;
A router function has to be specified in the meta.xml (see example below). You can name the function however you like, there are no restrictions, as long as the function can be found in the global Lua scope in your scripts. '''Note:''' You can have only one router function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function=&amp;quot;httpRouter&amp;quot; http=&amp;quot;true&amp;quot; router=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you have to specify the function in any Lua script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 200 -- see below for a more complex return value&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Request===&lt;br /&gt;
This section describes all the fields, that can be found in the '''request''' table passed to the router function for every call. The descriptions below use the following example URL for the descriptions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;http://127.0.0.1:22005/api/vehicles/123?meow=true&amp;lt;/code&amp;gt; ('''api''' is the resource name)&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; || [[Account]] || An account that was used for this request (can be a [[isGuestAccount|guest account]]).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt; || [[string]] || One of the following: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PATCH, *&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;path&amp;lt;/code&amp;gt; || [[string]] || The requested path within your resource: &amp;lt;code&amp;gt;&amp;quot;/vehicles/123&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;absolute_path&amp;lt;/code&amp;gt; || [[string]] || The absolute path from the URL: &amp;lt;code&amp;gt;&amp;quot;/api/vehicles/123?meow=true&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; || [[string]] || The hostname of the web server: &amp;lt;code&amp;gt;&amp;quot;127.0.0.1&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;port&amp;lt;/code&amp;gt; || [[integer]] || The client port used by the web server: &amp;lt;code&amp;gt;56758&amp;lt;/code&amp;gt; (can be anything, but never 22005)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || The body portion of the request sent by the client&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;query&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the path's query fields (only query)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;formData&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request form data (both query and body fields)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request cookies&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) with the request headers (like User-Agent)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
This section describes all the possible variants, that can be returned by the router function. There are three variants in total:&lt;br /&gt;
* Return literally nothing: response will use http status code ''200'' and an empty body.&lt;br /&gt;
* Return an [[integer]]: response will convert the number to an http status code and use an empty body.&lt;br /&gt;
* Return a table: response will be filled with the fields from the table (defaults to http status code ''200'' and empty body, if not overriden by a table field).&lt;br /&gt;
&lt;br /&gt;
====Response table fields====&lt;br /&gt;
&lt;br /&gt;
{|  class=&amp;quot;prettytable&amp;quot; style=&amp;quot;width:100%;text-align:left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field || Type || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt; || [[integer]] || A number that will be converted to an http status code.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; || [[string]] || A string that will be used for the response body.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;headers&amp;lt;/code&amp;gt; || [[table]] || A key-value table (with [[string]] keys and values) that will be written to the header section of the response.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cookies&amp;lt;/code&amp;gt; || [[table]] || A table with simple [[string]] key and value entries, or any-type key with [[table]] values (key is not used), entries. Check the examples below, if it's unclear.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    -- HTTP status code 200 &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return 404 --&amp;lt; HTTP status code &amp;amp; empty body&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 404,&lt;br /&gt;
        body = &amp;quot;not found&amp;quot;,&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function httpRouter(request)&lt;br /&gt;
    return {&lt;br /&gt;
        status = 505,&lt;br /&gt;
        body = &amp;quot;foo&amp;quot;,&lt;br /&gt;
        cookies = {&lt;br /&gt;
            foo = &amp;quot;1234&amp;quot;,&lt;br /&gt;
            {&lt;br /&gt;
                name = &amp;quot;bar&amp;quot;,  -- Cookie name must always be a lowercase &amp;quot;name&amp;quot; key&lt;br /&gt;
                value = &amp;quot;6666&amp;quot;,  -- Cookie value must always be a lowercase &amp;quot;value&amp;quot; key&lt;br /&gt;
                Version = &amp;quot;2&amp;quot;,  -- Any other cookie field can use any case&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        headers = {&lt;br /&gt;
            [&amp;quot;content-type&amp;quot;] = &amp;quot;text/html&amp;quot;,&lt;br /&gt;
            [&amp;quot;etag&amp;quot;] = &amp;quot;c561c68d0ba92bbeb8b0f612a9199f722e3a621a&amp;quot;,&lt;br /&gt;
            [&amp;quot;access-control-allow-origin&amp;quot;] = &amp;quot;*&amp;quot;,&lt;br /&gt;
            [&amp;quot;x-custom-header&amp;quot;] = &amp;quot;MTA server&amp;quot;,&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Securing the web interface==&lt;br /&gt;
The [[ACL]] has a number of rights that can affect what files can be accessed.&lt;br /&gt;
{{Deprecated feature|3.0139|1.3.1|&lt;br /&gt;
* general.http: If disabled, none of the HTTP files can be accessed (except by game clients)&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled, HTTP access to all resources (for that ACL) is enabled by default. To disable HTTP access you have to explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
** '''Important Note''': ''If 'general.http' is enabled on an ACL which has a user with no password (i.e. user.* or user.guest or user.http_guest), it is essential that you explicitly block access to resources that contain exported HTTP functions.''&lt;br /&gt;
* resource.'''ResourceName''': If disabled, none of the files in the resource can be accessed&lt;br /&gt;
* resource.'''ResourceName'''.file.'''FileName''': If disabled, the file named cannot be accessed&lt;br /&gt;
* resource.'''ResourceName'''.function.'''FunctionName''': If disabled, the function cannot be called&lt;br /&gt;
These work as with other ACL rights - you can disable them for normal users and just enable them for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
{{New_feature|3.0139|1.3.1|&lt;br /&gt;
* '''resource.ResourceName.http''': If enabled, the resource will be accessible from http://server_ip:22005/ResourceName/&lt;br /&gt;
This works as with other ACL rights - You can enable it just for Admin users, or any other group of users you wish.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==SDK==&lt;br /&gt;
There are a number of so-called 'SDKs' available that allow you to interface with the server from other programming languages. With these, you could (in theory) write whole gamemodes. In practice, this is probably a bad idea, but it is useful for statistics and administration. The PHP SDK is the most developed version. Feel free to modify or create your own SDKs - if you do please send us a copy.&lt;br /&gt;
&lt;br /&gt;
* [[JavaSDK|Java SDK]]&lt;br /&gt;
* [[Javascript SDK]]&lt;br /&gt;
* [https://www.npmjs.com/package/mtasa Node.js SDK]&lt;br /&gt;
* [https://crates.io/crates/mta-sdk Rust SDK]&lt;br /&gt;
* [https://pypi.org/project/MTA-SDK-Python/ Python SDK]&lt;br /&gt;
* [[Perl SDK]]&lt;br /&gt;
* [[PHP SDK]]&lt;br /&gt;
* [[CSharp SDK|C# SDK]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[callRemote]] - Allows game servers to call functions on PHP pages (with the PHP SDK) and on other game servers.&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
&lt;br /&gt;
[[en:Resource Web Access]]&lt;br /&gt;
[[fr:Ressource Acces Internet]]&lt;br /&gt;
[[hu:Resource Web Access]]&lt;br /&gt;
[[pt-br:Acesso_web_via_recursos]]&lt;br /&gt;
[[ru:Resource Web Access]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbConnect&amp;diff=79522</id>
		<title>DbConnect</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbConnect&amp;diff=79522"/>
		<updated>2024-06-06T18:51:26Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function opens a connection to a database and returns an element that can be used with [[dbQuery]]. To disconnect use [[destroyElement]].&lt;br /&gt;
{{Note|Connecting and disconnecting many times can have a performance impact on the server. For optimal performance it is recommended that you use dbConnect only once when the resource starts, and share the connection element with the whole script.}}&lt;br /&gt;
{{Note|If you use MySQL 8 or newer, you should add this line to mysqld.cnf '''&amp;lt;nowiki&amp;gt;default-authentication-plugin=mysql_native_password&amp;lt;/nowiki&amp;gt;''' in the case where you're unable to authenticate with your MySQL server.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element dbConnect ( string databaseType, string host [, string username = &amp;quot;&amp;quot;, string password = &amp;quot;&amp;quot;, string options = &amp;quot;&amp;quot; ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Connection]]}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''databaseType:''' The type of database. This can be either ''sqlite'' or ''mysql''&lt;br /&gt;
*'''host:''' The target to connect to. The format of this depends on the database type.&lt;br /&gt;
** For SQLite it is a [[filepath]] to a SQLite database file. If the filepath starts with &amp;quot;:/&amp;quot; then the server's global databases directory is used. The file will be created if it does not exist.&lt;br /&gt;
** For MySQL it is a list of key=value pairs separated by semicolons. Supported keys are:&lt;br /&gt;
*** '''dbname''': Name of the database to use e.g. ''dbname=test''&lt;br /&gt;
*** '''host''': Host address e.g. ''host=127.0.0.1''&lt;br /&gt;
*** '''port''': Host port e.g. ''port=1234'' (optional, defaults to standard MySQL port if not used)&lt;br /&gt;
*** '''unix_socket''': Unix socket or named pipe to use (optional)&lt;br /&gt;
***'''charset''': Communicate with the server using a character which is different from the default e.g. ''charset&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;utf8'' (optional)&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''username:''' Usually required for MySQL, ignored by SQLite &lt;br /&gt;
*'''password:''' Usually required for MySQL, ignored by SQLite &lt;br /&gt;
*'''options :''' List of key=value pairs separated by semicolons. Supported keys are:&lt;br /&gt;
**'''share''' which can be set to 0 or 1. (Default value for SQLite is &amp;quot;share=1&amp;quot;, for MySQL is &amp;quot;share=0&amp;quot;). When set to 1, the connection is shared and will be used by other calls to dbConnect with the same host string. This is usually a good thing for SQLite connections, but not so good for MySQL unless care is taken.&lt;br /&gt;
**'''batch''' which can be set to 0 or 1. (Default is &amp;quot;batch=1&amp;quot;). When set to 1, queries called in the same frame are automatically batched together which can significantly speed up inserts/updates. The downside is you lose control of the feature that is used to achieve batching (For SQLite it is transactions, for MySQL it is autocommit mode). Therefore, if you use transactions, lock tables or control autocommit yourself, you may want to disable this feature.&lt;br /&gt;
**'''autoreconnect''' which can be set to 0 or 1. (Default value &amp;quot;autoreconnect=1&amp;quot;). When set to 1, dropped connections will automatically be reconnected. Note that session variables (incl. SET NAMES), user variables, table locks and temporary tables will be reset because of the reconnection. So if you use these fancy features, you will need to turn autoreconnect off and cope with dropped connections some other way.&lt;br /&gt;
**'''log''' which can be set to 0 or 1. (Default value &amp;quot;log&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;1&amp;quot;). When set to 0, activity from this connection will not be recorded in the [[Server_Commands#debugdb|database debug log file]].&lt;br /&gt;
**'''tag''' (Default value &amp;quot;tag&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;script&amp;quot;). A string which helps identify activity from this connection in the [[Server_Commands#debugdb|database debug log file]].&lt;br /&gt;
**'''suppress''' A comma separated list of error codes to ignore. (eg. &amp;quot;suppress&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;1062,1169&amp;quot;).&lt;br /&gt;
**'''multi_statements''' Enable multiple statements (separated by a semi-colon) in one query. Use [[dbPrepareString]] when building a multiple statement query to reduce SQL injection risks.&lt;br /&gt;
**'''queue''' Name of the queue to use. (Default value for SQLite is &amp;quot;sqlite&amp;quot;, for MySQL default is the host string from the '''host''' argument). Asynchronous database queries in the same queue are processed in order, one at a time. Any name can be used.&lt;br /&gt;
**'''use_ssl''' which can be set to 0 or 1. (Default value is 0), ignored by SQLite&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22497|'''get_server_public_key''' which can be set to 0 or 1. (Default value is 1), ignored by SQLite. When set to 1, this enables the client to request from the server the public key required for RSA key pair-based password exchange. This option applies to clients that authenticate with the &amp;lt;code&amp;gt;caching_sha2_password&amp;lt;/code&amp;gt; authentication plugin.}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a database connection element unless there are problems, in which case it return ''false''.&lt;br /&gt;
&lt;br /&gt;
==Remarks==&lt;br /&gt;
Under certain platforms, for example on Unix-based OSes like Linux, using this function could fail with a debug warning containing &amp;quot;[Could not connect]&amp;quot; accompanied by a prior debug error explaining the problem. In that case you should check the [[Server Manual]] to see if you have missed any recommended (best-effort) steps for server set-up.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens a connection to a SQLite database file in the current resource&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database file in another resource&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;:resname/file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database file in the global databases directory&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;:/file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database file in a sub directory of the global databases directory&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;:/example/sub/dir/file.db&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a MySQL database called 'frank' at server ip 1.2.3.4 using utf8 character set and allows the connection to be shared. Note that changing the database or other connection dependent settings affect all connections that are shared.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;mysql&amp;quot;, &amp;quot;dbname=frank;host=1.2.3.4;charset=utf8&amp;quot;, &amp;quot;username&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;share=1&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example opens a connection to a SQLite database is disallows sharing of the connection&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;file.db&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;share=0&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example output debug message, if the connection with SQLite database was established or not&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
test_db = dbConnect( &amp;quot;sqlite&amp;quot;, &amp;quot;file.db&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
if test_db then&lt;br /&gt;
    outputDebugString( &amp;quot;Connection with database was successfully established.&amp;quot; )&lt;br /&gt;
else&lt;br /&gt;
    outputDebugString( &amp;quot;Connection with database couldn't be established.&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The folowing example shows how you could approach a common resource for database operations with exported functions ('''query''' and '''execute'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function connect()&lt;br /&gt;
    DBConnection = dbConnect( &amp;quot;mysql&amp;quot;, &amp;quot;dbname=DBNAME;host=HOST;charset=utf8&amp;quot;, &amp;quot;USERNAME&amp;quot;, &amp;quot;PASSWORD&amp;quot; )&lt;br /&gt;
    if (not DBConnection) then&lt;br /&gt;
        outputDebugString(&amp;quot;Error: Failed to establish connection to the MySQL database server&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputDebugString(&amp;quot;Success: Connected to the MySQL database server&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, connect)&lt;br /&gt;
 &lt;br /&gt;
function query(...)&lt;br /&gt;
    local queryHandle = dbQuery(DBConnection, ...)&lt;br /&gt;
    if (not queryHandle) then&lt;br /&gt;
        return nil&lt;br /&gt;
    end&lt;br /&gt;
    local rows = dbPoll(queryHandle, -1)&lt;br /&gt;
    return rows&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
function execute(...)&lt;br /&gt;
    local queryHandle = dbQuery(DBConnection, ...)&lt;br /&gt;
    local result, numRows = dbPoll(queryHandle, -1)&lt;br /&gt;
    return numRows&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function getDBConnection()&lt;br /&gt;
    return DBConnection&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.1-9.04817|Added options 'log', 'tag' and 'suppress'}}&lt;br /&gt;
{{ChangelogItem|1.3.5-9.06386|Added option 'charset'}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added option 'multi_statements'}}&lt;br /&gt;
{{ChangelogItem|1.5.4-9.11138|Added option 'queue'}}&lt;br /&gt;
{{ChangelogItem|1.6.0-9.22396|Added option 'use_ssl'}}&lt;br /&gt;
{{ChangelogItem|1.6.0-9.22497|Added option 'get_server_public_key'}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{SQL_functions}}&lt;br /&gt;
&lt;br /&gt;
[[ru:dbConnect]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=How_you_can_help&amp;diff=77498</id>
		<title>How you can help</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=How_you_can_help&amp;diff=77498"/>
		<updated>2023-08-16T14:58:58Z</updated>

		<summary type="html">&lt;p&gt;Botder: Reverted edits by TheRealSadra (talk) to last revision by Maurice&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Multi Theft Auto has loads of areas in which you can help us. In turn, we'll be more than happy to help you get started with any ideas you have, help test them and - if they're good enough - release them to the whole community. This page outlines the key areas you could do something in, of course, there are many things we've not thought of, so think outside the box!&lt;br /&gt;
&lt;br /&gt;
==Coding for MTA:SA==&lt;br /&gt;
* Become a patch contributor by sending [https://github.com/multitheftauto/mtasa-blue/pulls pull requests] to MTA, containing requested features or bugfixes. ([https://github.com/multitheftauto/mtasa-blue/blob/master/CONTRIBUTING.md#contributors-guide Coding guidelines])&lt;br /&gt;
* Translate MTA:SA to your native language on Crowdin at https://multitheftauto.crowdin.com/&lt;br /&gt;
&lt;br /&gt;
==Scripting==&lt;br /&gt;
* Become a contributor to MTA's official resources by sending [https://github.com/multitheftauto/mtasa-resources/pulls pull requests] to our resources repository&lt;br /&gt;
* Create and [https://community.multitheftauto.com/ publish] a gamemode or useful script&lt;br /&gt;
**[[Scripting Introduction]]&lt;br /&gt;
**[https://www.lua.org/pil/index.html &amp;quot;Programming in Lua&amp;quot; Manual]&lt;br /&gt;
* Make a general purpose resource that provides useful functions to other resources.&lt;br /&gt;
&lt;br /&gt;
==Mapping==&lt;br /&gt;
* Create and [https://community.multitheftauto.com/ publish] a map for an existing gamemode, with the map editor.&lt;br /&gt;
**[[Resource:Editor|Map Editor Manual]]&lt;br /&gt;
&lt;br /&gt;
==Web development==&lt;br /&gt;
* Create your own system for statistics - using the [[PHP SDK]] as a basis. Join the [https://discord.com/invite/mtasa MTA Discord] (or [https://discord.gg/GNN6PRtTnu development Discord]) for help.&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
Before you make changes check out: [[Help:Editing Guidelines|Editing Guidelines]] and [[Help:MTA Wiki Specific Templates|Specific Templates]]&lt;br /&gt;
* Finish documentation for [[:Category:Incomplete|Incomplete functions]] - ask in #mta.scripting if you're not sure of something.&lt;br /&gt;
* Add examples to [[:Category:Needs Example|functions &amp;amp; events missing examples]] - please '''test''' them, and again, ask if you need help.&lt;br /&gt;
* Review and verify [[:Category:Needs Checking|pages that need checking]] - make sure highlighted issues are solved before removing pages from the category.&lt;br /&gt;
* Expand the pages that explain [[:Category:Scripting_Concepts|MTA core concepts]].&lt;br /&gt;
* Write [https://forum.multitheftauto.com/forum/123-tutorials/ tutorials] to help new people.&lt;br /&gt;
* Translate the wiki pages so people from other countries can get started in MTA too.&lt;br /&gt;
* Create documentation for undocumented functions and events [[Undocumented Items]]&lt;br /&gt;
* Keep 'changes in' [current work-in-progress: https://wiki.multitheftauto.com/wiki/Changes_in_1.6] for future releases updated.&lt;br /&gt;
&lt;br /&gt;
==Quality Assurance==&lt;br /&gt;
* [https://github.com/multitheftauto/mtasa-blue/issues Report issues] with the mod, make sure to do a search on the already reported issues first.&lt;br /&gt;
* Test and confirm existing reported issues.&lt;br /&gt;
* Use the newest build of MTA to detect and report new bugs, by going to 'Settings', 'Advanced', 'Update build type' and choosing 'Nightly' or get it regularly [https://nightly.multitheftauto.com/ from here].&lt;br /&gt;
* Any bugs which are related to a scripting function / event and present in the main release (rather than nightlies), document that bug by adding a [https://wiki.multitheftauto.com/wiki/Help:MTA_Wiki_Specific_Templates warning] to the wiki page to save other scripters a lot of time.&lt;br /&gt;
&lt;br /&gt;
==Specific tasks==&lt;br /&gt;
* Create a fuzzer to check for crashes in our scripting functions.&lt;br /&gt;
&lt;br /&gt;
==Grant==&lt;br /&gt;
You can donate to MTA:SA [https://multitheftauto.com/donate/manage.php here]&lt;br /&gt;
&lt;br /&gt;
[[ar:كيف_يمكنك_المساعدة]]&lt;br /&gt;
[[en:How you can help]]&lt;br /&gt;
[[ru:How you can help]]&lt;br /&gt;
[[pl:Jak możesz pomóc]]&lt;br /&gt;
[[uk:How you can help]]&lt;br /&gt;
[[es:Cómo puedes ayudar]]&lt;br /&gt;
[[hu:How you can help]]&lt;br /&gt;
[[tr:Nasıl yardımcı olabilirsiniz]]&lt;br /&gt;
[[pt-br:Como você pode ajudar]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:File_functions&amp;diff=77420</id>
		<title>Template:File functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:File_functions&amp;diff=77420"/>
		<updated>2023-08-07T20:55:54Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileClose]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileCopy]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileCreate]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileDelete]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileExists]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileFlush]]&amp;lt;/li&amp;gt;&lt;br /&gt;
{{New items|3.0161|1.6.0|&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetContents]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|21938}}&lt;br /&gt;
{{New items|3.0153|1.5.3|&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetPath]]&amp;lt;/li&amp;gt;&lt;br /&gt;
|7446}}&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetPos]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileGetSize]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileIsEOF]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileOpen]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileRead]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileRename]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileSetPos]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[fileWrite]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Functions templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77419</id>
		<title>FileGetContents</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77419"/>
		<updated>2023-08-07T20:54:29Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
{{Added feature/item|1.6.1|1.6.0|21938|&lt;br /&gt;
Reads the entire contents of the file, optionally verifies the read contents by computing and comparing the checksum with the expected one, and returns the content as string. The file cursor position is not modified by calls to this function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please note that even if you enable SD #22 and #23 on your server, you are not protected from user attacks, which can happen after verification of the file, but before you read the contents of such verified file. This function enables you to safely read the contents of a meta.xml-listed file on both client and server.&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|string fileGetContents ( file theFile [ , bool verifyContents = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[file]]:getContents}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theFile:''' A handle to the file you wish to get the contents from. Use [[fileOpen]] to obtain this handle.&lt;br /&gt;
*'''verifyContents:''' Set to true, to compare the computed and the expected checksum of the file content&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the bytes that were read from the file, but only if verification was disabled or if the checksum comparison succeeded. On failure, this function returns ''nil''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens the file test.txt and outputs its contents to the console.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handle = fileOpen(&amp;quot;code.lua&amp;quot;, true)&lt;br /&gt;
local buffer = fileGetContents(handle) -- code.lua must be listed in meta.xml (for example as &amp;lt;file&amp;gt; for this example)&lt;br /&gt;
fileClose(handle)&lt;br /&gt;
&lt;br /&gt;
if buffer then&lt;br /&gt;
    loadstring(buffer)()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77418</id>
		<title>FileGetContents</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77418"/>
		<updated>2023-08-07T20:06:02Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
{{Added feature/item|1.6.1|1.6.0|21933|&lt;br /&gt;
Reads the entire contents of the file, optionally verifies the read contents by computing and comparing the checksum with the expected one, and returns the content as string. The file cursor position is not modified by calls to this function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please note that even if you enable SD #22 and #23 on your server, you are not protected from user attacks, which can happen after verification of the file, but before you read the contents of such verified file. This function enables you to safely read the contents of a meta.xml-listed file on both client and server.&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|string fileGetContents ( file theFile [ , bool verifyContents = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[file]]:getContents}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theFile:''' A handle to the file you wish to get the contents from. Use [[fileOpen]] to obtain this handle.&lt;br /&gt;
*'''verifyContents:''' Set to true, to compare the computed and the expected checksum of the file content&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the bytes that were read from the file, but only if verification was disabled or if the checksum comparison succeeded. On failure, this function returns ''nil''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens the file test.txt and outputs its contents to the console.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handle = fileOpen(&amp;quot;code.lua&amp;quot;, true)&lt;br /&gt;
local buffer = fileGetContents(handle) -- code.lua must be listed in meta.xml (for example as &amp;lt;file&amp;gt; for this example)&lt;br /&gt;
fileClose(handle)&lt;br /&gt;
&lt;br /&gt;
if buffer then&lt;br /&gt;
    loadstring(buffer)()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77417</id>
		<title>FileGetContents</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77417"/>
		<updated>2023-08-07T20:04:44Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
{{Added feature/item|1.6.1|1.6.0|21933|&lt;br /&gt;
Reads the entire contents of the file '''starting from the current file position''', optionally verifies the read contents by computing and comparing the checksum with the expected one, and returns the content as string.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please note that even if you enable SD #22 and #23 on your server, you are not protected from user attacks, which can happen after verification of the file, but before you read the contents of such verified file. This function enables you to safely read the contents of a meta.xml-listed file on both client and server.&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|string fileGetContents ( file theFile [ , bool verifyContents = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[file]]:getContents}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theFile:''' A handle to the file you wish to get the contents from. Use [[fileOpen]] to obtain this handle.&lt;br /&gt;
*'''verifyContents:''' Set to true, to compare the computed and the expected checksum of the file content&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the bytes that were read from the file, but only if verification was disabled or if the checksum comparison succeeded. On failure, this function returns ''nil''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens the file test.txt and outputs its contents to the console.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handle = fileOpen(&amp;quot;code.lua&amp;quot;, true)&lt;br /&gt;
local buffer = fileGetContents(handle) -- code.lua must be listed in meta.xml (for example as &amp;lt;file&amp;gt; for this example)&lt;br /&gt;
fileClose(handle)&lt;br /&gt;
&lt;br /&gt;
if buffer then&lt;br /&gt;
    loadstring(buffer)()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77416</id>
		<title>FileGetContents</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77416"/>
		<updated>2023-08-07T19:18:24Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
{{Added feature/item|1.6.1|1.6.0|21932|&lt;br /&gt;
Reads the entire contents of the file '''starting from the current file position''', optionally verifies the read contents by computing and comparing the checksum with the expected one, and returns the content as string.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Please note that even if you enable SD #22 and #23 on your server, you are not protected from user attacks, which can happen after verification of the file, but before you read the contents of such verified file. This function enables you to safely read the contents of a meta.xml-listed file on both client and server.&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|string fileGetContents ( file theFile [ , bool verifyContents = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[file]]:getContents}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theFile:''' A handle to the file you wish to get the contents from. Use [[fileOpen]] to obtain this handle.&lt;br /&gt;
*'''verifyContents:''' Set to true, to compare the computed and the expected checksum of the file content&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the bytes that were read from the file, but only if verification was disabled or if the checksum comparison succeeded. On failure, this function returns ''nil''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens the file test.txt and outputs its contents to the console.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handle = fileOpen(&amp;quot;code.lua&amp;quot;, true)&lt;br /&gt;
local buffer = fileGetContents(handle) -- code.lua must be listed in meta.xml (for example as &amp;lt;file&amp;gt; for this example)&lt;br /&gt;
fileClose(handle)&lt;br /&gt;
&lt;br /&gt;
if buffer then&lt;br /&gt;
    loadstring(buffer)()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77415</id>
		<title>FileGetContents</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileGetContents&amp;diff=77415"/>
		<updated>2023-08-07T19:16:30Z</updated>

		<summary type="html">&lt;p&gt;Botder: Created page with &amp;quot;__NOTOC__ {{Server client function}}  Reads the entire contents of the file '''starting from the current file position''', optionally verifies the read contents by computing and comparing the checksum with the expected one, and returns the content as string.  Please note that even if you enable SD #22 and #23 on your server, you are not protected from user attacks, which can happen after verification of the file, but before you read the contents of such verified file. Th...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
Reads the entire contents of the file '''starting from the current file position''', optionally verifies the read contents by computing and comparing the checksum with the expected one, and returns the content as string.&lt;br /&gt;
&lt;br /&gt;
Please note that even if you enable SD #22 and #23 on your server, you are not protected from user attacks, which can happen after verification of the file, but before you read the contents of such verified file. This function enables you to safely read the contents of a meta.xml-listed file on both client and server.&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|string fileGetContents ( file theFile [ , bool verifyContents = true ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[file]]:getContents}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theFile:''' A handle to the file you wish to get the contents from. Use [[fileOpen]] to obtain this handle.&lt;br /&gt;
*'''verifyContents:''' Set to true, to compare the computed and the expected checksum of the file content&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the bytes that were read from the file, but only if verification was disabled or if the checksum comparison succeeded. On failure, this function returns ''nil''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens the file test.txt and outputs its contents to the console.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handle = fileOpen(&amp;quot;code.lua&amp;quot;, true)&lt;br /&gt;
local buffer = fileGetContents(handle) -- code.lua must be listed in meta.xml (for example as &amp;lt;file&amp;gt; for this example)&lt;br /&gt;
fileClose(handle)&lt;br /&gt;
&lt;br /&gt;
if buffer then&lt;br /&gt;
    loadstring(buffer)()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnExplosion&amp;diff=77230</id>
		<title>OnExplosion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnExplosion&amp;diff=77230"/>
		<updated>2023-07-30T13:20:18Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{Added feature/item|1.6.1|1.6.0|21914|This event is triggered every time an explosion is created either by server-side [[createExplosion]], or reported by [[player]].}}&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float x, float y, float z, int theType&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''x:''' X coordinate of where the explosion was created&lt;br /&gt;
*'''y:''' Y coordinate of where the explosion was created&lt;br /&gt;
*'''z:''' Z coordinate of where the explosion was created&lt;br /&gt;
*'''theType:''' the type of explosion created, values are:&lt;br /&gt;
{{Explosions}}&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[player]] who notified server about explosion, or [[root]] if explosion was created without specifying creator in [[createExplosion]].&lt;br /&gt;
&lt;br /&gt;
===Canceling===&lt;br /&gt;
If this event is [[Event system #Canceling|canceled]], the explosion will not occur. &lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example outputs information about occuring explosion.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local explosionTypes = {&lt;br /&gt;
	[0] = &amp;quot;Grenade&amp;quot;,&lt;br /&gt;
	[1] = &amp;quot;Molotov&amp;quot;,&lt;br /&gt;
	[2] = &amp;quot;Rocket&amp;quot;,&lt;br /&gt;
	[3] = &amp;quot;Rocket Weak&amp;quot;,&lt;br /&gt;
	[4] = &amp;quot;Car&amp;quot;,&lt;br /&gt;
	[5] = &amp;quot;Car Quick&amp;quot;,&lt;br /&gt;
	[6] = &amp;quot;Boat&amp;quot;,&lt;br /&gt;
	[7] = &amp;quot;Heli&amp;quot;,&lt;br /&gt;
	[8] = &amp;quot;Mine&amp;quot;,&lt;br /&gt;
	[9] = &amp;quot;Object&amp;quot;,&lt;br /&gt;
	[10] = &amp;quot;Tank Grenade&amp;quot;,&lt;br /&gt;
	[11] = &amp;quot;Small&amp;quot;,&lt;br /&gt;
	[12] = &amp;quot;Tiny&amp;quot;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function onExplosion(explosionX, explosionY, explosionZ, explosionType)&lt;br /&gt;
	local explosionPos = (explosionX..&amp;quot;, &amp;quot;..explosionY..&amp;quot;, &amp;quot;..explosionZ)&lt;br /&gt;
	local explosionTypeName = explosionTypes[explosionType]&lt;br /&gt;
	local explosionSource = inspect(source)&lt;br /&gt;
&lt;br /&gt;
	local debugMsg = (explosionTypeName..&amp;quot; explosion has occured at &amp;quot;..explosionPos..&amp;quot; (source: &amp;quot;..explosionSource..&amp;quot;)&amp;quot;)&lt;br /&gt;
	local debugMsgLevel = 4&lt;br /&gt;
	local debugMsgR = 255&lt;br /&gt;
	local debugMsgG = 127&lt;br /&gt;
	local debugMsgB = 0&lt;br /&gt;
&lt;br /&gt;
	outputDebugString(debugMsg, debugMsgLevel, debugMsgR, debugMsgG, debugMsgB)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onExplosion&amp;quot;, root, onExplosion)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Server events}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Server_events&amp;diff=77228</id>
		<title>Template:Server events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Server_events&amp;diff=77228"/>
		<updated>2023-07-30T13:19:12Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[onBan]]&lt;br /&gt;
*[[onChatMessage]]&lt;br /&gt;
*[[onDebugMessage]]&lt;br /&gt;
{{Added feature/item|1.6.1|1.6.0|21914|&lt;br /&gt;
*[[onExplosion]]&lt;br /&gt;
}}&lt;br /&gt;
*[[onSettingChange]]&lt;br /&gt;
*[[onUnban]]&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Events templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Next_Stable_Version&amp;diff=77227</id>
		<title>Template:Next Stable Version</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Next_Stable_Version&amp;diff=77227"/>
		<updated>2023-07-30T13:18:52Z</updated>

		<summary type="html">&lt;p&gt;Botder: Bump next stable version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#ifeq:{{{1|}}}|full|Error!|1.6.1}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Current_Stable_Version&amp;diff=77226</id>
		<title>Template:Current Stable Version</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Current_Stable_Version&amp;diff=77226"/>
		<updated>2023-07-30T13:18:40Z</updated>

		<summary type="html">&lt;p&gt;Botder: Bump stable version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#ifeq:{{{1|}}}|full|Error!|1.6.0}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Botder&amp;diff=77132</id>
		<title>User:Botder</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Botder&amp;diff=77132"/>
		<updated>2023-06-28T15:28:37Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MTA Developer}}&lt;br /&gt;
&lt;br /&gt;
== Contact ==&lt;br /&gt;
*Discord: '''botder''' (before: '''botder#1218''')&lt;br /&gt;
*[https://github.com/botder GitHub Profile]&lt;br /&gt;
*[https://forum.mtasa.com/profile/40389-botder/ Forum Profile]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EncodeString&amp;diff=76315</id>
		<title>EncodeString</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EncodeString&amp;diff=76315"/>
		<updated>2023-03-21T22:50:56Z</updated>

		<summary type="html">&lt;p&gt;Botder: Add RSA example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Shared function}}&lt;br /&gt;
{{New feature/item|3.0156|1.5.5|11849|&lt;br /&gt;
This function encodes a [[string]] using the specified algorithm. The counterpart of this function is [[decodeString]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|If it doesn't matter which algorithm you use for the encoding, keep in mind that ''aes128'' uses hardware acceleration so it may outperform the ''tea'' algorithm on most processors.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string encodeString ( string algorithm, string input, table options [, function callback ] )  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''algorithm:''' The algorithm to use.&lt;br /&gt;
*'''input:''' The input to encode.&lt;br /&gt;
*'''options:''' A [[table]] with options and other necessary data for the algorithm, as detailed below.&lt;br /&gt;
&lt;br /&gt;
===Options for each algorithm===&lt;br /&gt;
* ''tea'' ([https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm])&lt;br /&gt;
** '''key''': a key to encode the input with.&lt;br /&gt;
{{Added feature/item|1.5.9|1.5.8|20898|&lt;br /&gt;
* ''aes128'' ([https://en.wikipedia.org/wiki/Advanced_Encryption_Standard Advanced Encryption Standard] in CTR mode)&lt;br /&gt;
** '''key''': a key to encode the input with (must be 16 characters long).&lt;br /&gt;
|20898}}&lt;br /&gt;
{{Added feature/item|1.5.9|1.5.8|21055|&lt;br /&gt;
* ''rsa'' ([https://en.wikipedia.org/wiki/RSA_(cryptosystem) Rivest-Shamir-Adleman] in OAEP with SHA-1 mode)&lt;br /&gt;
** '''key''': a public key to encode the input. (use [[generateKeyPair]] to create a new private and public key)&lt;br /&gt;
|21055}}&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''callback:''' providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below.&lt;br /&gt;
===Returns for each algorithm===&lt;br /&gt;
* ''tea'' &lt;br /&gt;
** '''encodedString''': the encoded string if successful, ''false'' otherwise. If a callback was provided, ''true'' is returned immediately, and the encoded string is passed as an argument to the callback.&lt;br /&gt;
{{New items|3.0159|1.5.8|&lt;br /&gt;
* ''aes128'' &lt;br /&gt;
** '''encodedString''': the encoded string if successful, ''false'' otherwise. If a callback was provided, ''true'' is returned immediately, and the encoded string is passed as an argument to the callback.&lt;br /&gt;
** '''iv''' ([https://en.wikipedia.org/wiki/Initialization_vector Initialization vector]): this is a string generated by the encryption algorithm that is needed to decrypt the message by [[decodeString]]. If a callback was provided, ''true'' is returned immediately, and the ''iv'' is passed as an argument to the callback.&lt;br /&gt;
|20898}}&lt;br /&gt;
{{New items|3.0159|1.5.8|&lt;br /&gt;
* ''rsa'' &lt;br /&gt;
** '''encodedString''': the encoded string if successful, ''false'' otherwise. If a callback was provided, ''true'' is returned immediately, and the encoded string is passed as an argument to the callback.&lt;br /&gt;
|21055}}&lt;br /&gt;
&lt;br /&gt;
==Examples== &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;
Adds an ''/encode'' command in which you can provide an algorithm, key and data to encode. Below is the example provided as both server-side and client-side variations.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;encode&amp;quot;, &lt;br /&gt;
    function(player, _, algorithm, key, ...)&lt;br /&gt;
        if algorithm and key then&lt;br /&gt;
            local text = table.concat({...}, &amp;quot; &amp;quot;)&lt;br /&gt;
            if type(text) == &amp;quot;string&amp;quot; and text ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                local encoded = encodeString(algorithm, text, { key = key })&lt;br /&gt;
                if encoded then&lt;br /&gt;
                    outputChatBox(&amp;quot;The result of &amp;quot; .. algorithm .. &amp;quot; encoding is: &amp;quot; .. encoded, player)&lt;br /&gt;
                else&lt;br /&gt;
                    outputChatBox(&amp;quot;Failed to encode. Make sure that all arguments are valid.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
                end&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox(&amp;quot;Please specify text in the command.&amp;quot;, player, 255, 0, 0)&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(&amp;quot;Invalid algorithm and/or key.&amp;quot;, player, 255, 0, 0)&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;
This example shows you how to use the RSA encryption with a simple string message.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local private, public = generateKeyPair(&amp;quot;rsa&amp;quot;, { size = 2048 })&lt;br /&gt;
&lt;br /&gt;
local input = &amp;quot;Hello, world!&amp;quot;&lt;br /&gt;
local encrypted = encodeString(&amp;quot;rsa&amp;quot;, input, { key = public })&lt;br /&gt;
local decrypted = decodeString(&amp;quot;rsa&amp;quot;, encrypted, { key = private })&lt;br /&gt;
&lt;br /&gt;
outputServerLog(&amp;quot;RSA test: &amp;quot;.. tostring(input == decrypted))&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;
{{Utility functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Utility_functions&amp;diff=75651</id>
		<title>Template:Utility functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Utility_functions&amp;diff=75651"/>
		<updated>2022-11-03T14:14:58Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[addDebugHook]]&lt;br /&gt;
*[[base64Decode]]&lt;br /&gt;
*[[base64Encode]]&lt;br /&gt;
{{Bit_functions}}&lt;br /&gt;
*[[debugSleep]]&lt;br /&gt;
{{New items|3.0156|1.5.5|&lt;br /&gt;
*[[decodeString]]&lt;br /&gt;
|11849}}&lt;br /&gt;
*[[deref]]&lt;br /&gt;
{{New items|3.0156|1.5.5|&lt;br /&gt;
*[[encodeString]]&lt;br /&gt;
|11849}}&lt;br /&gt;
*[[fromJSON]]&lt;br /&gt;
&amp;lt;!--{{New items|3.0160|1.6.0|--&amp;gt;&lt;br /&gt;
{{Added feature/item|1.6.0|1.5.9|21055|&lt;br /&gt;
*[[generateKeyPair]]&lt;br /&gt;
}}&lt;br /&gt;
*[[getColorFromString]]&lt;br /&gt;
*[[getDevelopmentMode]]&lt;br /&gt;
*[[getDistanceBetweenPoints2D]]&lt;br /&gt;
*[[getDistanceBetweenPoints3D]]&lt;br /&gt;
*[[getEasingValue]]&lt;br /&gt;
*[[getFPSLimit]]&lt;br /&gt;
*[[getNetworkStats]]&lt;br /&gt;
*[[getNetworkUsageData]]&lt;br /&gt;
*[[getPerformanceStats]]&lt;br /&gt;
&amp;lt;!--{{New items|3.0160|1.6.0|--&amp;gt;&lt;br /&gt;
{{Added feature/item|1.6.0|1.5.9|21389|&lt;br /&gt;
*[[getProcessMemoryStats]]&lt;br /&gt;
}}&lt;br /&gt;
*[[getRealTime]]&lt;br /&gt;
*[[getServerConfigSetting]]&lt;br /&gt;
*[[getTickCount]]&lt;br /&gt;
*[[getTimerDetails]]&lt;br /&gt;
*[[getTimers]]&lt;br /&gt;
*[[gettok]]&lt;br /&gt;
*[[getUserdataType]]&lt;br /&gt;
*[[getVersion]]&lt;br /&gt;
*[[hash]]&lt;br /&gt;
*[[inspect]]&lt;br /&gt;
*[[interpolateBetween]]&lt;br /&gt;
*[[iprint]]&lt;br /&gt;
*[[isOOPEnabled]]&lt;br /&gt;
*[[isTimer]]&lt;br /&gt;
*[[killTimer]]&lt;br /&gt;
*[[md5]]&lt;br /&gt;
*[[passwordHash]]&lt;br /&gt;
*[[passwordVerify]]&lt;br /&gt;
*[[pregFind]]&lt;br /&gt;
*[[pregMatch]]&lt;br /&gt;
*[[pregReplace]]&lt;br /&gt;
*[[removeDebugHook]]&lt;br /&gt;
*[[ref]]&lt;br /&gt;
*[[resetTimer]]&lt;br /&gt;
*[[setDevelopmentMode]]&lt;br /&gt;
*[[setFPSLimit]]&lt;br /&gt;
*[[setServerConfigSetting]]&lt;br /&gt;
*[[setTimer]]&lt;br /&gt;
*[[sha256]]&lt;br /&gt;
*[[split]]&lt;br /&gt;
*[[teaDecode]]&lt;br /&gt;
*[[teaEncode]]&lt;br /&gt;
{{New items|3.0156|1.5.5|&lt;br /&gt;
*[[tocolor]]&lt;br /&gt;
|13977}}&lt;br /&gt;
*[[toJSON]]&lt;br /&gt;
*[[utfChar]]&lt;br /&gt;
*[[utfCode]]&lt;br /&gt;
*[[utfLen]]&lt;br /&gt;
*[[utfSeek]]&lt;br /&gt;
*[[utfSub]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Functions templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetProcessMemoryStats&amp;diff=75650</id>
		<title>GetProcessMemoryStats</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetProcessMemoryStats&amp;diff=75650"/>
		<updated>2022-11-03T14:12:09Z</updated>

		<summary type="html">&lt;p&gt;Botder: Created page with &amp;quot;__NOTOC__ {{Shared function}} {{Added feature/item|1.6.0|1.5.9|21389|This function returns a breakdown of the process memory usage. The reported numbers are always byte units and these numbers can be '''inaccurate'''.}}  ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; table|nil getProcessMemoryStats ( ) &amp;lt;/syntaxhighlight&amp;gt;   ==Returns== Returns a table if successful, otherwise returns '''nil'''  {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;cellpadding: 10px;&amp;quot; |- ! Property || Description |- | &amp;lt;c...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Shared function}}&lt;br /&gt;
{{Added feature/item|1.6.0|1.5.9|21389|This function returns a breakdown of the process memory usage. The reported numbers are always byte units and these numbers can be '''inaccurate'''.}}&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|nil getProcessMemoryStats ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns a table if successful, otherwise returns '''nil'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;cellpadding: 10px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;virtual&amp;lt;/code&amp;gt; || total program size&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;resident&amp;lt;/code&amp;gt; || resident set size (memory in physical space/ram, also known as ''working set'')&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;shared&amp;lt;/code&amp;gt; || size of resident shared memory (shared with other processes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt; || size of resident private memory (only for this process)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Resident set size should be roughly &amp;lt;code&amp;gt;shared&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt; from the table.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will output the memory usage by the server process to the console every 5 minutes.&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;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
setTimer(function()&lt;br /&gt;
    local div = 1024^2&lt;br /&gt;
&lt;br /&gt;
    local pmem = getProcessMemoryStats()&lt;br /&gt;
&lt;br /&gt;
    if pmem then&lt;br /&gt;
        outputServerLog((&amp;quot;[SYS] %.2f MiB  rss:%.2f MiB  shr:%.2f MiB  prv:%.2f MiB&amp;quot;):format(&lt;br /&gt;
            pmem.virtual / div,&lt;br /&gt;
            pmem.resident / div,&lt;br /&gt;
            pmem.shared / div,&lt;br /&gt;
            pmem.private / div&lt;br /&gt;
        ))&lt;br /&gt;
    end&lt;br /&gt;
end, 5 * 60000, 0)&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;
{{Utility functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineReplaceModel&amp;diff=75640</id>
		<title>EngineReplaceModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineReplaceModel&amp;diff=75640"/>
		<updated>2022-11-03T13:27:33Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
&lt;br /&gt;
This function replaces the given model ID with the model contained in a DFF file loaded by [[engineLoadDFF]]. This function supports [[vehicle|vehicles]], [[object|objects]], [[ped|peds]] and [[player|players]] but not CJ clothing and body parts.&lt;br /&gt;
&lt;br /&gt;
{{Deprecated feature|3.0111|1.1.1|This function does not support ped and weapon models.}}&lt;br /&gt;
&lt;br /&gt;
To replace weapon models you must use their object IDs, not weapon IDs. There is a weapon model list available at [[weapons]].&lt;br /&gt;
{{Note|&lt;br /&gt;
* Please note the loading order that is used in the examples as other orders can cause collisions, textures or the DFF not to load due to technical limitations.&lt;br /&gt;
* Default GTA map objects behave inconsistently when using this function on them. If you want to replace models in the original GTA map, use one of the [[EngineReplaceModel notes|methods shown here]].&lt;br /&gt;
* A raw data DFF element can only be used once, because the underlying memory for the model is released after replacement.&lt;br /&gt;
* If the replacement model is broken and the original model is not loaded/streamed-in at the time of replacement, this function will succeed and you won't see any error message, neither when the model replacement fails once the original model starts to load/stream-in.}}&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 engineReplaceModel ( dff theModel, int modelID [, bool alphaTransparency = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[DFF|dff]]:replace}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theModel:''' The model to replace the given model ID with&lt;br /&gt;
*'''modelID:''' The model it to replace the model of&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''alphaTransparency:''' Set to true if model uses semi-transparent textures, e.g. windows. This will ensure other objects behind the semi-transparent textures are rendered correctly. (Can slightly impact performance, so only set when required)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the model was successfully replaced, ''false'' if it failed for some reason, ie. the DFF or the model ID is not valid.&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;
This example allows you to replace single or many models (with ability to toggle TXD filtering/DFF alpha transparency) - by using [[table]]. Do not forget to add those file paths to [[meta.xml]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onClientResourceStartReplaceModels()&lt;br /&gt;
	local modelsToReplace = {&lt;br /&gt;
		{ -- replace object&lt;br /&gt;
			colFile = &amp;quot;object.col&amp;quot;,&lt;br /&gt;
			txdFile = &amp;quot;object.txd&amp;quot;,&lt;br /&gt;
			dffFile = &amp;quot;object.dff&amp;quot;,&lt;br /&gt;
			modelID = 1337,&lt;br /&gt;
			alphaTransparency = false,&lt;br /&gt;
			filteringEnabled = true,&lt;br /&gt;
		},&lt;br /&gt;
		{ -- replace vehicle&lt;br /&gt;
			colFile = false, -- if .col is not present set to false/nil&lt;br /&gt;
			txdFile = &amp;quot;vehicle.txd&amp;quot;,&lt;br /&gt;
			dffFile = &amp;quot;vehicle.dff&amp;quot;,&lt;br /&gt;
			modelID = 434,&lt;br /&gt;
			alphaTransparency = false,&lt;br /&gt;
			filteringEnabled = true,&lt;br /&gt;
		},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	for assetID = 1, #modelsToReplace do&lt;br /&gt;
		local modelData = modelsToReplace[assetID]&lt;br /&gt;
		local modelCol = modelData.colFile&lt;br /&gt;
		local modelTxd = modelData.txdFile&lt;br /&gt;
		local modelDff = modelData.dffFile&lt;br /&gt;
		local modelID = modelData.modelID&lt;br /&gt;
&lt;br /&gt;
		if modelCol then&lt;br /&gt;
			local colData = engineLoadCOL(modelCol)&lt;br /&gt;
&lt;br /&gt;
			if colData then&lt;br /&gt;
				engineReplaceCOL(colData, modelID)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if modelTxd then&lt;br /&gt;
			local filteringEnabled = modelData.filteringEnabled&lt;br /&gt;
			local txdData = engineLoadTXD(modelTxd, filteringEnabled)&lt;br /&gt;
&lt;br /&gt;
			if txdData then&lt;br /&gt;
				engineImportTXD(txdData, modelID)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if modelDff then&lt;br /&gt;
			local dffData = engineLoadDFF(modelDff)&lt;br /&gt;
&lt;br /&gt;
			if dffData then&lt;br /&gt;
				local alphaTransparency = modelData.alphaTransparency&lt;br /&gt;
				&lt;br /&gt;
				engineReplaceModel(dffData, modelID, alphaTransparency)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, onClientResourceStartReplaceModels)&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;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=How_you_can_help&amp;diff=75639</id>
		<title>How you can help</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=How_you_can_help&amp;diff=75639"/>
		<updated>2022-11-03T13:16:07Z</updated>

		<summary type="html">&lt;p&gt;Botder: Reverted edits by Absolwent (talk) to last revision by Lopez&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Multi Theft Auto has loads of areas in which you can help us. In turn, we'll be more than happy to help you get started with any ideas you have, help test them and - if they're good enough - release them to the whole community. This page outlines the key areas you could do something in, of course, there are many things we've not thought of, so think outside the box!&lt;br /&gt;
&lt;br /&gt;
==Coding for MTA:SA==&lt;br /&gt;
* Become a patch contributor by sending [https://github.com/multitheftauto/mtasa-blue/pulls pull requests] to MTA, containing requested features or bugfixes. ([https://github.com/multitheftauto/mtasa-blue/blob/master/CONTRIBUTING.md#contributors-guide Coding guidelines])&lt;br /&gt;
* Translate MTA:SA to your native language - https://translate.multitheftauto.com/&lt;br /&gt;
&lt;br /&gt;
==Scripting==&lt;br /&gt;
* Become a contributor to MTA's official resources by sending [https://github.com/multitheftauto/mtasa-resources/pulls pull requests] to our resources repository&lt;br /&gt;
* Create and [https://community.mtasa.com/ publish] a gamemode or useful script&lt;br /&gt;
**[[Scripting Introduction]]&lt;br /&gt;
**[https://www.lua.org/pil/index.html &amp;quot;Programming in Lua&amp;quot; Manual]&lt;br /&gt;
* Make a general purpose resource that provides useful functions to other resources.&lt;br /&gt;
&lt;br /&gt;
==Mapping==&lt;br /&gt;
* Create and [https://community.mtasa.com/ publish] a map for an existing gamemode, with the map editor.&lt;br /&gt;
**[[Resource:Editor|Map Editor Manual]]&lt;br /&gt;
&lt;br /&gt;
==Web development==&lt;br /&gt;
* Create your own system for statistics - using the [[PHP SDK]] as a basis. Join the [https://discord.gg/RygaCSD MTA discord] (or [https://discord.gg/GNN6PRtTnu development discord]) for help.&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
Before you make changes check out: [[Help:Editing Guidelines|Editing Guidelines]] and [[Help:MTA Wiki Specific Templates|Specific Templates]]&lt;br /&gt;
* Finish documentation for [[:Category:Incomplete|Incomplete functions]] - ask in #mta.scripting if you're not sure of something.&lt;br /&gt;
* Add examples to [[:Category:Needs Example|functions &amp;amp; events missing examples]] - please '''test''' them, and again, ask if you need help.&lt;br /&gt;
* Review and verify [[:Category:Needs Checking|pages that need checking]] - make sure highlighted issues are solved before removing pages from the category.&lt;br /&gt;
* Expand the pages that explain [[:Category:Scripting_Concepts|MTA core concepts]].&lt;br /&gt;
* Write [https://forum.mtasa.com/forum/123-tutorials/ tutorials] to help new people.&lt;br /&gt;
* Translate the wiki pages so people from other countries can get started in MTA too.&lt;br /&gt;
* Create documentation for undocumented functions and events [[Undocumented Items]]&lt;br /&gt;
* Keep 'changes in' [current work-in-progress: https://wiki.multitheftauto.com/wiki/Changes_in_1.6] for future releases updated.&lt;br /&gt;
&lt;br /&gt;
==Quality Assurance==&lt;br /&gt;
* [https://github.com/multitheftauto/mtasa-blue/issues Report issues] with the mod, make sure to do a search on the already reported issues first.&lt;br /&gt;
* Test and confirm existing reported issues.&lt;br /&gt;
* Use the newest build of MTA to detect and report new bugs, by going to 'Settings', 'Advanced', 'Update build type' and choosing 'Nightly' or get it regularly [https://nightly.mtasa.com/ from here].&lt;br /&gt;
* Any bugs which are related to a scripting function / event and present in the main release (rather than nightlies), document that bug by adding a [https://wiki.multitheftauto.com/wiki/Help:MTA_Wiki_Specific_Templates warning] to the wiki page to save other scripters a lot of time.&lt;br /&gt;
&lt;br /&gt;
==Specific tasks==&lt;br /&gt;
* Create a fuzzer to check for crashes in our scripting functions.&lt;br /&gt;
&lt;br /&gt;
==Grant==&lt;br /&gt;
You can donate to MTA:SA [https://mtasa.com/donate/manage.php here]&lt;br /&gt;
&lt;br /&gt;
[[ar:كيف_يمكنك_المساعدة]]&lt;br /&gt;
[[en:How you can help]]&lt;br /&gt;
[[ru:How you can help]]&lt;br /&gt;
[[pl:Jak możesz pomóc]]&lt;br /&gt;
[[uk:How you can help]]&lt;br /&gt;
[[es:Cómo puedes ayudar]]&lt;br /&gt;
[[hu:How you can help]]&lt;br /&gt;
[[tr:Nasıl yardımcı olabilirsiniz]]&lt;br /&gt;
[[pt-br:Como você pode ajudar]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Strona_g%C5%82%C3%B3wna&amp;diff=75638</id>
		<title>Strona główna</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Strona_g%C5%82%C3%B3wna&amp;diff=75638"/>
		<updated>2022-11-03T13:15:56Z</updated>

		<summary type="html">&lt;p&gt;Botder: Reverted edits by Absolwent (talk) to last revision by Tracer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;/*border: 1px solid #D8D8D8;*/ padding-left: 15px; padding-right: 15px; height: 100%;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Mtalogo.png|left|100px|link=http://wiki.multitheftauto.com/]]'''Witaj na polskiej wiki [[PL/Multi Theft Auto|Multi Theft Auto]].''' Znajdziesz tutaj wiele informacji na temat korzystania z Multi Theft Auto.&lt;br /&gt;
 &lt;br /&gt;
Jest wiele [[PL/How you can help|rzeczy które możesz zrobić]], aby pomóc nam w rozwijaniu MTA - stworzyć mapę, tryb gry, pomóc w dokumentowaniu funkcji, napisać przykładowy kod, napisać poradnik lub po prostu grać w MTA i zgłaszać błędy, które znajdziesz.&lt;br /&gt;
&lt;br /&gt;
Jeśli masz jakieś pytania bądź problemy związane z pisaniem skryptów, zapytaj nas na [[PL/IRC Channel|kanale IRC]].&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;[ Przestań się bawić ze sobą ]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px; background: #FFFCF2;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:Input-gaming.png‎|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Graj&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #FFEEAA; border: 1px solid #FFCD19;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Go-down.png|link=http://mtasa.com/]] ''' [http://mtasa.com/ Pobierz Multi Theft Auto: San Andreas {{Current Version|full}}]'''&amp;lt;/div&amp;gt;&lt;br /&gt;
* [[PL/Where to buy GTASA|Gdzie kupić GTASA]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[PL/Client Manual|Obsługa klienta]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
&amp;lt;!-- * [[PL/Changes_in_{{padleft:|3|{{Current Version|full}}}}| Zmiany w {{padleft:|3|{{Current Version|full}}}}]] --&amp;gt;&lt;br /&gt;
* [[Changes_in_{{padleft:|5|{{Current Version|full}}}}|Zmiany w {{padleft:|5|{{Current Version|full}}}}]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
* [[PL/Known_Issues_-_FAQ|Znane problemy]] [[Image:Plflag.png|Artykuł w języku polskim]] / [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
* [[PL/Migracja_z_MTA:Race_do_MTA:SA_1.0.x|Migracja z MTA:Race do MTA:SA {{padleft:|3|{{Current Version|full}}}}]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[PL/Server Manual|Obsługa serwera]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[Map manager|Menadżer map]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Edytor map&amp;lt;/h3&amp;gt;&lt;br /&gt;
*[[PL/Resource:Editor|Instrukcja]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Resource:Editor/EDF|Edytor Właściwości Mapy]] [[Image:Plflag.png|Artykuł w języku polskim]] / [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
*[[Resource:Editor/Plugins|Pluginy]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
*[[PL/Resource:Editor#FAQ|Najczęściej zadawane pytania]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:Package-x-generic.png‎|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Bazy danych&amp;lt;/h3&amp;gt;&lt;br /&gt;
Ta sekcja opisuje wszystkie możliwości Lua umożliwiane przez MTA lub zasoby.&lt;br /&gt;
* [[PL/Category:Resource|Katalog zasobów]] - Musisz je poznać, aby tworzyć właściwe skrypty&lt;br /&gt;
* [[PL/Client side scripts|Skrypty po stronie klienta]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[Moduły]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:Applications-development.png‎‎‎|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Rozwijanie Multi Theft Auto&amp;lt;/h3&amp;gt;&lt;br /&gt;
[[File:Go-down.png|link=http://nightly.mtasa.com/]] [http://nightly.mtasa.com/ Nightly builds]&lt;br /&gt;
* [[Compiling_MTASA|Kompilacja MTASA na Windows]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
* [[Building_MTASA_Server_on_GNU_Linux|Kompilacja MTASA na GNU/Linux]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
* [[Coding guidelines|Wytyczne dot. pisania kodu]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
* [https://github.com/multitheftauto/mtasa-blue Repozytorium Github]&lt;br /&gt;
* [[Roadmap]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
* [http://bugs.mtasa.com/ Bugtracker]&lt;br /&gt;
* [[Branches|Branże]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:Applications-office.png|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Polskie Wiki - jak możesz pomóc?&amp;lt;/h3&amp;gt;&lt;br /&gt;
* Pomóż tłumaczyć hasła, przy których jest angielska flaga&lt;br /&gt;
* Twórz hasła, które istnieją w angielskiej wiki, a których u nas brakuje&lt;br /&gt;
** Staraj się, aby nowe artykuły miały takie same nazwy (angielskie), a jedynie poprzedzane były przedrostkiem PL/ - przykład: [[PL/Character_Skins]]&lt;br /&gt;
* Zwołaj znajomych, informuj na forach, niech inni dowiedzą się o takiej możliwości!&lt;br /&gt;
* Jeśli nie masz pomysłu na edycję, wykonaj coś z [[PL/Todo|tej listy]]. Możesz ją także rozbudować.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:Internet-group-chat.png‎|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Społeczność&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [http://forum.multitheftauto.com/ Forum]&lt;br /&gt;
* Discord: [https://forum.mtasa.com/topic/95008-multi-theft-autos-official-discord-server/ Oficjalny serwer Discord MTA]&lt;br /&gt;
* IRC: [irc://irc.multitheftauto.com/mta irc.multitheftauto.com #mta]&lt;br /&gt;
* [http://community.mtasa.com/ MTA Community]  - dodaj lub pobierz skrypty&lt;br /&gt;
* [http://twitter.com/#!/MTAQA/ Twitter] - [http://www.youtube.com/user/MTAQA Youtube] - [http://plus.google.com/102014133442331779727/ Google+] - [http://www.moddb.com/mods/multi-theft-auto-san-andreas ModDB]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:Accessories-text-editor.png|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Skryptowanie&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[Wstęp do pisania skryptów]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[Wstęp do pisania skryptów GUI]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[Debugging|Poradnik debugowania]] [[Image:usen.gif|Artykuł w języku angielskim]] - Jak znaleźć błędy w swoich skryptach&lt;br /&gt;
* [[PL/Zasoby|Wstęp do zasobów]] [[Image:Plflag.png|Artykuł w języku angielskim]]&lt;br /&gt;
** [[Resource Web Access|Dostęp WWW do zasobów]] [[Image:usen.gif|Artykuł w języku angielskim]] - Jak pisać strony WWW z wykorzystaniem zasobów&lt;br /&gt;
** [[:Category:Resource|Katalog zasobów]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
** [[PL/Meta.xml|Meta.xml]] [[Image:Plflag.png|Artykuł w języku polskim]] - każdy zasób jest definiowany przez plik meta&lt;br /&gt;
** [[ACL]] [[Image:usen.gif|Artykuł w języku angielskim]] - Access Control List, który jest niezbędny, aby skrypty działały&lt;br /&gt;
* [[Writing_Gamemodes|Pisanie gamemodów]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
* [[Przydatne Funkcje]] [[Image:Plflag.png|Artykuł w polskim]]&lt;br /&gt;
Linki na fora&lt;br /&gt;
* [https://forum.mtasa.com/forum/71-scripting/ Forum na temat skryptowania]&lt;br /&gt;
* [https://forum.mtasa.com/forum/123-tutorials/ Forum z poradnikami do skryptowania]&lt;br /&gt;
* [https://forum.mtasa.com/topic/24702-mtasa-wiki-offline-copies-online-mirrors/ Kopie Wiki]&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:start-here.png|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Pomoc dotycząca LUA&amp;lt;/h3&amp;gt;&lt;br /&gt;
Strony zaprojektowane, by pomóc Ci zrozumieć język LUA.&lt;br /&gt;
*[http://www.lua.org/pil/index.html &amp;quot;Programming in Lua&amp;quot; Manual]&lt;br /&gt;
**[http://www.lua.org/manual/5.1/#index Internal Lua functions reference]&lt;br /&gt;
*[http://lua-users.org/wiki/TutorialDirectory Lua Wiki]&lt;br /&gt;
*[http://nixstaller.sourceforge.net/manual/0.5.1/nixstaller_10.html A general guide to Lua from Nixstaller]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px; background:#F2F2FF;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:Preferences-system.png|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Odwołania&amp;lt;/h3&amp;gt;&lt;br /&gt;
* [[PL/Funkcje po stronie klienta|Funkcje po stronie klienta]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[PL/Client Scripting Events|Zdarzenia po stronie klienta]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[PL/Server Scripting Functions|Funkcje po stronie serwera]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
* [[Server Scripting Events|Zdarzenia po stronie serwera]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
&amp;lt;!-- Incomplete * [[Module functions|Server-side external module scripting functions list]] --&amp;gt;&lt;br /&gt;
* [[PL/MTA Classes|Klasy MTA]] [[Image:Plflag.png|Artykuł w języku polskim]] / [[Image:usen.gif|Artykuł w języku angielskim]] -- Szczegółowe opisy wszystkich typów MTA&lt;br /&gt;
** [[PL/Element|Elementy MTA]] [[Image:Plflag.png|Artykuł w języku angielskim]] / [[Element tree|Drzewo elementów]] [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #D8D8D8; padding:4px 8px 8px 8px; margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 32px;&amp;quot;&amp;gt;[[File:System-file-manager.png|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;[[PL/Id|Listy ID]]&amp;lt;/h3&amp;gt;&lt;br /&gt;
*[[PL/Animations|Animacje]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Character Skins|Skiny postaci]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/CJ_Clothes|Ubrania]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Garage|Garaże]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Interior IDs|Interiory]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Material IDs|Materiały]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Projectiles|Pociski]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Radar Blips|Znaczniki]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Sounds|Dźwięki]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Vehicle IDs|Pojazdy]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Vehicle Colors|Kolory pojazdów]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Vehicle Upgrades|Modyfikacje pojazdów]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Vehicle variants|Warianty pojazdów]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Vehicle component manipulation|Manipulowanie komponentami pojazdów]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Weapons|Bronie]] [[Image:Plflag.png|Artykuł w języku polskim]]&lt;br /&gt;
*[[PL/Weather|Pogoda]] [[Image:Plflag.png|Artykuł w języku polskim]] / [[Image:usen.gif|Artykuł w języku angielskim]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding:4px 8px 8px 8px; margin:10px;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Osi symbol.png|75px|link=http://opensource.org/|left]]&lt;br /&gt;
'''Multi Theft Auto''' jest '''Otwartym Oprogramowaniem'''. &lt;br /&gt;
&amp;lt;br/&amp;gt;To znaczy, że każdy może pomóc w byciu Multi Theft Auto lepszym!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
|}&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 15px; padding-right: 15px;&amp;quot; class=&amp;quot;plainlinks&amp;quot;&amp;gt;&lt;br /&gt;
[[File:MTALogo_8ball.png|left|85px|link=Archive]]&lt;br /&gt;
&amp;lt;ul style=&amp;quot;list-style: none; width: 200px; float: left;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;'''O [[PL/Multi Theft Auto|Multi Theft Auto]]'''&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;[[PL/Archive|Archiwum]]&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;[[Press Coverage|MTA w mediach]]&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;[http://code.google.com/p/mtasa-blue/people/list Developerzy]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;quot;list-style: none; width: 200px; float: left;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;'''Multi Theft Auto 0.5'''&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;[[PL/Archive#Multi_Theft_Auto_0.5|Pobierz]]&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;[[MTA 0.5r2 Known Issues|Zauważone problemy]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;quot;list-style: none; width: 200px; float: left;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;'''Statystyki Wiki'''&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;{{NUMBEROFARTICLES}} artykuły&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;{{NUMBEROFPAGES}} strony&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;{{NUMBEROFFILES}} pliki&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;quot;list-style: none; width: 240px; float: left;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;{{NUMBEROFEDITS}} edycji&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;{{NUMBEROFADMINS}} administratorów&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;{{NUMBEROFUSERS}} zarejestrowanych użytkowników&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;{{NUMBEROFACTIVEUSERS}} aktywnych użytkowników&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
__NOEDITSECTION__&lt;br /&gt;
{{Languages list|pl}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/Shared_Scripting_Functions&amp;diff=75249</id>
		<title>RU/Shared Scripting Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/Shared_Scripting_Functions&amp;diff=75249"/>
		<updated>2022-07-10T15:21:18Z</updated>

		<summary type="html">&lt;p&gt;Botder: Add XML translations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;both&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{RU/Adding_Pages_to_Categories_and_Templates}}&lt;br /&gt;
На этой странице перечислены все '''shared''' скриптовые функции, которые были реализованы и доступны как собственные функции из мода Deathmatch.&lt;br /&gt;
&lt;br /&gt;
Для получения дополнительных функций посмотрите [[Useful_Functions|страницу полезных функций]].&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Функции ввода==&lt;br /&gt;
{{Shared_input_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции взрыва==&lt;br /&gt;
{{Shared_explosion_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции воды==&lt;br /&gt;
{{RU/Shared_water_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции вывода==&lt;br /&gt;
{{Shared_output_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции звука==&lt;br /&gt;
{{Shared_sound_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции игрока==&lt;br /&gt;
{{Shared_player_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции камеры==&lt;br /&gt;
{{Shared_camera_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции коллизии==&lt;br /&gt;
{{Shared_collision_shape_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции курсора==&lt;br /&gt;
{{Shared_cursor_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции маркера==&lt;br /&gt;
{{Shared_marker_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции матрицы==&lt;br /&gt;
{{Shared_matrix_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции меток на радаре==&lt;br /&gt;
{{Shared_blip_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции мира==&lt;br /&gt;
{{Shared_world_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции объекта==&lt;br /&gt;
{{Shared_object_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции оружия==&lt;br /&gt;
{{RU/Shared_weapon_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции пешехода (NPC)==&lt;br /&gt;
{{Shared_ped_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции пикапа==&lt;br /&gt;
{{Shared_pickup_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции ресурса==&lt;br /&gt;
{{RU/Shared_resource_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции сервера==&lt;br /&gt;
{{Shared_server_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции снаряда==&lt;br /&gt;
{{Shared_projectile_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции события==&lt;br /&gt;
{{RU/Shared_event_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции тела и одежды==&lt;br /&gt;
{{Shared_clothes_and_body_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции территории радара==&lt;br /&gt;
{{Shared_radar_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции транспорта==&lt;br /&gt;
{{Shared_vehicle_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции утилит==&lt;br /&gt;
{{Shared_utility_functions}}&lt;br /&gt;
&lt;br /&gt;
==Файловые функции==&lt;br /&gt;
{{Shared_file_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции элемента==&lt;br /&gt;
{{RU/Shared_element_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции UTF-8==&lt;br /&gt;
{{Shared_utf8_functions}}&lt;br /&gt;
&lt;br /&gt;
==Функции XML==&lt;br /&gt;
{{RU/Shared_XML_functions}}&lt;br /&gt;
&lt;br /&gt;
[[en:Shared Scripting Functions]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Shared_Scripting_Functions&amp;diff=75248</id>
		<title>Shared Scripting Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Shared_Scripting_Functions&amp;diff=75248"/>
		<updated>2022-07-10T15:19:16Z</updated>

		<summary type="html">&lt;p&gt;Botder: Undo last two edits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;both&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{Adding_Pages_to_Categories_and_Templates}}&lt;br /&gt;
This page lists all the '''shared''' scripting functions that have been implemented and are available as native functions from the Deathmatch mod. To request a function or event, use [[Requested Functions and Events]]&lt;br /&gt;
&lt;br /&gt;
For more functions, check the [[Useful_Functions|useful functions page]].&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Element functions==&lt;br /&gt;
{{Shared_element_functions}}&lt;br /&gt;
&lt;br /&gt;
==Ped functions==&lt;br /&gt;
{{Shared_ped_functions}}&lt;br /&gt;
&lt;br /&gt;
==Player functions==&lt;br /&gt;
{{Shared_player_functions}}&lt;br /&gt;
&lt;br /&gt;
==Weapon functions==&lt;br /&gt;
{{Shared_weapon_functions}}&lt;br /&gt;
&lt;br /&gt;
==Sound functions==&lt;br /&gt;
{{Shared_sound_functions}}&lt;br /&gt;
&lt;br /&gt;
==Blip functions==&lt;br /&gt;
{{Shared_blip_functions}}&lt;br /&gt;
&lt;br /&gt;
==Camera functions==&lt;br /&gt;
{{Shared_camera_functions}}&lt;br /&gt;
&lt;br /&gt;
==Clothes and body functions==&lt;br /&gt;
{{Shared_clothes_and_body_functions}}&lt;br /&gt;
&lt;br /&gt;
==Collision shape functions==&lt;br /&gt;
{{Shared_collision_shape_functions}}&lt;br /&gt;
&lt;br /&gt;
==Cursor functions==&lt;br /&gt;
{{Shared_cursor_functions}}&lt;br /&gt;
&lt;br /&gt;
==Event functions==&lt;br /&gt;
{{Shared_event_functions}}&lt;br /&gt;
&lt;br /&gt;
==Explosion functions==&lt;br /&gt;
{{Shared_explosion_functions}}&lt;br /&gt;
&lt;br /&gt;
==File functions==&lt;br /&gt;
{{Shared_file_functions}}&lt;br /&gt;
&lt;br /&gt;
==Input functions==&lt;br /&gt;
{{Shared_input_functions}}&lt;br /&gt;
&lt;br /&gt;
==Marker functions==&lt;br /&gt;
{{Shared_marker_functions}}&lt;br /&gt;
&lt;br /&gt;
==Matrix functions==&lt;br /&gt;
{{Shared_matrix_functions}}&lt;br /&gt;
&lt;br /&gt;
==Object functions==&lt;br /&gt;
{{Shared_object_functions}}&lt;br /&gt;
&lt;br /&gt;
==Output functions==&lt;br /&gt;
{{Shared_output_functions}}&lt;br /&gt;
&lt;br /&gt;
==Pickup functions==&lt;br /&gt;
{{Shared_pickup_functions}}&lt;br /&gt;
&lt;br /&gt;
==Projectile functions==&lt;br /&gt;
{{Shared_projectile_functions}}&lt;br /&gt;
&lt;br /&gt;
==Radar functions==&lt;br /&gt;
{{Shared_radar_functions}}&lt;br /&gt;
&lt;br /&gt;
==Resource functions==&lt;br /&gt;
{{Shared_resource_functions}}&lt;br /&gt;
&lt;br /&gt;
==Server functions==&lt;br /&gt;
{{Shared_server_functions}}&lt;br /&gt;
&lt;br /&gt;
==Utility functions==&lt;br /&gt;
{{Shared_utility_functions}}&lt;br /&gt;
&lt;br /&gt;
==UTF8 Library==&lt;br /&gt;
{{Shared_utf8_functions}}&lt;br /&gt;
&lt;br /&gt;
==Vehicle functions==&lt;br /&gt;
{{Shared_vehicle_functions}}&lt;br /&gt;
&lt;br /&gt;
==Water functions==&lt;br /&gt;
{{Shared_water_functions}}&lt;br /&gt;
&lt;br /&gt;
==World functions==&lt;br /&gt;
{{Shared_world_functions}}&lt;br /&gt;
&lt;br /&gt;
==XML functions==&lt;br /&gt;
{{Shared_xml_functions}}&lt;br /&gt;
&lt;br /&gt;
[[ru:Shared Scripting Functions]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=75217</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=75217"/>
		<updated>2022-07-01T18:36:20Z</updated>

		<summary type="html">&lt;p&gt;Botder: /* Gridlists */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
=== Table functions ===&lt;br /&gt;
*[[addTableChangeHandler]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function monitors the changes of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTableFromSql]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns true if the value exists in the table, false if the value does not exist in the table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[pairsByKeys]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sort pairs table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[rangeToTable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a string range to a table containing number values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableToSql]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to save the table in the database (sql).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Sort_Functions]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» These functions are able to sort your tables by a key.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.compare]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether two given tables are equal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.deepmerge]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function deep merges two tables. Every nested table will be correspondingly merged.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.element]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a new table with only userdata content.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a table is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.fromString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts string to a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.getRandomRows]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns random rows from table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.merge]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function merges two or more tables together.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random value from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.removeValue]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function removes a specified value from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.toString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts table to a string.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ACL functions ===&lt;br /&gt;
*[[aclGroupClone]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function clone a group to another group with/without ACLs and/or objects.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAccountsRanks]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to detect the account name groups and put them in the chat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerAcls]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all ACL groups on a player.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInACLGroup]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns all players in an ACL group.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInACL]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a player element is in an ACL group.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[renameAclGroup]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gives an existing ACL group a new name.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Account functions ===&lt;br /&gt;
*[[getPlayerFromAccountName]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to obtain a player by the name of his account.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Camera functions ===&lt;br /&gt;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to create a cinematic camera flight.&lt;br /&gt;
&lt;br /&gt;
=== Cursor functions ===&lt;br /&gt;
*[[getCursorMovedOn]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Drawing functions ===&lt;br /&gt;
*[[dxDrawAnimWindow]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws an animated 2D window on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawBorderedRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a bordered rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawBorderedText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a bordered text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawDashedLine]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a line with dashes.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites in 2D.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImageOnElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws an image on any element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawLinedRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a rectangle outline with dx lines.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawLoading]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a loading bar on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawOctagon3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a 3D Octagon&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawPolygon]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a custom polygon on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawProgressBar]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function simulates a progress bar drawed using DirectDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangleOnPlayer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle above the player.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRing]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a ring with dx lines.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRombo]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a Rhombus.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawSprite]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draw a sprite in the 3D world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTextOnElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a text on any element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTextOnRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Esta funcion crea un rectangle con un texto dentro.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTriangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a triangle with dx lines.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the font size from given height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getScreenStartPositionFromBox]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function helps with getting the correct position for your dx-effects.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wordWrap]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function breaks a long string into a table of separate lines limited to a specific length in pixels, for drawing separately.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[CreateRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a 3d rectangle on the player screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Effects functions ===&lt;br /&gt;
*[[attachEffect]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you attach an effect to an element.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Element functions === &lt;br /&gt;
*[[autoAttach]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function attaches one element into another at the same position and rotation they are.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementPlayer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether the element is a player or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[attachElementToBone]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to attach an element to ped bone accurately using new bone functions.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsInDimension]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of elements that are in the specified dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the specified element's speed in m/s, km/h or mph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsWithinMarker]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of elements that are within a marker's collision shape.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementUsingData]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns table elements that contains the elements data with the given key and value.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getNearestElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the nearest element (of a specific type) to a player.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is in the player's camera picture area.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check if an element's range to a main point is within the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementWithinAColShape]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is within a collision shape element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInAir]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is in air or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set the speed of an element in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Input functions ===&lt;br /&gt;
*[[bindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBoundControls]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of control names that are bound to the specified key.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[unbindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Data functions === &lt;br /&gt;
*[[byte2human]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts an integer (number of bytes) into a human-readable unit.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[capitalize]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function capitalizes a given string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertDate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts date to another look.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertServerTickToTimeStamp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts server ticks to a unix timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertTextToSpeech]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts the provided text to a speech in the provided language which players can hear.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[formatDate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[formatNumber]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function formats large numbers by adding commas.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateRandomASCIIString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a random string which uses ASCII characters. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function generates a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a given birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenElements]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Returns the distance between two elements.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getEasterDate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns easter date monthday and month for a given year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getFreeDimension]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function get free dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getKeyFromValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the key of the specified value in a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRealMonth]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the current month name&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRGColorFromPercentage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia', sans-serif; font-size:smaller;&amp;quot;&amp;gt;»This function returns two integers representing red and green colors according to the specified percentage.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getScreenRotationFromWorldPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a screen relative rotation to a world position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the UNIX timestamp of a specified date and time.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[gradientString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function transforms a string in a new coloured gradient string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[hex2rgb]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert hex to rgb.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[hexColorToRGB]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert hex string/number to RGBA values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a boolean representing if a given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isValidMail]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a provided e-mail string is valid.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[removeHex]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to remove hexadecimal numbers (colors, for example) from strings.&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHSV]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert RGB to HSV color space.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToDecimal]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert RGB to Decimal color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[secondsToTimeDesc]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a plain seconds-integer into a user-friendly time description.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function counts the amount of occurences of a string in a string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.insert]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function inserts a string within another string at a given position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[tocolor2rgba]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert tocolor to rgba.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a physical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GUI functions === &lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function centers a CEGUI window element responsively in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiMoveElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function moves guiElement by/like using moveObject.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiSetStaticImageMovable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to move a static image like a gui window.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseOnGUICloseButton]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check whether the mouse cursor/pointer is within a gui-window's native close button.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseOnGuiElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check whether or not your mouse is over a specific gui element, this is especially useful if the gui element has a parent. &amp;lt;/span&amp;gt;&lt;br /&gt;
=====Comboboxes=====&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function adjusts a CEGUI combobox element to have the correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Gridlists=====&lt;br /&gt;
*[[convertGridListToText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts grid list contents to text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getGridListRowIndexFromText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the GridList row index from the specified text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListAddPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function add all online players to a grid list.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListGetColumnIDFromTitle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a gridlist's column ID from the column title.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListGetSelectedText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string containing the inner text of a selected gridlist item.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListSetColumnNonSortable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function makes a gridlist column become non-sortable.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isTextInGridList]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if some text exist or not in the GridList.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Labels=====&lt;br /&gt;
*[[guiLabelAddEffect]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function add an effects to the gui-label like (shadow, outline).&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Marker functions ===&lt;br /&gt;
*[[createMarkerAttachedTo]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a marker that is attached to an element.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Math functions ===&lt;br /&gt;
*[[math.clamp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the number between range of numbers or it's minimum or maximum.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.getBezierPoint]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Get N-th order bezier point.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.hypot]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the Hypotenuse of the triangle given by sides x and y.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.isPointInPolygon]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Check if point is inside polygon or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.lerp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Get val between two integer.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.percent]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a percentage from two number values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.polygonArea]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Compute area of any polygon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.randomDiff]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Generates a pseudo-random integer that's always different from the last random number generated.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.rotVecToEulerAngle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Rotation Vector To Euler Angle&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mathNumber]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is a workaround for the client-side floating-point precision of 24-bits.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[reMap]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Re-maps a number from one range to another.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Math.percentProgress|math.percentProgress]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Returns a percentage progress from two specific values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.average]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the simple arithmetic mean of multiple numbers.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Map functions ===&lt;br /&gt;
*[[assignLod]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function lets you conveniently generate and apply a LOD model to a mapping object.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getWorldPositionFromMapPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts an F11 map position to world position.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ped functions ===&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players client-side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getGuestPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a players not login or players Guest .&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all logged-in administrators.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedEyesPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get peds eyes position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedGender]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get peds their gender.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxHealth]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a pedestrians's maximum health by converting it from their maximum health stat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxOxygenLevel]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedWeaponSkill]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a ped's corresponding weapon skill level name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedHitBone]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets the approximate number of the bone where the ped is hit.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from partial name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromSerial]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from their serial.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersByData]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of players that have the specified data name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all players in photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInVehicles]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the players insides vehicles from a specified dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a pedestrian is aiming their weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAimingNearPed]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is similar to isPedAiming but uses a colshape to be more precise.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedDiving]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This feature checks that pedestrian is diving in the water.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedDrivingVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified pedestrian is driving a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a player is in a specified team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setPedAttack]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function will make a ped attack a specified target.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setPedFollow]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function will make a ped follow a specified target.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerNameFromID]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function will get the player name from the ID element data.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Player functions ===&lt;br /&gt;
*[[countPlayersInRange]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the number of players that are within a certain range of the specified coordinates.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerPreviousAndNextWeapon]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the player previous and next weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInRange]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function make a table of players within certain range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerHitByVehicle]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function cancels event when a element is hit by a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[warpToPlayer]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function make player warp to another player.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Resource functions ===&lt;br /&gt;
*[[getFilesInResourceFolder]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a list of files that are inside a folder of a resource.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceScripts]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource scripts.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSize]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the size of a specified resource in kB(kilobyte)&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[refreshResource]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function refreshes your resource if you changed any of the files&lt;br /&gt;
*[[setResourcePriority]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function set resource download priority group.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sound functions ===&lt;br /&gt;
*[[isSoundFinished]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element has finished.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isSoundPlaying]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element is playing or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[stopSoundSlowly]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function stop your sound element slowly.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Browser functions ===&lt;br /&gt;
*[[playVideo]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function plays a video on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Team functions ===&lt;br /&gt;
*[[getTeamFromColor]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a team element by the specified color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTeamWithFewestPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a team element with least players of all the specified teams.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vehicle functions ===&lt;br /&gt;
*[[findEmptyCarSeat]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function finds you the first empty seat in a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getNearestVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets the nearest vehicle to the specified player in a specified distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRandomVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a random vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getValidVehicleModels]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all valid vehicle models.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getVehiclesCountByType]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the amount of vehicles by the given type as an integer value.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getVehicleTurnVelocityCenterOfMass]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleDoubleExhaust]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks is exhaust vehicle double.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleEmpty]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a vehicle is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOccupied]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified vehicle is occupied.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleReversing]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified vehicle is moving backwards.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleUpgraded]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks is vehicle upgraded by upgrade ID.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleTurnVelocityCenterOfMass]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleHandlingFromText]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sets a vehicle's handling from text.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weapon functions === &lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Object functions ===&lt;br /&gt;
*[[getDynamicDoorObjectOpenRatio]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function tells you how open a dynamic door is in a range from 0 to 1.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementObject]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function tells you if an element is an object or no.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== XML functions ===&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns all children of a XML node.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Engine functions ===&lt;br /&gt;
*[[engineGetCOLsFromLibrary]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets the collision data from the col library.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[engineLoadIMGContainer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function loads the IMG container.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Utility ===&lt;br /&gt;
*[[animate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to use interpolateBetween without render event and easily used.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any client-side function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[check]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if its arguments are of the right type and calls the error-function if one is not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[checkPassiveTimer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to use passive timers in your conditions. For example you want to prevent players r&lt;br /&gt;
epeatedly using a command.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function applies a fix for hidden coroutine error messages.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[compact]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function create table containing variables and their values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBanFromName]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This functions returns the ban of the given playername.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCurrentFPS]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the frames per second at which GTA: SA is running.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getSkinNameFromID]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the name of the skin from the given id.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isCharInString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This shared function allows you to check if a char specified is in a string value.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseInCircle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a cursor position is in circular area or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseInPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns ''a time-saving'' iterator for your for-loops.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[PlotTrajectoryAtTime]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Calculate projectile/water trajectory.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[preprocessor]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allow you to use gcc macros.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[vector3:compare]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This method checks whether two vectors match, with optional precision.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[svgCreateRoundedRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a rectangle with rounded edges.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Useful Functions]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=75215</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=75215"/>
		<updated>2022-07-01T18:27:10Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
=== Table functions ===&lt;br /&gt;
*[[addTableChangeHandler]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function monitors the changes of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTableFromSql]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ]).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns true if the value exists in the table, false if the value does not exist in the table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[pairsByKeys]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sort pairs table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[rangeToTable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a string range to a table containing number values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableToSql]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to save the table in the database (sql).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Sort_Functions]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» These functions are able to sort your tables by a key.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.compare]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether two given tables are equal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.deepmerge]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function deep merges two tables. Every nested table will be correspondingly merged.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.element]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a new table with only userdata content.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a table is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.fromString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts string to a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.getRandomRows]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns random rows from table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.merge]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function merges two or more tables together.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random value from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.removeValue]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function removes a specified value from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.toString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts table to a string.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ACL functions ===&lt;br /&gt;
*[[aclGroupClone]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function clone a group to another group with/without ACLs and/or objects.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAccountsRanks]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to detect the account name groups and put them in the chat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerAcls]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all ACL groups on a player.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInACLGroup]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns all players in an ACL group.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInACL]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a player element is in an ACL group.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[renameAclGroup]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gives an existing ACL group a new name.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Account functions ===&lt;br /&gt;
*[[getPlayerFromAccountName]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to obtain a player by the name of his account.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Camera functions ===&lt;br /&gt;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to create a cinematic camera flight.&lt;br /&gt;
&lt;br /&gt;
=== Cursor functions ===&lt;br /&gt;
*[[getCursorMovedOn]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Drawing functions ===&lt;br /&gt;
*[[dxDrawAnimWindow]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws an animated 2D window on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawBorderedRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a bordered rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawBorderedText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a bordered text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawDashedLine]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a line with dashes.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites in 2D.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImageOnElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws an image on any element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawLinedRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a rectangle outline with dx lines.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawLoading]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a loading bar on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawOctagon3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a 3D Octagon&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawPolygon]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a custom polygon on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawProgressBar]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function simulates a progress bar drawed using DirectDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangleOnPlayer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle above the player.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRing]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a ring with dx lines.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRombo]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a Rhombus.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawSprite]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draw a sprite in the 3D world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTextOnElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function draws a text on any element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTextOnRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Esta funcion crea un rectangle con un texto dentro.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTriangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a triangle with dx lines.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the font size from given height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getScreenStartPositionFromBox]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function helps with getting the correct position for your dx-effects.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wordWrap]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function breaks a long string into a table of separate lines limited to a specific length in pixels, for drawing separately.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[CreateRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is a function that will create a 3d rectangle on the player screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Effects functions ===&lt;br /&gt;
*[[attachEffect]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you attach an effect to an element.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Element functions === &lt;br /&gt;
*[[autoAttach]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function attaches one element into another at the same position and rotation they are.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementPlayer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether the element is a player or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[attachElementToBone]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to attach an element to ped bone accurately using new bone functions.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsInDimension]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of elements that are in the specified dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the specified element's speed in m/s, km/h or mph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsWithinMarker]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of elements that are within a marker's collision shape.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementUsingData]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns table elements that contains the elements data with the given key and value.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getNearestElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the nearest element (of a specific type) to a player.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is in the player's camera picture area.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check if an element's range to a main point is within the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementWithinAColShape]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is within a collision shape element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInAir]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is in air or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set the speed of an element in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Input functions ===&lt;br /&gt;
*[[bindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBoundControls]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of control names that are bound to the specified key.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[unbindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Data functions === &lt;br /&gt;
*[[byte2human]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts an integer (number of bytes) into a human-readable unit.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[capitalize]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function capitalizes a given string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertDate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts date to another look.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertServerTickToTimeStamp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts server ticks to a unix timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertTextToSpeech]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts the provided text to a speech in the provided language which players can hear.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation3D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function takes two sets of XYZ coordinates. It returns the 3D direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[formatDate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[formatNumber]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function formats large numbers by adding commas.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateRandomASCIIString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a random string which uses ASCII characters. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function generates a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a given birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenElements]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Returns the distance between two elements.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getEasterDate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns easter date monthday and month for a given year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getFreeDimension]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function get free dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getKeyFromValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the key of the specified value in a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRealMonth]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the current month name&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRGColorFromPercentage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia', sans-serif; font-size:smaller;&amp;quot;&amp;gt;»This function returns two integers representing red and green colors according to the specified percentage.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getScreenRotationFromWorldPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a screen relative rotation to a world position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the UNIX timestamp of a specified date and time.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[gradientString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function transforms a string in a new coloured gradient string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[hex2rgb]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert hex to rgb.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[hexColorToRGB]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert hex string/number to RGBA values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a boolean representing if a given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isValidMail]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a provided e-mail string is valid.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[removeHex]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is used to remove hexadecimal numbers (colors, for example) from strings.&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHSV]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert RGB to HSV color space.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToDecimal]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert RGB to Decimal color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[secondsToTimeDesc]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a plain seconds-integer into a user-friendly time description.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function counts the amount of occurences of a string in a string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.insert]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function inserts a string within another string at a given position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[tocolor2rgba]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function convert tocolor to rgba.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts a physical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GUI functions === &lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function centers a CEGUI window element responsively in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiMoveElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function moves guiElement by/like using moveObject.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiSetStaticImageMovable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to move a static image like a gui window.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseOnGUICloseButton]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check whether the mouse cursor/pointer is within a gui-window's native close button.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseOnGuiElement]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check whether or not your mouse is over a specific gui element, this is especially useful if the gui element has a parent. &amp;lt;/span&amp;gt;&lt;br /&gt;
=====Comboboxes=====&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function adjusts a CEGUI combobox element to have the correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Gridlists=====&lt;br /&gt;
*[[convertGridListToText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts grid list contents to text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getGridListRowIndexFromText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the GridList row index from the specified text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListAddPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function add all online players to a grid list.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListGetColumnIDFromTitle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a gridlist's column ID from the column title.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListGetSelectedText]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string containing the inner text of a selected gridlist item.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListSetColumnNonSortable]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function makes a gridlist column become non-sortable.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListSetColumnsFixedWidth]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function makes a gridlist have all its columns fixed width.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isTextInGridList]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if some text exist or not in the GridList.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Labels=====&lt;br /&gt;
*[[guiLabelAddEffect]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function add an effects to the gui-label like (shadow, outline).&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Marker functions ===&lt;br /&gt;
*[[createMarkerAttachedTo]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a marker that is attached to an element.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Math functions ===&lt;br /&gt;
*[[math.clamp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the number between range of numbers or it's minimum or maximum.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.getBezierPoint]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Get N-th order bezier point.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.hypot]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the Hypotenuse of the triangle given by sides x and y.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.isPointInPolygon]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Check if point is inside polygon or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.lerp]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Get val between two integer.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.percent]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a percentage from two number values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.polygonArea]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Compute area of any polygon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.randomDiff]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Generates a pseudo-random integer that's always different from the last random number generated.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.rotVecToEulerAngle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Rotation Vector To Euler Angle&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mathNumber]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function is a workaround for the client-side floating-point precision of 24-bits.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[reMap]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Re-maps a number from one range to another.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Math.percentProgress|math.percentProgress]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Returns a percentage progress from two specific values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.average]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the simple arithmetic mean of multiple numbers.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Map functions ===&lt;br /&gt;
*[[assignLod]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function lets you conveniently generate and apply a LOD model to a mapping object.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getWorldPositionFromMapPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function converts an F11 map position to world position.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ped functions ===&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players client-side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getGuestPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a players not login or players Guest .&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all logged-in administrators.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedEyesPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get peds eyes position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedGender]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get peds their gender.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxHealth]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a pedestrians's maximum health by converting it from their maximum health stat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxOxygenLevel]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedWeaponSkill]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a ped's corresponding weapon skill level name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedHitBone]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets the approximate number of the bone where the ped is hit.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from partial name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromSerial]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from their serial.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersByData]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of players that have the specified data name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all players in photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInVehicles]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the players insides vehicles from a specified dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a pedestrian is aiming their weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAimingNearPed]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This is similar to isPedAiming but uses a colshape to be more precise.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedDiving]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This feature checks that pedestrian is diving in the water.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedDrivingVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified pedestrian is driving a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a player is in a specified team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setPedAttack]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function will make a ped attack a specified target.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setPedFollow]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function will make a ped follow a specified target.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerNameFromID]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function will get the player name from the ID element data.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Player functions ===&lt;br /&gt;
*[[countPlayersInRange]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the number of players that are within a certain range of the specified coordinates.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerPreviousAndNextWeapon]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the player previous and next weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInRange]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function make a table of players within certain range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerHitByVehicle]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function cancels event when a element is hit by a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[warpToPlayer]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function make player warp to another player.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Resource functions ===&lt;br /&gt;
*[[getFilesInResourceFolder]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a list of files that are inside a folder of a resource.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceScripts]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource scripts.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSize]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the size of a specified resource in kB(kilobyte)&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[refreshResource]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function refreshes your resource if you changed any of the files&lt;br /&gt;
*[[setResourcePriority]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function set resource download priority group.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sound functions ===&lt;br /&gt;
*[[isSoundFinished]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element has finished.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isSoundPlaying]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element is playing or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[stopSoundSlowly]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function stop your sound element slowly.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Browser functions ===&lt;br /&gt;
*[[playVideo]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function plays a video on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Team functions ===&lt;br /&gt;
*[[getTeamFromColor]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a team element by the specified color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTeamWithFewestPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a team element with least players of all the specified teams.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vehicle functions ===&lt;br /&gt;
*[[findEmptyCarSeat]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function finds you the first empty seat in a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getNearestVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets the nearest vehicle to the specified player in a specified distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRandomVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a random vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getValidVehicleModels]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all valid vehicle models.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getVehiclesCountByType]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the amount of vehicles by the given type as an integer value.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getVehicleTurnVelocityCenterOfMass]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets a vehicle's turn velocity relative to the vehicle's center or mass.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleDoubleExhaust]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks is exhaust vehicle double.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleEmpty]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a vehicle is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOccupied]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified vehicle is occupied.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleReversing]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified vehicle is moving backwards.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleUpgraded]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks is vehicle upgraded by upgrade ID.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleTurnVelocityCenterOfMass]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sets a vehicle's turn velocity relative to the vehicle's center or mass.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleHandlingFromText]]&amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function sets a vehicle's handling from text.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weapon functions === &lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Object functions ===&lt;br /&gt;
*[[getDynamicDoorObjectOpenRatio]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function tells you how open a dynamic door is in a range from 0 to 1.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementObject]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function tells you if an element is an object or no.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== XML functions ===&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns all children of a XML node.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Engine functions ===&lt;br /&gt;
*[[engineGetCOLsFromLibrary]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function gets the collision data from the col library.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[engineLoadIMGContainer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function loads the IMG container.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Utility ===&lt;br /&gt;
*[[animate]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to use interpolateBetween without render event and easily used.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any client-side function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[check]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if its arguments are of the right type and calls the error-function if one is not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[checkPassiveTimer]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to use passive timers in your conditions. For example you want to prevent players r&lt;br /&gt;
epeatedly using a command.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function applies a fix for hidden coroutine error messages.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[compact]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function create table containing variables and their values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBanFromName]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This functions returns the ban of the given playername.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCurrentFPS]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the frames per second at which GTA: SA is running.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getSkinNameFromID]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns the name of the skin from the given id.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isCharInString]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This shared function allows you to check if a char specified is in a string value.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseInCircle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a cursor position is in circular area or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseInPosition]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function returns ''a time-saving'' iterator for your for-loops.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[PlotTrajectoryAtTime]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» Calculate projectile/water trajectory.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[preprocessor]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function allow you to use gcc macros.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[vector3:compare]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This method checks whether two vectors match, with optional precision.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[svgCreateRoundedRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-size:smaller;&amp;quot;&amp;gt;» This function creates a rectangle with rounded edges.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Useful Functions]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetDistanceBetweenElements&amp;diff=75214</id>
		<title>GetDistanceBetweenElements</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetDistanceBetweenElements&amp;diff=75214"/>
		<updated>2022-07-01T18:26:25Z</updated>

		<summary type="html">&lt;p&gt;Botder: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&lt;br /&gt;
Function to obtain the distance between one element and another.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int getDistanceBetweenElements(element arg1, element arg2)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''arg1''': first element.&lt;br /&gt;
* '''arg2''': second element.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the distance between two elements.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client/Server - side&amp;quot; class=&amp;quot;both&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;
function getDistanceBetweenElements(arg1, arg2)&lt;br /&gt;
	local element1 = Vector3(getElementPosition( arg1 ))&lt;br /&gt;
	local element2 = Vector3(getElementPosition( arg2 ))&lt;br /&gt;
	local distance = getDistanceBetweenPoints3D( element1,element2 )&lt;br /&gt;
	return distance&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;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=File:Visual_Studio_Community.PNG&amp;diff=73118</id>
		<title>File:Visual Studio Community.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=File:Visual_Studio_Community.PNG&amp;diff=73118"/>
		<updated>2021-12-07T21:09:27Z</updated>

		<summary type="html">&lt;p&gt;Botder: Botder uploaded a new version of File:Visual Studio Community.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Compiling_MTASA&amp;diff=73117</id>
		<title>Compiling MTASA</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Compiling_MTASA&amp;diff=73117"/>
		<updated>2021-12-07T21:08:31Z</updated>

		<summary type="html">&lt;p&gt;Botder: Visual Studio 2022 update&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://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe 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;
! Hash file&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 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha3-224 DXSDK_Aug09.exe.sha3-224]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA3-256'' || 45bf3e08da3b3636ddb4f4a74243430f8d65759c074c0d79756ef810c4701c5a || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha3-256 DXSDK_Aug09.exe.sha3-256]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA3-384'' || b358e529963d6f5fd7f8bd4b530fb18f6a2e6a442009a54e981b2f9967589ed48150af310f283640d56f9b60d41100c9 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha3-384 DXSDK_Aug09.exe.sha3-384]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA3-512'' || 43522187053af744250059ef69c0f3083cecd1157fe56daac16b9497ebc6fb5b525875144e42898367c55f757cffd3526f37074d544470578602a5a944a45a75 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha3-512 DXSDK_Aug09.exe.sha3-512]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHAKE128'' || 2a7c81bde9e867cbb5ef00b72ad8de66a3ee64c1d59f16465fa712479b6a84d28a02cc5ed08afa1d51e72011657453dbd4656cc9340d32e18179c39d03982dfc35c8f0c2a5c99e11dc74d0e23ed21b1e55f19c809a5a152bde39a2d46fcd12421f373f2d691ade1b57faf6c2ab7aded5a7d174f1f1c77127c0d6a1523b4775c569c5e1b4efa2da4bf2f708a96707a709e245a7f507382e69a81777919c90e95a091c0b699ce7f517 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha3-128000 DXSDK_Aug09.exe.sha3-128000]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHAKE256'' || 9c100dac5245a61774f3a2752bf9e941bdcd5654b18035155161c63b20936dfc9bd7334feb9a6fe9a99a65491161083b39ac3bd578e2cf4f90cba3c786e9924fa0611f65a725331b77b63e7c8b552e1637bc77531ba0f2c9cac72115b28e523929ede4e5b246a0755e8d5c4089d94bf16627fb08672cfffa523bba3d976489a0eec60d3c6a96ca2b || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha3-256000 DXSDK_Aug09.exe.sha3-256000]&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 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha2-224 DXSDK_Aug09.exe.sha2-224]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-256'' || 4ab1de69312f10f6b41310a5218d80c478bbd823bc0f86627318d690b128fb9f || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha2-256 DXSDK_Aug09.exe.sha2-256]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-384'' || 254ed29c6ad2cadc6f013d2d51c0ac78a6bbe236a2c94ca99610eba8b2c1200d1a62c445ca9ee51bb09354875d5eca8a || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha2-384 DXSDK_Aug09.exe.sha2-384]&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 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha2-512 DXSDK_Aug09.exe.sha2-512]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-512/224'' || 7e23d9ba916000782a17e23abf48e25237f45590cfe767aed9d79f10 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha2-512224 DXSDK_Aug09.exe.sha2-512224]&lt;br /&gt;
|- style=&amp;quot;text-align:center;vertical-align:center;&amp;quot;&lt;br /&gt;
| ''SHA-512/256'' || 0c833a56046fe7e4213fcb1862c730acf313d1b8f60b51eebf64dc3e79730c1c || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha2-512256 DXSDK_Aug09.exe.sha2-512256]&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 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.md5 DXSDK_Aug09.exe.md5]&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 || [https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sha1 DXSDK_Aug09.exe.sha1]&lt;br /&gt;
|}&lt;br /&gt;
CRC32 e9f5c61d ([https://assets.mtasa.com/DXSDK/DXSDK_Aug09.exe.sfv DXSDK_Aug09.exe.sfv])&amp;lt;br&amp;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;
=== 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;
# Compile in Visual Studio with '''Debug''' configuration (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 [http://bugs.mtasa.com/ bug tracker] or [irc://irc.multitheftauto.com IRC channel].&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>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=File:VsFoundationClasses.png&amp;diff=73116</id>
		<title>File:VsFoundationClasses.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=File:VsFoundationClasses.png&amp;diff=73116"/>
		<updated>2021-12-07T21:08:05Z</updated>

		<summary type="html">&lt;p&gt;Botder: Botder uploaded a new version of File:VsFoundationClasses.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=File:Skinid106.jpg&amp;diff=72946</id>
		<title>File:Skinid106.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=File:Skinid106.jpg&amp;diff=72946"/>
		<updated>2021-10-21T01:44:54Z</updated>

		<summary type="html">&lt;p&gt;Botder: Botder reverted File:Skinid106.jpg to an old version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:ZJK&amp;diff=72909</id>
		<title>User:ZJK</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:ZJK&amp;diff=72909"/>
		<updated>2021-10-13T17:32:13Z</updated>

		<summary type="html">&lt;p&gt;Botder: Botder moved page User:ZJK to User:Djebzer: Automatically moved page while renaming the user &amp;quot;ZJK&amp;quot; to &amp;quot;Djebzer&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[User:Djebzer]]&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Talk:SetPedBleeding&amp;diff=72012</id>
		<title>Talk:SetPedBleeding</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Talk:SetPedBleeding&amp;diff=72012"/>
		<updated>2021-09-03T12:01:42Z</updated>

		<summary type="html">&lt;p&gt;Botder: Created page with &amp;quot;--~~~~   @Hydra The example overall wasn't good.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[User:Botder|Botder]] ([[User talk:Botder|talk]]) 12:01, 3 September 2021 (UTC)  &lt;br /&gt;
@Hydra&lt;br /&gt;
The example overall wasn't good.&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetPedBleeding&amp;diff=72011</id>
		<title>SetPedBleeding</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetPedBleeding&amp;diff=72011"/>
		<updated>2021-09-03T11:59:17Z</updated>

		<summary type="html">&lt;p&gt;Botder: Reverted edits by Hydra (talk) to last revision by StrixG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0159|1.5.8|20935|This function allows you to set [[player|player's]] or [[ped|ped's]] bleeding effect.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setPedBleeding( ped thePed, bool bleeding ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[ped]]:setBleeding|bleeding|isPedBleeding}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' the player or ped whose bleeding effect you want to set of.&lt;br /&gt;
*'''bleeding:''' boolean specifying whether the player or ped is bleeding or not.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the bleeding state was successfully set, ''error'' is raised otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
{{Example}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.8-9.20935|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client ped functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsPedBleeding&amp;diff=72010</id>
		<title>IsPedBleeding</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsPedBleeding&amp;diff=72010"/>
		<updated>2021-09-03T11:57:47Z</updated>

		<summary type="html">&lt;p&gt;Botder: We can see your name in the page history&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0159|1.5.8|20935|This function gets the state of a [[player|player's]] or [[ped|ped's]] bleeding effect.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isPedBleeding( ped thePed ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[ped]]:isBleeding|bleeding|setPedBleeding}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' the player or ped whose bleeding effect state you want to get.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the player or ped is bleeding, ''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;
function checkBleeding()&lt;br /&gt;
   if isPedBleeding(localPlayer) then&lt;br /&gt;
      outputChatBox(&amp;quot;The ped is bleeding&amp;quot;)&lt;br /&gt;
   else&lt;br /&gt;
      outputChatBox(&amp;quot;The ped is not bleeding&amp;quot;)&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;cBleed&amp;quot;, checkBleeding)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.5.8-9.20935|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client ped functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
</feed>