<?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=MrTasty</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=MrTasty"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/MrTasty"/>
	<updated>2026-04-12T16:35:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetAnalogControlState&amp;diff=64897</id>
		<title>GetAnalogControlState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAnalogControlState&amp;diff=64897"/>
		<updated>2020-01-16T12:45:16Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Function arguments updated as pull #1165 was merged&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This retrieves the analog control state of a control.  This is useful for detecting sensitive controls, such as those used on a joypad.&lt;br /&gt;
&lt;br /&gt;
To get the analog control state for a [[ped]], please use [[getPedAnalogControlState]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;float getAnalogControlState ( string control [, bool rawValue ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''control:''' The control that you want to get the state of. See [[control names]] for a list of possible controls.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New feature/item|3.0157|1.5.7|20383|&lt;br /&gt;
*'''rawValue:''' A bool indicating whether to poll for raw controller state, which ignores keyboard input and any overrides from [[setAnalogControlState]] and others. When set to true, and a controller is not used, the function will always return 0.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[float]] between 0 and 1 indicating the amount the control is pressed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This creates an ''/forwards'' command, which toggles your ''forwards'' control state between 0 and 1.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler( &amp;quot;forwards&amp;quot;,&lt;br /&gt;
    function( )&lt;br /&gt;
        if ( getAnalogControlState( &amp;quot;forwards&amp;quot; ) == 0 ) then&lt;br /&gt;
            setAnalogControlState( &amp;quot;forwards&amp;quot;, 1 )&lt;br /&gt;
        else&lt;br /&gt;
            setAnalogControlState( &amp;quot;forwards&amp;quot;, 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;
==See Also==&lt;br /&gt;
{{Client input functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=64896</id>
		<title>GetPedAnalogControlState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedAnalogControlState&amp;diff=64896"/>
		<updated>2020-01-16T12:45:14Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Function arguments updated as pull #1165 was merged&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
This function retrieves the analog control state of a ped, as set by [[setPedAnalogControlState]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;float getPedAnalogControlState ( ped thePed, string controlName [, bool rawValue ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' The ped you wish to retrieve the control state of.&lt;br /&gt;
*'''controlName:''' The control. See [[control names]] for a list of possible controls.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New feature/item|3.0157|1.5.7|20383|&lt;br /&gt;
*'''rawValue:''' A bool indicating whether to poll for raw controller state, which ignores keyboard input and any overrides from [[setPedAnalogControlState]] and others. When set to true, and a controller is not used, the function will always return 0.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a float between 0 ( full release ) and 1 ( full push ) indicating the amount the control is pushed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- todo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.04185|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:getPedAnalogControlState]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Compatibility_FAQ&amp;diff=60411</id>
		<title>Compatibility FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Compatibility_FAQ&amp;diff=60411"/>
		<updated>2018-11-06T17:58:57Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Compatibility Comparison */ Windows 10 version 1703 end of service date was October 9th.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Compatibility Comparison ==&lt;br /&gt;
{{Warning|Using the legacy build is not without risk, there are known security issues in the Chrome Embedded Framework (CEF) that MTA:SA {{Current Version|full}} uses for Windows XP and Vista. It is recommended that you upgrade from XP or Vista to a supported Windows version.|true}} &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Operating System&lt;br /&gt;
! Service Pack/Version &lt;br /&gt;
! Release Date&lt;br /&gt;
! Supported by Microsoft&amp;lt;ref&amp;gt;https://support.microsoft.com/en-us/help/13853/windows-lifecycle-fact-sheet&amp;lt;/ref&amp;gt;&lt;br /&gt;
! Does MTA:SA {{Current Version|full}} work?&lt;br /&gt;
! Chrome Embedded Framework&lt;br /&gt;
Updates&lt;br /&gt;
! Future MTA:SA&lt;br /&gt;
releases/updates&lt;br /&gt;
|-&lt;br /&gt;
| Windows XP&lt;br /&gt;
| Service Pack 3&lt;br /&gt;
| August 2001&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{Partial|Yes, requires legacy build}}&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{Partial|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| Windows Vista&lt;br /&gt;
| Service Pack 2&lt;br /&gt;
| November 2006&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{Partial|Yes, requires legacy build}}&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{Partial|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| Windows 7&lt;br /&gt;
| Service Pack 1&lt;br /&gt;
| July 2009&lt;br /&gt;
| {{Yes|Yes, until January 2020}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
|-&lt;br /&gt;
| Windows 8.0&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| August 2012&lt;br /&gt;
| {{No|No, upgrade to 8.1&amp;lt;ref&amp;gt;https://support.microsoft.com/en-us/help/15288/windows-8-update-to-windows-8-1&amp;lt;/ref&amp;gt;}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
|-&lt;br /&gt;
| Windows 8.1&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| August 2013&lt;br /&gt;
| {{Yes|Yes, until January 2023}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=7 | Windows 10&amp;lt;ref&amp;gt;([https://support.microsoft.com/en-us/help/13853/windows-lifecycle-fact-sheet])&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 1507&lt;br /&gt;
| July 2015&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
|-&lt;br /&gt;
| 1511&lt;br /&gt;
| November 2015&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
|-&lt;br /&gt;
| 1607&lt;br /&gt;
| August 2016&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
|-&lt;br /&gt;
| 1703&lt;br /&gt;
| April 2017&lt;br /&gt;
| {{No}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
|-&lt;br /&gt;
| 1709&lt;br /&gt;
| October 2017&lt;br /&gt;
| {{Yes|Yes, until April 2019}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
|-&lt;br /&gt;
| 1803&lt;br /&gt;
| April 2018&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
| {{Yes}}&lt;br /&gt;
|-&lt;br /&gt;
| 1809&lt;br /&gt;
| September 2018&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
| {{n/a}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Please use a supported version of Windows 10 to run MTA.&lt;br /&gt;
* There are no guarantees that MTA will work on older not by Microsoft supported Windows 8 and 10 versions.&lt;br /&gt;
&lt;br /&gt;
== FAQ - Frequently Asked Questions ==&lt;br /&gt;
=== Google is dropping XP/Vista support for Chrome browser? What does this even have to do with MTA:SA? ===&lt;br /&gt;
As you may know from our previous [https://forum.mtasa.com/topic/75559-mtasa-15-release-candidate-is-ready-for-testing/ news posts], MTA:SA uses CEF (Chrome Embedded Framework) components for providing some functionality for the mod since version 1.5. Being Chromium-based, CEF components are also being phased out for users of older Operating Systems and will simply not work on them.&amp;lt;ref&amp;gt;https://bitbucket.org/chromiumembedded/cef&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Does MTA:SA 1.5.3 work fine on Windows XP and Windows Vista? ===&lt;br /&gt;
Yes, it works fine if you install it through the legacy build. We still can not really recommend using these systems anymore due to reasons listed below.&lt;br /&gt;
&lt;br /&gt;
CEF compatibility issue aside, these Operating Systems (XP especially) are really old nowadays. You are putting yourself at risk if you use them as they are either no longer supported by Microsoft (XP) or the support will be discontinued soon (April 2017 - Vista).&lt;br /&gt;
&lt;br /&gt;
=== What will happen if I try to use the regular build of 1.5.3 on Windows XP/Vista? ===&lt;br /&gt;
MTA:SA installer will display an error and will not let you install the mod on such systems. You will be asked to download the legacy build from our website.&lt;br /&gt;
&lt;br /&gt;
=== And what will happen if I try to use the legacy build of 1.5.3 on Windows 7 and above? ===&lt;br /&gt;
Similarly, MTA:SA installer will display an error and will not let you install the mod on such systems. You will be asked to download the regular build from our website.&lt;br /&gt;
&lt;br /&gt;
=== Why couldn't you just stick to the older version of CEF then so that XP/Vista would be still supported? / What about releasing two versions of the mod? A regular one with newest CEF and a legacy one with the older CEF build that still works on XP/Vista?  ===&lt;br /&gt;
Hey, but we actually do provide a legacy build for MTA:SA 1.5.3 for XP/Vista users with an older version of CEF components.&lt;br /&gt;
&lt;br /&gt;
The problem with sticking with either of these options is that we would have to continue providing a version that is vulnerable to any present and future security exploits that exist in Chromium and are already widely used. We do not want to put our users at risk because of that. CEF developers themselves do not want to provide a long-term security support for such a build either. &amp;lt;ref&amp;gt;http://www.magpcss.org/ceforum/viewtopic.php?f=6&amp;amp;t=14187&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== I am playing the mod on Windows 7/Windows 8/Windows 8.1/Windows 10 or newer. Am I affected by this?  ===&lt;br /&gt;
No, you will not be affected at all. In fact, you will have a better experience with built-in web browser components than before due to security and performance fixes included in the newer CEF versions.&lt;br /&gt;
&lt;br /&gt;
=== I am using Windows XP/Vista and I would still like to play future versions of MTA:SA. What can I do about it? ===&lt;br /&gt;
If you are using Windows XP or Windows Vista, you should upgrade your OS to a newer one. You will likely be required to do a clean install for that, so backup your stuff first. You should use these tools first to see if your PC is capable of upgrading to newer OS:&lt;br /&gt;
&lt;br /&gt;
    Windows 7: [https://www.microsoft.com/en-us/download/details.aspx?id=20 Windows 7 Upgrade Advisor]&lt;br /&gt;
    Windows 8/10: [http://go.microsoft.com/fwlink?linkid=259439 Windows 8 Upgrade Assistant]&lt;br /&gt;
&lt;br /&gt;
Is your PC toaster-tier which does not support Windows 8 or even 7? That means it is probably the right time to buy something more modern.&lt;br /&gt;
&lt;br /&gt;
But fear not, if you are already using Windows 7 or newer, just install the newest build of MTA:SA 1.5.3 and you are set! And if you don't want to upgrade your OS or PC, well, we will keep offering the legacy build that works on XP/Vista for a while...&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://forum.mtasa.com/topic/89685-mtasa-windows-xpvista-cef-components-and-you/ Topic about the compatibility changes]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59967</id>
		<title>WordWrap</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59967"/>
		<updated>2018-10-22T07:45:10Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Useful Function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
This function splits a long string into a table of lines no longer than ''maxwidth''.&lt;br /&gt;
{{Note|A line without any spaces in it will not break, meaning it may exceed ''maxwidth''.}}&lt;br /&gt;
{{Tip|This function may lag if used too often. Consider only calling this function when any of the arguments change (such as the text, maxwidth, it's scale or font, etc.) and caching the result, rather than calling it [[onClientRender]] or similarly frequent events.}}&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 wordWrap( string text, float maxwidth, [float scale=1, mixed font=&amp;quot;default&amp;quot;, bool bColorCoded=false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''text:''' The string to break into lines.&lt;br /&gt;
* '''maxwidth:''' The number of pixels of allowed length per line.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''scale:''' The size of the text, as in [[dxGetTextWidth]]. Defaults to 1.&lt;br /&gt;
* '''font:''' Either a custom DX font element or the name of a built-in dx font, as in [[dxGetTextWidth]]. Defaults to &amp;quot;default&amp;quot;.&lt;br /&gt;
* '''bColorCoded:''' Should color codes be excluded from the width? (false will include #rrggbb in the length calculations). Defaults to false.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function wordWrap(text, maxwidth, scale, font, colorcoded)&lt;br /&gt;
    local lines = {}&lt;br /&gt;
    local words = split(text, &amp;quot; &amp;quot;) -- this unfortunately will collapse 2+ spaces in a row into a single space&lt;br /&gt;
    local line = 1 -- begin with 1st line&lt;br /&gt;
    local word = 1 -- begin on 1st word&lt;br /&gt;
    local endlinecolor&lt;br /&gt;
    while (words[word]) do -- while there are still words to read&lt;br /&gt;
        repeat&lt;br /&gt;
            if colorcoded and (not lines[line]) and endlinecolor and (not string.find(words[word], &amp;quot;^#%x%x%x%x%x%x&amp;quot;)) then -- if on a new line, and endline color is set and the upcoming word isn't beginning with a colorcode&lt;br /&gt;
                lines[line] = endlinecolor -- define this line as beginning with the color code&lt;br /&gt;
            end&lt;br /&gt;
            lines[line] = lines[line] or &amp;quot;&amp;quot; -- define the line if it doesnt exist&lt;br /&gt;
&lt;br /&gt;
            if colorcoded then&lt;br /&gt;
                local rw = string.reverse(words[word]) -- reverse the string&lt;br /&gt;
                local x, y = string.find(rw, &amp;quot;%x%x%x%x%x%x#&amp;quot;) -- and search for the first (last) occurance of a color code&lt;br /&gt;
                if x and y then&lt;br /&gt;
                    endlinecolor = string.reverse(string.sub(rw, x, y)) -- stores it for the beginning of the next line&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
      &lt;br /&gt;
            lines[line] = lines[line]..words[word] -- append a new word to the this line&lt;br /&gt;
            lines[line] = lines[line] .. &amp;quot; &amp;quot; -- append space to the line&lt;br /&gt;
&lt;br /&gt;
            word = word + 1 -- moves onto the next word (in preparation for checking whether to start a new line (that is, if next word won't fit)&lt;br /&gt;
        until ((not words[word]) or dxGetTextWidth(lines[line]..&amp;quot; &amp;quot;..words[word], scale, font, colorcoded) &amp;gt; maxwidth) -- jumps back to 'repeat' as soon as the code is out of words, or with a new word, it would overflow the maxwidth&lt;br /&gt;
    &lt;br /&gt;
        lines[line] = string.sub(lines[line], 1, -2) -- removes the final space from this line&lt;br /&gt;
        if colorcoded then&lt;br /&gt;
            lines[line] = string.gsub(lines[line], &amp;quot;#%x%x%x%x%x%x$&amp;quot;, &amp;quot;&amp;quot;) -- removes trailing colorcodes&lt;br /&gt;
        end&lt;br /&gt;
        line = line + 1 -- moves onto the next line&lt;br /&gt;
    end -- jumps back to 'while' the a next word exists&lt;br /&gt;
    return lines&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Author: Addlibs (aka MrTasty)&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- todo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59966</id>
		<title>WordWrap</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59966"/>
		<updated>2018-10-22T07:41:38Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Updated code to append colorcodes on every new line, preserving the color from the previous line (that is, if there are colorcodes present in the text)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Useful Function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
This function splits a long string into a table of lines no longer than ''maxwidth''.&lt;br /&gt;
{{Note|A line without any spaces in it will not break, meaning it may exceepd ''maxwidth''.}}&lt;br /&gt;
{{Tip|This function may lag if used too often. Consider only calling this function when any of the arguments change (such as the text, maxwidth, it's scale or font, etc.) and caching the result, rather than calling it [[onClientRender]] or similarly frequent events.}}&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 wordWrap( string text, float maxwidth, [float scale=1, mixed font=&amp;quot;default&amp;quot;, bool bColorCoded=false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''text:''' The string to break into lines.&lt;br /&gt;
* '''maxwidth:''' The number of pixels of allowed length per line.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''scale:''' The size of the text, as in [[dxGetTextWidth]]. Defaults to 1.&lt;br /&gt;
* '''font:''' Either a custom DX font element or the name of a built-in dx font, as in [[dxGetTextWidth]]. Defaults to &amp;quot;default&amp;quot;.&lt;br /&gt;
* '''bColorCoded:''' Should color codes be excluded from the width? (false will include #rrggbb in the length calculations). Defaults to false.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function wordWrap(text, maxwidth, scale, font, colorcoded)&lt;br /&gt;
    local lines = {}&lt;br /&gt;
    local words = split(text, &amp;quot; &amp;quot;) -- this unfortunately will collapse 2+ spaces in a row into a single space&lt;br /&gt;
    local line = 1 -- begin with 1st line&lt;br /&gt;
    local word = 1 -- begin on 1st word&lt;br /&gt;
    local endlinecolor&lt;br /&gt;
    while (words[word]) do -- while there are still words to read&lt;br /&gt;
        repeat&lt;br /&gt;
            if colorcoded and (not lines[line]) and endlinecolor and (not string.find(words[word], &amp;quot;^#%x%x%x%x%x%x&amp;quot;)) then -- if on a new line, and endline color is set and the upcoming word isn't beginning with a colorcode&lt;br /&gt;
                lines[line] = endlinecolor -- define this line as beginning with the color code&lt;br /&gt;
            end&lt;br /&gt;
            lines[line] = lines[line] or &amp;quot;&amp;quot; -- define the line if it doesnt exist&lt;br /&gt;
&lt;br /&gt;
            if colorcoded then&lt;br /&gt;
                local rw = string.reverse(words[word]) -- reverse the string&lt;br /&gt;
                local x, y = string.find(rw, &amp;quot;%x%x%x%x%x%x#&amp;quot;) -- and search for the first (last) occurance of a color code&lt;br /&gt;
                if x and y then&lt;br /&gt;
                    endlinecolor = string.reverse(string.sub(rw, x, y)) -- stores it for the beginning of the next line&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
      &lt;br /&gt;
            lines[line] = lines[line]..words[word] -- append a new word to the this line&lt;br /&gt;
            lines[line] = lines[line] .. &amp;quot; &amp;quot; -- append space to the line&lt;br /&gt;
&lt;br /&gt;
            word = word + 1 -- moves onto the next word (in preparation for checking whether to start a new line (that is, if next word won't fit)&lt;br /&gt;
        until ((not words[word]) or dxGetTextWidth(lines[line]..&amp;quot; &amp;quot;..words[word], scale, font, colorcoded) &amp;gt; maxwidth) -- jumps back to 'repeat' as soon as the code is out of words, or with a new word, it would overflow the maxwidth&lt;br /&gt;
    &lt;br /&gt;
        lines[line] = string.sub(lines[line], 1, -2) -- removes the final space from this line&lt;br /&gt;
        if colorcoded then&lt;br /&gt;
            lines[line] = string.gsub(lines[line], &amp;quot;#%x%x%x%x%x%x$&amp;quot;, &amp;quot;&amp;quot;) -- removes trailing colorcodes&lt;br /&gt;
        end&lt;br /&gt;
        line = line + 1 -- moves onto the next line&lt;br /&gt;
    end -- jumps back to 'while' the a next word exists&lt;br /&gt;
    return lines&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Author: Addlibs (aka MrTasty)&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- todo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59927</id>
		<title>WordWrap</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59927"/>
		<updated>2018-10-20T10:53:39Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Optional Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Useful Function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
This function splits a long string into a table of lines no longer than ''maxwidth''.&lt;br /&gt;
{{Note|A line without any spaces in it will not break, meaning it may exceepd ''maxwidth''.}}&lt;br /&gt;
{{Tip|This function may lag if used too often. Consider only calling this function when any of the arguments change (such as the text, maxwidth, it's scale or font, etc.) and caching the result, rather than calling it [[onClientRender]] or similarly frequent events.}}&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 wordWrap( string text, float maxwidth, [float scale=1, mixed font=&amp;quot;default&amp;quot;, bool bColorCoded=false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''text:''' The string to break into lines.&lt;br /&gt;
* '''maxwidth:''' The number of pixels of allowed length per line.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''scale:''' The size of the text, as in [[dxGetTextWidth]]. Defaults to 1.&lt;br /&gt;
* '''font:''' Either a custom DX font element or the name of a built-in dx font, as in [[dxGetTextWidth]]. Defaults to &amp;quot;default&amp;quot;.&lt;br /&gt;
* '''bColorCoded:''' Should color codes be excluded from the width? (false will include #rrggbb in the length calculations). Defaults to false.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function wordWrap(text, maxwidth, scale, font, colorcoded)&lt;br /&gt;
    local lines = {}&lt;br /&gt;
    local words = split(text, &amp;quot; &amp;quot;) -- this unfortunately will collapse 2+ spaces in a row into a single space&lt;br /&gt;
    local line = 1 -- begin with 1st line&lt;br /&gt;
    local word = 1 -- begin on 1st word&lt;br /&gt;
    while (words[word]) do -- while there are still words to read&lt;br /&gt;
        repeat&lt;br /&gt;
            lines[line] = lines[line] and (lines[line]..&amp;quot; &amp;quot;) or &amp;quot;&amp;quot; -- appends space if line already exists, or defines it to an empty string&lt;br /&gt;
            lines[line] = lines[line]..words[word] -- append a new word to the this line&lt;br /&gt;
            word = word + 1 -- moves onto the next word (in preparation for checking whether to start a new line (that is, if next word won't fit)&lt;br /&gt;
        until ((not words[word]) or dxGetTextWidth(lines[line]..&amp;quot; &amp;quot;..words[word], scale, font, colorcoded) &amp;gt;= maxwidth) -- jumps back to 'repeat' as soon as the code is out of words, or with a new word, it would overflow the maxwidth&lt;br /&gt;
    &lt;br /&gt;
        line = line + 1 -- moves onto the next line&lt;br /&gt;
    end -- jumps back to 'while' the a next word exists&lt;br /&gt;
    return lines&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Author: Addlibs (aka MrTasty)&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- todo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=59926</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=59926"/>
		<updated>2018-10-20T10:51:57Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Drawing functions */ Added wordWrap&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
=== ACL functions ===&lt;br /&gt;
*[[aclGroupClone]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getPlayerAcls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPlayerInACL]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[removeAccountData]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is used to remove data from an 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[dxDrawDashedLine]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a line with dashes.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTextOnRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Esta funcion crea un rectangle con un texto dentro.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a custom polygon on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawProgressBar]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates a progress bar drawed using DirectDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTextOnElement]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a text on any element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawTriangle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wordWrap]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
&lt;br /&gt;
=== Effects functions ===&lt;br /&gt;
*[[attachEffect]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
=== Elements functions === &lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementsInDimension]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementsWithinMarker]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getClipboard]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This event returns the contents of the clipboard by pressing ctrl + v / ctrl + V. Event triggered ONLY if cursor is showing.&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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function capitalizes a given string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts and formats large numbers.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertServerTickToTimeStamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[findRotation3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[generateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function generates a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateRandomASCIIString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a given birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getKeyFromValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getRealMonthH]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function convert english months to arabic months&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRealMonthM]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gives you the real months 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[secondsToTimeDesc]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getDistanceBetweenElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Esta funcion sirve para obtener la distancia entre dos elementos.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLowerOrUpper]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;»This function checks whether the letter is large or small.&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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function moves guiElement by/like using moveObject.&amp;lt;/span&amp;gt;&lt;br /&gt;
=====Comboboxes=====&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[guiComboBoxAddPlayersName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is add players name in combobox .&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Gridlists=====&lt;br /&gt;
*[[guiGridListAddPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getGridListRowIndexFromText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isTextInGridList]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[convertGridListToText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts grid list contents to text.&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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function add a 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-family:'Georgia',sans-serif; 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;
*[[mathNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[math.hypot]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.percent]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[reMap]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.isPointInPolygon]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Check if point is inside polygon or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.polygonArea]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
&lt;br /&gt;
=== Ped functions ===&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getPlayersInVehicles]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getGuestPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get peds eyes position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxHealth]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getPlayersInGroup]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all Players In Group .&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[isPedDrivingVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
&lt;br /&gt;
=== Player functions ===&lt;br /&gt;
*[[countPlayersInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
&lt;br /&gt;
=== Resource functions ===&lt;br /&gt;
*[[getResourceScripts]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[refreshResource]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function refreshes your resource if you changed any of the files&lt;br /&gt;
&lt;br /&gt;
=== Sound functions ===&lt;br /&gt;
*[[isSoundFinished]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element has finished.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[stopSoundSlowly]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
=== Table functions ===&lt;br /&gt;
*[[rangeToTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[Sort_Functions]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a table is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the absolute size of a table.&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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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 funcions === &lt;br /&gt;
*[[getNearestVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[isVehicleEmpty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getVehicleTurnVelocityCenterOfMass]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setVehicleTurnVelocityCenterOfMass]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
&lt;br /&gt;
=== Weapon functions === &lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
=== XML functions ===&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
=== Utility ===&lt;br /&gt;
*[[animate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getBanFromName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isCursorOnElement]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether the cursor is in a particular area.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseInCircle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[thisCommandHandlersExist]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This method checks a string if this exist as command Handlers&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[vector3:compare]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:Useful Functions]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59925</id>
		<title>WordWrap</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=WordWrap&amp;diff=59925"/>
		<updated>2018-10-20T10:49:22Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Created page with &amp;quot;__NOTOC__ {{Useful Function}} {{Needs_Example}} This function splits a long string into a table of lines no longer than ''maxwidth''. {{Note|A line without any spaces in it wi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Useful Function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
This function splits a long string into a table of lines no longer than ''maxwidth''.&lt;br /&gt;
{{Note|A line without any spaces in it will not break, meaning it may exceepd ''maxwidth''.}}&lt;br /&gt;
{{Tip|This function may lag if used too often. Consider only calling this function when any of the arguments change (such as the text, maxwidth, it's scale or font, etc.) and caching the result, rather than calling it [[onClientRender]] or similarly frequent events.}}&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 wordWrap( string text, float maxwidth, [float scale=1, mixed font=&amp;quot;default&amp;quot;, bool bColorCoded=false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''text:''' The string to break into lines.&lt;br /&gt;
* '''maxwidth:''' The number of pixels of allowed length per line.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''scale:''' The size of the text, as in [[dxGetTextWidth]]. Defaults to 1.&lt;br /&gt;
* '''font:''' Either a custom DX font element or the name of a built-in dx font, as in [[dxGetTextWidth]]. Defaults to &amp;quot;default&amp;quot;.&lt;br /&gt;
* '''bColorCoded:''' Should color codes be excluded from the width? (false will include #rrggbb in the length calculations) Defaults to false.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function wordWrap(text, maxwidth, scale, font, colorcoded)&lt;br /&gt;
    local lines = {}&lt;br /&gt;
    local words = split(text, &amp;quot; &amp;quot;) -- this unfortunately will collapse 2+ spaces in a row into a single space&lt;br /&gt;
    local line = 1 -- begin with 1st line&lt;br /&gt;
    local word = 1 -- begin on 1st word&lt;br /&gt;
    while (words[word]) do -- while there are still words to read&lt;br /&gt;
        repeat&lt;br /&gt;
            lines[line] = lines[line] and (lines[line]..&amp;quot; &amp;quot;) or &amp;quot;&amp;quot; -- appends space if line already exists, or defines it to an empty string&lt;br /&gt;
            lines[line] = lines[line]..words[word] -- append a new word to the this line&lt;br /&gt;
            word = word + 1 -- moves onto the next word (in preparation for checking whether to start a new line (that is, if next word won't fit)&lt;br /&gt;
        until ((not words[word]) or dxGetTextWidth(lines[line]..&amp;quot; &amp;quot;..words[word], scale, font, colorcoded) &amp;gt;= maxwidth) -- jumps back to 'repeat' as soon as the code is out of words, or with a new word, it would overflow the maxwidth&lt;br /&gt;
    &lt;br /&gt;
        line = line + 1 -- moves onto the next line&lt;br /&gt;
    end -- jumps back to 'while' the a next word exists&lt;br /&gt;
    return lines&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Author: Addlibs (aka MrTasty)&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- todo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Element_data&amp;diff=59657</id>
		<title>Element data</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Element_data&amp;diff=59657"/>
		<updated>2018-10-08T12:28:34Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Each [[element]] that is loaded is able to have [[element data]] values attached to it. These are values that can be accessed using a keyword string and directly correspond to the element's attributes in the map file, unless changed via scripting. Element data is a good way to store distributed information you want associated with an element, for example you could use it to associate a score with a player, or a team with a vehicle.&lt;br /&gt;
&lt;br /&gt;
Element data is synchronized between the server and the client. Setting data from any of the two sides will force an update in the other, triggering the corresponding element data change events. This is very useful, as it provides a simple way to keep element properties synced without having to set special events to do it manually.  This also means that excessive use of element data to store variables that are not required by both server and client becomes a waste of bandwidth.&lt;br /&gt;
&lt;br /&gt;
Since not all datatypes can be packetized to be transferred, there are some restrictions. The types that cannot be stored as element data are ''non-element userdata'' (see [[MTA Classes]]), ''functions'' and ''threads''. Also, you may not send tables which contain one or more values of any of these types.&lt;br /&gt;
&lt;br /&gt;
==Relevant functions==&lt;br /&gt;
* [[setElementData]]: sets an element data value.&lt;br /&gt;
* [[getElementData]]: retrieves an element data value.&lt;br /&gt;
&lt;br /&gt;
==Relevant events==&lt;br /&gt;
* [[onElementDataChange]]: triggered on the server after element data is changed.&lt;br /&gt;
* [[onClientElementDataChange]]: triggered on the client after element data is changed.&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnElementDataChange&amp;diff=59656</id>
		<title>OnElementDataChange</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnElementDataChange&amp;diff=59656"/>
		<updated>2018-10-08T12:28:32Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered ''after'' an element's [[element data|data]] entry is changed. Such changes can be made on the client or the server using [[setElementData]].&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string theKey, var oldValue, var newValue&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''theKey''': The name of the element data entry that has changed.&lt;br /&gt;
*'''oldValue''': The old value of this entry before it changed. See [[element data]] for a list of possible datatypes.&lt;br /&gt;
*'''newValue''': the new value of this entry after it changed. This will be equivalent to [[getElementData]](source, theKey).&lt;br /&gt;
&lt;br /&gt;
==Global parameters==&lt;br /&gt;
*'''source''': The [[event system#Event source|source]] of this event is the [[element]] whose [[element data]] changed.&lt;br /&gt;
*'''client''': The [[event system#Event client|client]] global variable is set to the client that called [[setElementData]], or nil if it was called on the server.&lt;br /&gt;
*'''sourceResource''': The [[resource]] which changed the element data. (Only works in versions above 1.3.4-5937)&lt;br /&gt;
&lt;br /&gt;
==Cancelling==&lt;br /&gt;
This event cannot be cancelled using [[cancelEvent]]. To reverse the effect, use [[setElementData]] with the old value. See Example.&lt;br /&gt;
 &lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example outputs a message to players when any of their element data values is changed.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function outputChange(theKey, oldValue, newValue)&lt;br /&gt;
    if (getElementType(source) == &amp;quot;player&amp;quot;) then -- check if the element is a player&lt;br /&gt;
        outputChatBox(&amp;quot;Your element data '&amp;quot; .. tostring(theKey) .. &amp;quot;' has changed from '&amp;quot; .. tostring(oldValue) .. &amp;quot;' to '&amp;quot; .. tostring(newValue) .. &amp;quot;'&amp;quot;, source) -- output the change for the affected player&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onElementDataChange&amp;quot;, root, outputChange)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example checks and possibly reverses an element's data change.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkChange(theKey, oldValue)&lt;br /&gt;
    -- The client can only set 'special_thing' on its own player&lt;br /&gt;
    if (theKey== &amp;quot;special_thing&amp;quot;) and (client ~= source) then&lt;br /&gt;
        outputChatBox(&amp;quot;Illegal setting of &amp;quot; .. tostring(theKey) .. &amp;quot;' by '&amp;quot; .. tostring(getPlayerName(client)))&lt;br /&gt;
        setElementData(source, theKey, oldValue) -- Set back the original value&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onElementDataChange&amp;quot;, root, checkChange)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Element events}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientElementDataChange&amp;diff=59655</id>
		<title>OnClientElementDataChange</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientElementDataChange&amp;diff=59655"/>
		<updated>2018-10-08T12:28:28Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered ''after'' an element's [[element data|data]] entry is changed. Such changes can be made on the client or the server using [[setElementData]].&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string theKey, var oldValue, var newValue&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''theKey''': The name of the element data entry that has changed.&lt;br /&gt;
*'''oldValue''': The old value of this entry before it changed. See [[element data]] for a list of possible datatypes.&lt;br /&gt;
*'''newValue''': the new value of this entry after it changed. This will be equivalent to [[getElementData]](source, theKey).&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] whose [[element data]] changed.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example tells the client whenever a player's &amp;quot;score&amp;quot; element data is changed.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scoreChangeTracker(theKey, oldValue, newValue)&lt;br /&gt;
    if (getElementType(source) == &amp;quot;player&amp;quot;) and (theKey == &amp;quot;score&amp;quot;) then&lt;br /&gt;
        outputChatBox(getPlayerName(source)..&amp;quot;'s new score is &amp;quot;..newValue..&amp;quot;!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientElementDataChange&amp;quot;, root, scoreChangeTracker)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[pl:onClientElementDataChange]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client element events===&lt;br /&gt;
{{Client_element_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Debugging&amp;diff=55459</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Debugging&amp;diff=55459"/>
		<updated>2018-06-24T10:34:54Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Useful functions */ added inspect and iprint&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When scripting you will often come across problems that are not immediately apparent. This page tries to point out some basic strategies to locate the error.&lt;br /&gt;
&lt;br /&gt;
==Debug console==&lt;br /&gt;
MTA features a built-in debug console that shows debug messages output from MTA functions or from scripts. Keeping it mind that you should have administrator access (unless you modify the ACL to change this), you can open the debug console by typing ''debugscript *x*'' in the console, where ''x'' is the debug level:&lt;br /&gt;
* '''1:''' only errors&lt;br /&gt;
* '''2:''' errors and warnings&lt;br /&gt;
* '''3:''' errors, warnings and info messages&lt;br /&gt;
By typing ''debugscript 3'' all messages are visible. Level 3 and level 2 are recommended for most occasions. You should have ''debugscript'' enabled whenever you are testing your scripts as it will help you easily detect and solve typos and other issues.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
This example code has two errors:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function SayHello(message, player)&lt;br /&gt;
    if (getPlayerName(player) == &amp;quot;Fedor&amp;quot;)&lt;br /&gt;
        outputChatbox(&amp;quot;Hello Fedor&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onChatMessage&amp;quot;, root, SayHello)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
When the script this piece of code is in is tried to be loaded, debugscript will output something similiar to this:&lt;br /&gt;
:{{Debug info|Loading script failed: myResource\script.lua:2: 'then' expected near ´outputChatbox'}}&lt;br /&gt;
This means the script could not be parsed because there was a syntax error. It shows the script path relative to the resource directory so you can identify to script where the error originated from. After the filename it shows a colon and a number, this number presents the line number - this is so you can find out where in your script the error is - it is very helpful for large scripts. After that is the error message, which varies depending on the error made. Looking at the error message, we can easily determine that the error originated from the resource '''myResource''' and line two of the script file '''script.lua'''. The error message is very clear, we forgot the &amp;quot;then&amp;quot;! We can easily fix that!&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function SayHello(message, player)&lt;br /&gt;
    if (getPlayerName(player) == &amp;quot;Fedor&amp;quot;) then&lt;br /&gt;
        outputChatbox(&amp;quot;Hello Fedor&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onChatMessage&amp;quot;, root, SayHello)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Now the script will load fine and won't output any errors until a player with the name 'Fedor' says something in the chat. At that moment, the debug console will output:&lt;br /&gt;
:{{Debug error|myResource\script.lua:2: attempt to call global 'outputChatbox' (a nil value)}}&lt;br /&gt;
This error means that the function '''outputChatbox''' is a nil value, that is - it doesn't exist! This is because the function is actually called [[outputChatBox]], not [[outputChatbox]] - take care of that capital B.:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function SayHello(message, player)&lt;br /&gt;
    if (getPlayerName(player) == &amp;quot;Fedor&amp;quot;) then&lt;br /&gt;
        outputChatBox(&amp;quot;Hello Fedor&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onChatMessage&amp;quot;, root, SayHello)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, this is just an example and I've only skimmed the surface of error messages. There are plenty of other messages and scenarios, but you should get the general idea.&lt;br /&gt;
&lt;br /&gt;
==Server &amp;amp; client debug logging==&lt;br /&gt;
====Server====&lt;br /&gt;
Navigate to: ''(MTA root folder)&amp;gt;server&amp;gt;mods&amp;gt;deathmatch''&lt;br /&gt;
&lt;br /&gt;
There are two nearly identical files:&lt;br /&gt;
&lt;br /&gt;
*The local.conf is the settings for the &amp;quot;host game&amp;quot; menu item in the main menu of MTA. This is a quick and easy way of starting a temporary server from inside the client. When the client is turned off the server will also turn off.&lt;br /&gt;
&lt;br /&gt;
*The mtaserver.conf is used when &amp;quot;MTA Server.exe&amp;quot; is executed from (MTA root folder)&amp;gt;server. This runs the server in its own console window which does not need the client to exist or to be run. This is can be useful if you're interested in hosting servers for a longer time period or if you want to experiment with a real world console.&lt;br /&gt;
&lt;br /&gt;
Depending on which way you host, you will want to edit those files. The settings in question are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!-- Specifies the location and name of the debugscript log file. If left blank, server won't be saving this file. --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptdebuglogfile&amp;gt;logs/scripts.log&amp;lt;/scriptdebuglogfile&amp;gt; &lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;!-- Specifies the level of the debugscript log file. Available values: 0, 1, 2, 3. When not set, defaults to 0. --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptdebugloglevel&amp;gt;0&amp;lt;/scriptdebugloglevel&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You want to make sure you have a log name specified. Also you want to specify what level of errors will be logged. If it is 0 nothing will be logged. The levels were explained at the top of this article. If the logging level was changed to 3, then in this case all '''serverside''' script errors log to (MTA root folder)&amp;gt;server&amp;gt;mods&amp;gt;deathmatch&amp;gt;logs&amp;gt;scripts.log&lt;br /&gt;
&lt;br /&gt;
====Client====&lt;br /&gt;
Navigate to: ''(MTA root folder)&amp;gt;server&amp;gt;clientscript.log''&lt;br /&gt;
&lt;br /&gt;
This file logs all '''clientside''' script errors. This is set to log by default, no setup required.&lt;br /&gt;
&lt;br /&gt;
==Debug strategies==&lt;br /&gt;
There are several strategies that support finding errors, apart from going through the code. Most of them include outputting debug messages, with have different information depending on the situtation.&lt;br /&gt;
&lt;br /&gt;
===Useful functions===&lt;br /&gt;
There are some functions that may come in handy for debugging.&lt;br /&gt;
* [[outputDebugString]] or [[outputChatBox]] for outputting any information (use outputDebugString for technical output)&lt;br /&gt;
* [http://www.lua.org/manual/5.1/manual.html#pdf-tostring tostring()] on a variable to turn the value into a string. Useful if the value is not a number or string.&lt;br /&gt;
* [[inspect]] returns a useful human readable string notation of any datatype including tables, non-element userdatas such as ACL groups, accounts, etc, and elements.&lt;br /&gt;
* [[iprint]] similar to inspect, except it takes in as many arguments as desired and outputs them into debugscript.&lt;br /&gt;
* [[getElementType]] to check the type of the MTA element.&lt;br /&gt;
* [[isElement]] to check if the MTA element exists.&lt;br /&gt;
&lt;br /&gt;
===Add debugmessages to check ''if'', ''when'' or ''how often'' a section of code is executed===&lt;br /&gt;
A typical example would be verify whether an ''if''-section is executed or not. To do that, just add any message you will recognize later within the ''if''-section.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
if (variable1 == variable2) then&lt;br /&gt;
    outputDebugString(&amp;quot;variable1 is the same as variable2!&amp;quot;)&lt;br /&gt;
    -- do anything&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another application would be to check when variable values are modified. First search for all occurences of the variable being edited and add a message just beside it.&lt;br /&gt;
&lt;br /&gt;
===Add debugmessages to check the ''value'' of a variable===&lt;br /&gt;
Let's say you want to create a marker, but it doesn't appear at the position you expect it to be. The first thing you might want to do is check if the [[createMarker]] function is executed. But while doing this, you can also check the values being used in the [[createMarker]] function in one run.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox(&amp;quot;posX is: &amp;quot;..x..&amp;quot; posY is: &amp;quot;..y..&amp;quot; posZ is: &amp;quot;..z)&lt;br /&gt;
createMarker(x,y,z)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This would output all three variables that are used as coordinates for the marker. Assuming you read those from a map file, you can now compare the debug output to the desired values. The [http://www.lua.org/manual/5.1/manual.html#pdf-tostring tostring()] will ensure that the values of the variables can be concatenated (put together) as a string, even if it's a boolean value.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Imagine you created a [[Colshape|collision shape]] somewhere and you want an action to perform after the player stays for ten seconds inside it, you would do this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colShapeHit(player)&lt;br /&gt;
	-- set a timer to output a message (could as well execute another function)&lt;br /&gt;
	-- store the timer id in a table, using the player as index&lt;br /&gt;
	colshapeTimer[player] = setTimer(outputChatBox,10000,1,&amp;quot;The player stayed 10 seconds in the colshape!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeHit&amp;quot;, root, colShapeHit)&lt;br /&gt;
&lt;br /&gt;
function colShapeLeave(player)&lt;br /&gt;
	-- kill the timer when the player leaves the colshape&lt;br /&gt;
	killTimer(colshapeTimer[player])&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeLeave&amp;quot;, root, colShapeLeave)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
When a player enters the colshape, debugscript outputs the following message:&lt;br /&gt;
:{{Debug error|..[path]: attempt to index global 'colshapeTimer' (a nil value)}}&lt;br /&gt;
This means you tried to index a table that does not exist (because the table is a nil value, it doesn't exist). In the example above, this is done when storing the timer id in the table. We need to add a check if the table exists and if it does not exist we should create it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colShapeHit(player)&lt;br /&gt;
	if (colshapeTimer == nil) then&lt;br /&gt;
		colshapeTimer = {}&lt;br /&gt;
	end&lt;br /&gt;
	-- set a timer to output a message (could as well execute another function)&lt;br /&gt;
	-- store the timer id in a table, using the player as index&lt;br /&gt;
	colshapeTimer[player] = setTimer(outputChatBox,10000,1,&amp;quot;The player stayed 10 seconds in the colshape!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeHit&amp;quot;, root, colShapeHit)&lt;br /&gt;
&lt;br /&gt;
function colShapeLeave(player)&lt;br /&gt;
	-- kill the timer when the player leaves the colshape&lt;br /&gt;
	killTimer(colshapeTimer[player])&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeLeave&amp;quot;,root,colShapeLeave)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we will still receive a warning when a player enters the colshape, waits for the message and leaves it again:&lt;br /&gt;
&lt;br /&gt;
:{{Debug warning|[..]: Bad argument @ 'killTimer' Line: ..}}&lt;br /&gt;
&lt;br /&gt;
Except for that (we will talk about that later) everything seems to work fine. A player enters the colshape, the timer is started, if he stays the message occurs, if he leaves the timer is killed.&lt;br /&gt;
&lt;br /&gt;
===A more inconspicuous error===&lt;br /&gt;
But for some reason the message gets outputted twice when you stay in the colcircle while in a vehicle. Since it would appear some code is executed twice, we add debug messages to check this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colShapeHit(player)&lt;br /&gt;
	if (colshapeTimer == nil) then&lt;br /&gt;
		colshapeTimer = {}&lt;br /&gt;
	end&lt;br /&gt;
	-- add a debug message&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeHit&amp;quot;)&lt;br /&gt;
	-- set a timer to output a message (could as well execute another function)&lt;br /&gt;
	-- store the timer id in a table, using the player as index&lt;br /&gt;
	colshapeTimer[player] = setTimer(outputChatBox,10000,1,&amp;quot;The player stayed 10 seconds in the colshape!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeHit&amp;quot;,getRootElement(),colShapeHit)&lt;br /&gt;
&lt;br /&gt;
function colShapeLeave(player)&lt;br /&gt;
	-- add a debug message&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeLeave&amp;quot;)&lt;br /&gt;
	-- kill the timer when the player leaves the colshape&lt;br /&gt;
	killTimer(colshapeTimer[player])&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeLeave&amp;quot;,getRootElement(),colShapeLeave)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we notice that both handler functions get executed twice when we are in a vehicle, but only once when we are on-foot. It would appear the vehicle triggers the colshape as well. To confirm this theory, we ensure that the ''player'' variable actually holds a reference to a player element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colShapeHit(player)&lt;br /&gt;
	if (colshapeTimer == nil) then&lt;br /&gt;
		colshapeTimer = {}&lt;br /&gt;
	end&lt;br /&gt;
	-- add a debug message, with the element type&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeHit &amp;quot;..getElementType(player))&lt;br /&gt;
	-- set a timer to output a message (could as well execute another function)&lt;br /&gt;
	-- store the timer id in a table, using the player as index&lt;br /&gt;
	colshapeTimer[player] = setTimer(outputChatBox,10000,1,&amp;quot;The player stayed 10 seconds in the colshape!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeHit&amp;quot;,getRootElement(),colShapeHit)&lt;br /&gt;
&lt;br /&gt;
function colShapeLeave(player)&lt;br /&gt;
	-- add a debug message, with the element type&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeLeave &amp;quot;..getElementType(player))&lt;br /&gt;
	-- kill the timer when the player leaves the colshape&lt;br /&gt;
	killTimer(colshapeTimer[player])&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeLeave&amp;quot;,getRootElement(),colShapeLeave)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The debug messages tell us that one of the ''player'' variables is a player and that the other one is a vehicle element. Since we only want to react when a player enters the colshape, we add an ''if'' that will end the execution of the function if it's '''not''' an player element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colShapeHit(player)&lt;br /&gt;
	if (colshapeTimer == nil) then&lt;br /&gt;
		colshapeTimer = {}&lt;br /&gt;
	end&lt;br /&gt;
	-- add a check for the element type&lt;br /&gt;
	if (getElementType(player) ~= &amp;quot;player&amp;quot;) then return end&lt;br /&gt;
	-- add a debug message, with the element type&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeHit &amp;quot;..getElementType(player))&lt;br /&gt;
	-- set a timer to output a message (could as well execute another function)&lt;br /&gt;
	-- store the timer id in a table, using the player as index&lt;br /&gt;
	colshapeTimer[player] = setTimer(outputChatBox,10000,1,&amp;quot;The player stayed 10 seconds in the colshape!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeHit&amp;quot;,getRootElement(),colShapeHit)&lt;br /&gt;
&lt;br /&gt;
function colShapeLeave(player)&lt;br /&gt;
	-- add a check for the element type&lt;br /&gt;
	if (getElementType(player) ~= &amp;quot;player&amp;quot;) then return end&lt;br /&gt;
	-- add a debug message, with the element type&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeLeave &amp;quot;..getElementType(player))&lt;br /&gt;
	-- kill the timer when the player leaves the colshape&lt;br /&gt;
	killTimer(colshapeTimer[player])&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeLeave&amp;quot;,getRootElement(),colShapeLeave)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the script should work as desired, but it will still output the warning mentioned above. This happens because the timer we try to kill when a player leaves the colshape will not exist anymore when it has reached the 10 seconds (and therefore executed after the 10th second has completed). There are different ways to get rid of that warning (since you know that the timer might not exist anymore and you only want to kill it if it exists). One way would be to check if the timer referenced in the table really exists. To do this, we need to use [[isTimer]], which we will use when we kill the timer:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
if (isTimer(colshapeTimer[player])) then&lt;br /&gt;
	killTimer(colshapeTimer[player])&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So the complete working code would be:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colShapeHit(player)&lt;br /&gt;
	if (colshapeTimer == nil) then&lt;br /&gt;
		colshapeTimer = {}&lt;br /&gt;
	end&lt;br /&gt;
	-- add a check for the element type&lt;br /&gt;
	if (getElementType(player) ~= &amp;quot;player&amp;quot;) then return end&lt;br /&gt;
	-- add a debug message, with the element type&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeHit &amp;quot;..getElementType(player))&lt;br /&gt;
	-- set a timer to output a message (could as well execute another function)&lt;br /&gt;
	-- store the timer id in a table, using the player as index&lt;br /&gt;
	colshapeTimer[player] = setTimer(outputChatBox,10000,1,&amp;quot;The player stayed 10 seconds in the colshape!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeHit&amp;quot;,getRootElement(),colShapeHit)&lt;br /&gt;
&lt;br /&gt;
function colShapeLeave(player)&lt;br /&gt;
	-- add a check for the element type&lt;br /&gt;
	if (getElementType(player) ~= &amp;quot;player&amp;quot;) then return end&lt;br /&gt;
	-- add a debug message, with the element type&lt;br /&gt;
	outputDebugString(&amp;quot;colShapeLeave &amp;quot;..getElementType(player))&lt;br /&gt;
	-- kill the timer when the player leaves the colshape&lt;br /&gt;
	if (isTimer(colshapeTimer[player])) then&lt;br /&gt;
		killTimer(colshapeTimer[player])&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onColShapeLeave&amp;quot;,getRootElement(),colShapeLeave)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Debugging Performance Issues==&lt;br /&gt;
&lt;br /&gt;
If your server is using up more resources than it should or you just want to make sure your scripts are efficient, you can find the source of the issue by using a great tool that comes with the default resource package called [[Resource:Performancebrowser|performancebrowser]]. You can start it with ''''start performancebrowser''''. If it doesn't exist then you can get the latest resources from the [https://github.com/multitheftauto/mtasa-resources GitHub repository]. This tool provides an incredible amount of information for performance debugging. Memory leaks, element leaks and CPU intensive scripts are all easily findable via performancebrowser. If you use the ''''d'''' option in Lua timing you can see which functions are using up the CPU.&lt;br /&gt;
&lt;br /&gt;
To access performancebrowser you will need to go to your web browser and enter the address: http://serverIPHere:serverHTTPPortHere/performancebrowser/ Note that the / at the end is required. So for example: http://127.0.0.1:22005/performancebrowser/ You will then need to login with an in-game admin account or any account that has access to ''''resource.performancebrowser.http'''' and ''''resource.ajax.http''''. Most of the information you will need are in the categories Lua timing and Lua memory, look for values that are much higher than other values.&lt;br /&gt;
&lt;br /&gt;
===Examples of scripts that could cause performance problems===&lt;br /&gt;
&lt;br /&gt;
Adding data to a table but never removing it. This would take months/years before it causes a problem though.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local someData = {}&lt;br /&gt;
&lt;br /&gt;
function storeData()&lt;br /&gt;
    someData[source] = true&lt;br /&gt;
    -- There is no handling for when a player quits, this is considered a memory leak&lt;br /&gt;
    -- Using the Lua timing tab you can detect the RAM usage of each resource.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, storeData)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Element leaking is possible if you use temporary colshapes for whatever reason and may not destroy them. This would cause bandwidth, CPU and memory performance issues over time.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function useTemporaryCol()&lt;br /&gt;
    local col = createColCircle(some code here)&lt;br /&gt;
    if (normally this should happen) then&lt;br /&gt;
        destroyElement(col)&lt;br /&gt;
    end&lt;br /&gt;
    -- But sometimes it didn't so the script ended but the collision area remained and over time&lt;br /&gt;
    -- you may end up with hundreds to thousands of pointless collision areas. &lt;br /&gt;
    -- The Lua timing tab allows you to see the amount of elements each script has created.&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
High CPU usage resulting in the server FPS dropping so much that the server is unplayable. In under 24 hours this can create havoc on a very busy server. The amount of &amp;quot;refs&amp;quot; in the Lua timing detect this type of build up, surprisingly the Lua timing tab didn't help in this case but Lua memory did.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, function()&lt;br /&gt;
    -- Code for joiner&lt;br /&gt;
    addEventHandler(&amp;quot;onPlayerQuit&amp;quot;, root, function()&lt;br /&gt;
        -- Code for when they have quit&lt;br /&gt;
        -- See the problem? It's bound to root which the event handler is being added again and again and again&lt;br /&gt;
    end)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A function uses up a lot of your CPU because whatever it does takes a long time. This is just some function that takes a long time to complete. Without performancebrowser you'd have no idea its the cause but with performancebrowser you can see that a resource is using lots of CPU in the Lua timing tab. If you then enter: ''''d'''' into the options edit box it will even tell you what file name and first line of the function that is using up so much CPU.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function someDodgyCode()&lt;br /&gt;
    for i=1, 100000 do&lt;br /&gt;
        -- some code&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[it:Guida al Debug]]&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[ru:Debugging]]&lt;br /&gt;
[[zh-cn:脚本调试教程]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleLightState&amp;diff=54095</id>
		<title>SetVehicleLightState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleLightState&amp;diff=54095"/>
		<updated>2018-03-06T15:49:51Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Added OOP syntax part&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function sets the state of the light on the vehicle.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setVehicleLightState ( vehicle theVehicle, int light, int state )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[vehicle]]:setLightState||getVehicleLightState}}&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''theVehicle:''' A handle to the [[vehicle]] that you wish to change the light state of.&lt;br /&gt;
*'''light:''' A whole number determining the individual light. (0 - 3)&lt;br /&gt;
*'''state:''' A whole number determining the new state of the light. ''0'' represents normal lights, and ''1'' represents broken lights.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the light state was set successfully, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
newcar = createVehicle ( 520, 1024, 1024, 1024 )   -- create a new vehicle&lt;br /&gt;
state = setVehicleLightState ( newcar, 0,  1 )     -- break the left front light&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FileOpen&amp;diff=51792</id>
		<title>FileOpen</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FileOpen&amp;diff=51792"/>
		<updated>2017-08-04T14:29:01Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Added warning about function's limitations as of 1.5.4.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
Opens an existing file for reading and writing.&lt;br /&gt;
{{Note|To prevent memory leaks, ensure each successful call to [[fileOpen]] has a matching call to [[fileClose]].}}&lt;br /&gt;
{{Tip|The file functions should not be used to implement configuration files. It is encouraged to use the XML functions for this instead.}}&lt;br /&gt;
{{MessageBox|bordercolorhex=FFB2B2|bgcolorhex=FFE5E5|image=File:Dialog-warning.png|title=Warning:|message=As of 1.5.4 [https://buildinfo.mtasa.com/?Author=&amp;amp;Branch=&amp;amp;Revision=10413 r10413], this function will fail when trying to access a script file of another resource, even with ''general.ModifyOtherObjects'' rights granted, which uses a ''mysql'' connection through [[dbConnect]] when [[Server_mtaserver.conf#database_credentials_protection|''database_credentials_protection'']] is enabled in the server configuration. Additionally, meta.xml will be un-writable and will always open in read-only mode.}} &amp;lt;!-- The {Warning} template didn't want to work with an external link to buildinfo, so I had to use the {MessageBox} template --&amp;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;
file fileOpen ( string filePath [, bool readOnly = false ])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[File]]}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''filePath:''' The [[filepath]] of the file in the following format: '''&amp;quot;:resourceName/path&amp;quot;'''. 'resourceName' is the name of the resource the file is in, and 'path' is the path from the root directory of the resource to the file.&lt;br /&gt;
:For example, if there is a file named 'coolObjects.txt' in the resource 'objectSearch', it can be opened from another resource this way: ''fileOpen(&amp;quot;:objectSearch/coolObjects.txt&amp;quot;)''.&lt;br /&gt;
:If the file is in the current resource, only the file path is necessary, e.g. ''fileOpen(&amp;quot;coolObjects.txt&amp;quot;)''.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''readOnly:''' By default, the file is opened with reading and writing access. You can specify ''true'' for this parameter if you only need reading access.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If successful, returns a file handle for the file. Otherwise returns ''false'' (f.e. if the file doesn't exist).&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example opens the file test.txt that is in the root of the current resource, 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 hFile = fileOpen(&amp;quot;test.txt&amp;quot;, true)       -- attempt to open the file (read only)&lt;br /&gt;
if hFile then                                  -- check if it was successfully opened&lt;br /&gt;
    local buffer&lt;br /&gt;
    while not fileIsEOF(hFile) do              -- as long as we're not at the end of the file...&lt;br /&gt;
        buffer = fileRead(hFile, 500)          -- ... read the next 500 bytes...&lt;br /&gt;
        outputConsole(buffer)                  -- ... and output them to the console&lt;br /&gt;
    end&lt;br /&gt;
    fileClose(hFile)                           -- close the file once we're done with it&lt;br /&gt;
else&lt;br /&gt;
    outputConsole(&amp;quot;Unable to open test.txt&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example show how to append data to an existing file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local hFile = fileOpen(&amp;quot;test.txt&amp;quot;)             -- attempt to open the file (read and write mode)&lt;br /&gt;
if hFile then                                  -- check if it was successfully opened&lt;br /&gt;
    fileSetPos( hFile, fileGetSize( hFile ) )  -- move position to the end of the file&lt;br /&gt;
    fileWrite(hFile, &amp;quot;hello&amp;quot; )                 -- append data&lt;br /&gt;
    fileClose(hFile)                           -- close the file once we're done with it&lt;br /&gt;
else&lt;br /&gt;
    outputConsole(&amp;quot;Unable to open test.txt&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
{{File functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RangeToTable&amp;diff=46034</id>
		<title>RangeToTable</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RangeToTable&amp;diff=46034"/>
		<updated>2015-10-14T18:07:16Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function converts a string range to a table containing number values.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table rangeToTable ( string range )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''range''': The range string (eg. &amp;quot;1,4,10-15,2&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table containing all ranged values.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function rangeToTable( range )&lt;br /&gt;
    assert(range, type(range)==&amp;quot;string&amp;quot;, &amp;quot;Bad argument @ rangeToTable. Expected 'string', got '&amp;quot;..type(range)..&amp;quot;'&amp;quot;)&lt;br /&gt;
    local numbers = split(range, &amp;quot;,&amp;quot;)&lt;br /&gt;
    local output = {}&lt;br /&gt;
    for k, v in ipairs(numbers) do&lt;br /&gt;
        if tonumber(v) then&lt;br /&gt;
            table.insert(output, tonumber(v))&lt;br /&gt;
        else&lt;br /&gt;
            local st,en = tonumber(gettok(v, 1, &amp;quot;-&amp;quot;)), tonumber(gettok(v, 2, &amp;quot;-&amp;quot;))&lt;br /&gt;
            if st and en then&lt;br /&gt;
                for i = st, en, (st&amp;lt;en and 1 or -1) do&lt;br /&gt;
                    table.insert(output, tonumber(i))&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return output&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Author: MrTasty'''&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Needs example.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--TODO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Writing_Gamemodes&amp;diff=45787</id>
		<title>Writing Gamemodes</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Writing_Gamemodes&amp;diff=45787"/>
		<updated>2015-08-24T06:49:36Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Helpmanager */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide tries to outline the process of how to write a proper gamemode. If you just started with scripting for MTA, you may want to check the other scripting tutorials at the [[Main Page]] first.&lt;br /&gt;
==Introduction==&lt;br /&gt;
A gamemode is a resource that, once started, controls all of the gameplay. This may include telling the players what to do, spawning players, creating teams, defining what the players have to do to win or to get points and much more. Examples are Race and Deathmatch. &lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;proper gamemode&amp;quot; mean?==&lt;br /&gt;
To put it simply, a proper gamemode is one that makes full use of MTA's .map file system. This means that the gamemode code does not have any map-specific data hardcoded in it, like positions of players or cars. Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Map Files===&lt;br /&gt;
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.&lt;br /&gt;
&lt;br /&gt;
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for &amp;quot;special&amp;quot;, gamemode specific information, you need to invent your own syntax.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Example of getting the .map information====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&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 startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the [[Resource:Helpmanager|helpmanager help page]] for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the [[Resource:Dxscoreboard|scoreboard help page]] for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Writing_Gamemodes&amp;diff=45786</id>
		<title>Writing Gamemodes</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Writing_Gamemodes&amp;diff=45786"/>
		<updated>2015-08-24T06:49:34Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Scoreboard */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide tries to outline the process of how to write a proper gamemode. If you just started with scripting for MTA, you may want to check the other scripting tutorials at the [[Main Page]] first.&lt;br /&gt;
==Introduction==&lt;br /&gt;
A gamemode is a resource that, once started, controls all of the gameplay. This may include telling the players what to do, spawning players, creating teams, defining what the players have to do to win or to get points and much more. Examples are Race and Deathmatch. &lt;br /&gt;
&lt;br /&gt;
==What does &amp;quot;proper gamemode&amp;quot; mean?==&lt;br /&gt;
To put it simply, a proper gamemode is one that makes full use of MTA's .map file system. This means that the gamemode code does not have any map-specific data hardcoded in it, like positions of players or cars. Instead, the gamemode should be able to load .map files which define these data. This way the gamemode can have multiple maps; also, people can create .map files for the gamemode with MTA's map editor, which is much more convenient than writing code.&lt;br /&gt;
&lt;br /&gt;
An obvious example of a &amp;quot;proper gamemode&amp;quot; is MTA:Race. It allows usermade maps with lots of possibilities within the .map file. To alter spawnpoints, objects etc., the user doesn't need to edit the gamemode itself.&lt;br /&gt;
&lt;br /&gt;
===Map Files===&lt;br /&gt;
Map files are basically XML documents with a .map extension. They define an environment to play one or more specific gamemodes in. They are however not supposed to change the rules of the game - those are defined by the gamemode.&lt;br /&gt;
&lt;br /&gt;
Each element in a map corresponds to a node in the .map file. There is standard syntax for common things like spawnpoints, objects and vehicles; however, for &amp;quot;special&amp;quot;, gamemode specific information, you need to invent your own syntax.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
Let's take a Capture the Flag gamemode as an example. A map for this gamemode needs to mainly define spawnpoints and flag locations, and eventually objects and vehicles. A simplified map file could look like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map&amp;gt;&lt;br /&gt;
    &amp;lt;spawnpoint id=&amp;quot;spawnpoint1&amp;quot; posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; rot=&amp;quot;63.350006103516&amp;quot; model=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;pickup id=&amp;quot;Armor 1&amp;quot; posX=&amp;quot;1911.083984375&amp;quot; posY=&amp;quot;-1658.8798828125&amp;quot; posZ=&amp;quot;885.40216064453&amp;quot; type=&amp;quot;armor&amp;quot; health=&amp;quot;50&amp;quot; respawn=&amp;quot;60000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;flag posX=&amp;quot;1959.5487060547&amp;quot; posY=&amp;quot;-1714.4613037109&amp;quot; posZ=&amp;quot;877.25219726563&amp;quot; team=&amp;quot;blue&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see two MTA elements - a spawnpoint and a pickup. More importantly, this .map has a custom &amp;quot;flag&amp;quot; node which defines the position and color of the flag. The spawnpoint and pickup can be handled by existing external resources, custom elements have to be processed by the gamemode.&lt;br /&gt;
&lt;br /&gt;
To summarize - we want mass mapper input as we saw in MTA:Race. Users should NOT have to touch the gamemode script itself at all.&lt;br /&gt;
&lt;br /&gt;
====Example of getting the .map information====&lt;br /&gt;
As mentioned above, your gamemode needs de retrieve custom elements that are defined in a map file and process them. This is quite easy as demonstrated below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- retrieve a table with all flag elements&lt;br /&gt;
local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; )&lt;br /&gt;
-- loop through them&lt;br /&gt;
for key, value in pairs(flagElements) do&lt;br /&gt;
	-- get our info&lt;br /&gt;
	local posX = getElementData ( value, &amp;quot;posX&amp;quot; )&lt;br /&gt;
	local posY = getElementData ( value, &amp;quot;posY&amp;quot; )&lt;br /&gt;
	local posZ = getElementData ( value, &amp;quot;posZ&amp;quot; )&lt;br /&gt;
	local team = getElementData ( value, &amp;quot;team&amp;quot; )&lt;br /&gt;
	-- create an object according to the flag position&lt;br /&gt;
	createObject ( 1337, posX, posY, posZ )&lt;br /&gt;
	-- output the team that we created a base for&lt;br /&gt;
	outputChatBox ( &amp;quot;Base for team &amp;quot; .. team .. &amp;quot; created&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The [[getElementsByType]] function retrieves a table of all the elements of a certain type (the type corresponds to the node name in the .map file). This works for both custom types and built-in MTA types (like &amp;quot;vehicle&amp;quot; or &amp;quot;player&amp;quot;).&lt;br /&gt;
[[getElementData]] can be used to retrieve the xml attributes set in the .map file.&lt;br /&gt;
In this simple example, an object is created at the flag's location and a message is outputted in the chatbox. In reality, you will of course need to do more during map loading, like in this case setting up collision shapes to detect players taking the flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Map manager==&lt;br /&gt;
Having read the section above it should be clear that a gamemode should always consist of two parts:&lt;br /&gt;
* The gamemode resource that always stays the same&lt;br /&gt;
* Many different maps resources that give the gamemode map-specific information&lt;br /&gt;
&lt;br /&gt;
Now instead of writing a map-loader for every single gamemode, the [[Map manager]] provides functions to load gamemodes and maps. Simply put, when you enter the correct command (for example 'gamemode ctf ctf-italy') it will start both resources 'ctf' and 'ctf-italy' while triggering an event ([[onGamemodeMapStart]]) to tell the 'ctf' resource that a map was loaded. The 'ctf' resource can then access the information 'ctf-italy' contains and start spawning players etc.&lt;br /&gt;
&lt;br /&gt;
===How to use the mapmanager===&lt;br /&gt;
To use the mapmanager service, your gamemode resource has to be tagged as such first. More specifically you'll be setting the &amp;quot;type&amp;quot; attribute of its &amp;lt;info&amp;gt; tag to &amp;quot;gamemode&amp;quot; inside meta.xml. Also, you can set the &amp;quot;name&amp;quot; attribute to a friendly name (like &amp;quot;Capture the flag&amp;quot;) that will be shown on ASE instead of the resource name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- meta.xml in &amp;quot;cowcatapult&amp;quot; gamemode --&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Cow catapulting 2.0&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your gamemode is going to load custom maps, you should add handlers for&lt;br /&gt;
* onGamemodeMapStart&lt;br /&gt;
* onGamemodeMapStop (if any unloading is necessary)&lt;br /&gt;
These are fired when a map for your gamemode is started or stopped, and pass the map resource as a parameter.&lt;br /&gt;
Within the handler function for these events you can extract all info you need from the resource's map files and configuration files.&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 startCtfMap( startedMap ) -- startedMap contains a reference to the resource of the map&lt;br /&gt;
    local mapRoot = getResourceRootElement( startedMap )        -- get the root node of the started map&lt;br /&gt;
    local flagElements = getElementsByType ( &amp;quot;flag&amp;quot; , mapRoot ) -- get all flags in the map and store them in a table&lt;br /&gt;
    -- go on loading information like in the example above&lt;br /&gt;
    -- spawn players etc.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), startCtfMap)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Making maps compatible===&lt;br /&gt;
Maps are separate resources. This is done so no editing of the gamemode resource is ever necessary in order to create a custom map, and also allows you to pack map-specific scripts/config files with them.&lt;br /&gt;
&lt;br /&gt;
To make a map compatible with your gamemode, open its resource's meta.xml and tag it as well: the &amp;quot;type&amp;quot; attribute must be set to &amp;quot;map&amp;quot;, and the &amp;quot;gamemodes&amp;quot; attribute must be a comma-separated list (no spaces) of gamemode resource names that the map works with.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--map's meta.xml--&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;cowcatapult,assault,tdm&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have everything set up, admins will use these two commands to start/stop gamemodes:&lt;br /&gt;
/gamemode gamemodeName [mapName] (optional parameter allows picking an initial map, defaults to none)&lt;br /&gt;
/changemap mapName [gamemodeName] (optional parameter specifies the gamemode to start the map with, defaults to the current one)&lt;br /&gt;
&lt;br /&gt;
[[Map manager]] exports a few more access functions which you don't have to use, but may be useful.&lt;br /&gt;
&lt;br /&gt;
==What else should you do==&lt;br /&gt;
There are several other resources that gamemodes should use/be compliant with.&lt;br /&gt;
&lt;br /&gt;
===Helpmanager===&lt;br /&gt;
The helpmanager is ought to be the standard interface for players when they need help. If you use the helpmanager to display your gamemode's help, every player that used helpmanager before (e.g. in other gamemodes) will immediately know how to get there. It also displays help for different resources running resources in one window, if necessary.&lt;br /&gt;
&lt;br /&gt;
There are basicially two ways to use the helpmanager:&lt;br /&gt;
* Provide a simple text that explains how to use your gamemode&lt;br /&gt;
* Request a GUI element from the helpmanager that will be displayed in its own tab in the helpmanager window and lets you add any GUI elements to it. This is the recommended way for gamemodes that need to display more complex information that needs its own GUI.&lt;br /&gt;
&lt;br /&gt;
Read the helpmanager page for details on how to do it.&lt;br /&gt;
&lt;br /&gt;
===Scoreboard===&lt;br /&gt;
Scoreboard displays players and teams currently ingame. You add custom columns to it to provide map specific information. For example the column 'points' in the 'ctf' gamemode could represent the player's points gained through kills or captures. As usual, see the [[Resource:Dxscoreboard|scoreboard help page]] for more information.&lt;br /&gt;
&lt;br /&gt;
===Map cycler===&lt;br /&gt;
The map cycler controls what gamemodes and maps are played on a server. You can specifiy for example how many times in a row a map will be played until it switches to the next. To achieve this, you need to tell the map cycler when your gamemode finished (e.g. when a round ends).&lt;br /&gt;
&lt;br /&gt;
[[it:Scrivere una gamemode]]&lt;br /&gt;
[[ru:Writing Gamemodes]]&lt;br /&gt;
[[de:Gamemodes schreiben]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientVehicleEnter&amp;diff=45467</id>
		<title>OnClientVehicleEnter</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientVehicleEnter&amp;diff=45467"/>
		<updated>2015-07-23T21:07:17Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Example */ Typo fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This event gets fired when a player enters a vehicle.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player thePlayer, int seat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''thePlayer:''' the player that entered the vehicle&lt;br /&gt;
*'''seat:''' the number of the seat that the player is now sitting on. 0 = driver, higher numbers are passenger seats.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The source of the event is the vehicle that the player entered.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This code updates a GUI label with the name of the vehicle the local player is in.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
lblVehicle = guiCreateLabel(10, 200, 150, 20, &amp;quot;Currently on foot&amp;quot;, false)&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleEnter&amp;quot;, getRootElement(),&lt;br /&gt;
    function(thePlayer, seat)&lt;br /&gt;
        if thePlayer == getLocalPlayer() then&lt;br /&gt;
            guiSetText(lblVehicle, &amp;quot;Currently in a &amp;quot; .. getVehicleName(source))&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleExit&amp;quot;, getRootElement(),&lt;br /&gt;
    function(thePlayer, seat)&lt;br /&gt;
        if thePlayer == getLocalPlayer() then&lt;br /&gt;
            guiSetText(lblVehicle, &amp;quot;Currently on foot&amp;quot;)&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;
==See Also==&lt;br /&gt;
===Client vehicle events===&lt;br /&gt;
{{Client_vehicle_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;br /&gt;
[[es:onClientVehicleEnter]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_Tips&amp;diff=45252</id>
		<title>Scripting Tips</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_Tips&amp;diff=45252"/>
		<updated>2015-05-29T08:59:39Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* General Lua */ Added another point&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains a variety of things that knowing, make life easier for MTA scripters.&lt;br /&gt;
&lt;br /&gt;
== General Lua ==&lt;br /&gt;
* The ''infinite loop / too long execution error'' which aborts execution can be disabled with ''debug.sethook(nil)''&lt;br /&gt;
* Be careful when looping a table where you intend to delete multiple rows, if 2 of them are in a row the 2nd one will get skipped! You must loop the table backwards (reverse ipairs). For example: ''for i = #table, 1, -1 do''&lt;br /&gt;
* Rather than having if checks inside if checks inside if checks, consider using ''return'' for example ''if (not ready) then return false end''&lt;br /&gt;
* Keep variable &amp;amp; function names short - longer names will make the file larger in size. In large files, this will increase download time.&lt;br /&gt;
* Remember that 'false' boolean has a value - If you want to delete a variable or element/account data, use 'nil' instead - this will reduce memory and disk usage (minuscule optimisation, only notable on larger servers)&lt;br /&gt;
&lt;br /&gt;
== MTA Scripting ==&lt;br /&gt;
* Remember that 99% of the time it's a bug in your script, not an MTA bug! Don't report something to the mantis until you're absolutely certain the bug can be reproduced with a small piece of script.&lt;br /&gt;
* As MTA already has so many functions and events virtually everything you want to do is already possible, as long as you're willing to do the work! You'll find better solutions to problems as there are many ways to achieve the same thing as long as you know all the functions and events.&lt;br /&gt;
* If a script is getting too complicated, try putting back-end stuff in another file so the main script calls the functions in the 2nd one. For example rather than having meaningless things like ''vehicleTable[vehicle][7]'' in the main file, put that in a function in the 2nd file and have the main file call a meaningfully named function so rather than seeing a useless ''7'' you'd see something like ''getFuel'' and although this might take longer to set-up you'll save time in the long run as you'll spend less time being confused when you come back to it in a weeks time to debug a problem.&lt;br /&gt;
* Your client side scripts can cause desync if you're not careful, try to keep the psychical world equal with every player. For example if your script creates a client side object make sure your script will create it for everyone nearby, else people will be wondering why a player appears to be constantly floating and falling.&lt;br /&gt;
* Instead of using ''onClientResourceStart'' or ''onResourceStart'' events attached to ''resourceRoot'' like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function warnPeopleThatThisResourceStarted()&lt;br /&gt;
    outputChatBox(&amp;quot;The resource &amp;quot; .. getResourceName(resource) .. &amp;quot; has just started!&amp;quot;, 0, 255, 0)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, warnPeopleThatThisResourceStarted)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can also use this outside of any function:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;outputChatBox(&amp;quot;The resource &amp;quot; .. getResourceName(resource) .. &amp;quot; has just started!&amp;quot;, 0, 255, 0)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
And the result will be the same, because Lua executes every instruction in every script file of a resource when it starts.&lt;br /&gt;
* string.dump produces unsigned compiled Lua code which is not allowed for security reasons. The only way to transport code now is by using the source code. e.g.:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;exampleFunction = [===[&lt;br /&gt;
    return param&lt;br /&gt;
]===]&lt;br /&gt;
&lt;br /&gt;
local loadedFunction = loadstring(exampleFunction)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MTA Scripting - Element IDs Being Reused ==&lt;br /&gt;
* If your script is covered in [[isTimer]] and [[isElement]] checks to hide debug warnings from deleted elements not being dereferenced (making the variable nil) you will regret it when that element ID or timer pointer has to be re-used by MTA in a weeks time and your script starts acting strangely and you won't have a clue why. Dereference destroyed elements and disconnected players!&lt;br /&gt;
* Why would MTA reuse it in a weeks time? Everything has a userdata value whether it's a function or an element, there is a limited amount of these available meaning that eventually the server will be forced to use the same userdata value twice, as long as whatever that userdata value was for is no longer valid. This could happen within hours, weeks or even never depending on how many elements are being created and destroyed by your scripts.&lt;br /&gt;
* For example if you have a race server that has 100 objects in every map and the map was changing every 5 minutes your server would go through at least 1200 an hour, 28,800 a day, 201,600 a week in userdata values, it can't keep going up and up though eventually it will have to reuse the same userdata values and as long as you're dereferencing in your scripts, it won't be a problem.&lt;br /&gt;
&lt;br /&gt;
The is an example of a script which fails to dereference, because when the player quits their userdata value remains in the table, but what if in a weeks time another player joins and they get assigned the same userdata value?&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
local admins = {}&lt;br /&gt;
local secretPasswordOnlyAdminsShouldKnow = &amp;quot;12345678&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function adminLogin()&lt;br /&gt;
    if (hasObjectPermissionTo(source, &amp;quot;command.ban&amp;quot;, false)) then&lt;br /&gt;
        admins[source] = true&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, adminLogin)&lt;br /&gt;
&lt;br /&gt;
function cmdGetSecretPassword(plr)&lt;br /&gt;
    if (not admins[plr]) then&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(&amp;quot;The secret password is &amp;quot;..secretPasswordOnlyAdminsShouldKnow, plr)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;getsecretpass&amp;quot;, cmdGetSecretPassword)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some random player who joins in a weeks time gets the same userdata value as an admin, that player can now use &amp;quot;getsecretpass&amp;quot;. Solution? De-reference on destruction!&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function onQuit()&lt;br /&gt;
    admins[source] = nil&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerQuit&amp;quot;, root, onQuit)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Server Performance ==&lt;br /&gt;
* Server lagging? Check [[Debugging#Debugging_Performance_Issues|this page of debugging performance issues]]&lt;br /&gt;
* Using resourceRoot in event handlers for events from clients is much more efficient than using root.&lt;br /&gt;
* Try to be efficient, but if what you're doing is too time consuming or complex, is it really efficient?&lt;br /&gt;
* It's much more efficient to set player health client side, consider a client event all your server scripts can call to set a players health.&lt;br /&gt;
* Unless you have hundreds of players, don't worry about making little optimizations, check ''performancebrowser'' or ''ipb'' (ingame performancebrowser) and make sure no resource is using significantly more than the others.&lt;br /&gt;
&lt;br /&gt;
== Client Performance ==&lt;br /&gt;
* The biggest cause of client script CPU usage is anything done in onClient/Pre/Hud/Render because it is called so often. For example if you have a script which calls dxDrawLine3D 20 times, 60 times a second, if those lines are only in 1 part of the map, consider adding a [[getDistanceBetweenPoints3D]] check between the local player and the general area that those lines are in and if they're no where near the player, don't draw the lines.&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCameraRotation&amp;diff=45174</id>
		<title>GetCameraRotation</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCameraRotation&amp;diff=45174"/>
		<updated>2015-05-04T21:07:52Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Fixed a typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Warning|'''This function no longer exists'''. However, below is a function that achieves a similar result.|true}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local function getCameraRotation ()&lt;br /&gt;
    local px, py, pz, lx, ly, lz = getCameraMatrix()&lt;br /&gt;
    local rotz = 6.2831853071796 - math.atan2 ( ( lx - px ), ( ly - py ) ) % 6.2831853071796&lt;br /&gt;
    local rotx = math.atan2 ( lz - pz, getDistanceBetweenPoints2D ( lx, ly, px, py ) )&lt;br /&gt;
    --Convert to degrees&lt;br /&gt;
    rotx = math.deg(rotx)&lt;br /&gt;
    rotz = -math.deg(rotz)	&lt;br /&gt;
    return rotx, 180, rotz&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Camera functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RangeToTable&amp;diff=44846</id>
		<title>RangeToTable</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RangeToTable&amp;diff=44846"/>
		<updated>2015-04-10T11:00:09Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function converts a string range to a table containing number values.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table rangeToTable ( string range )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''range''': The range string (eg. &amp;quot;1,4,10-15,2&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table containing all ranged values.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function rangeToTable( range )&lt;br /&gt;
    assert(range, type(range)==&amp;quot;string&amp;quot;, &amp;quot;Bad argument @ rangeToTable. Expected 'string', got '&amp;quot;..type(range)..&amp;quot;'&amp;quot;)&lt;br /&gt;
    local numbers = split(range, &amp;quot;,&amp;quot;)&lt;br /&gt;
    local output = {}&lt;br /&gt;
    for k, v in ipairs(numbers) do&lt;br /&gt;
        if tonumber(v) then&lt;br /&gt;
            table.insert(output, tonumber(v))&lt;br /&gt;
        else&lt;br /&gt;
            local st,en = gettok(v, 1, &amp;quot;-&amp;quot;), gettok(v, 2, &amp;quot;-&amp;quot;)&lt;br /&gt;
            for i = st, en, (st&amp;lt;en and 1 or -1) do&lt;br /&gt;
                table.insert(output, tonumber(i))&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return output&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Author: MrTasty'''&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Needs example.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--TODO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=44845</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=44845"/>
		<updated>2015-04-10T10:59:17Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Added rangeToTable&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[attachEffect]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[bindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[capitalize]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function capitalizes a given string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts and formats large numbers.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertServerTickToTimeStamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[dxDrawAnimWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[dxDrawCircle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a number of 2D lines in order to achieve a circle shape on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawEmptyRec]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws an empty 2D rectangle on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function generates a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateRandomASCIIString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a given birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getBanFromName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This functions returns the ban of the given playername.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBoundControls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getCurrentFPS]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementsInDimension]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementsWithinMarker]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getKeyFromValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string of all logged-in administrators separated by two whitespace characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxHealth]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from their serial.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerAcls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getPlayersByData]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getPlayerCity]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This functions returns a string containing the player's city name&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceScripts]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource scripts.&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-family:'Georgia',sans-serif; 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;
*[[getTeamFromColor]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getValidVehicleModels]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getVehicleRespawnPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get the respawn position of a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all children of a XML node.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[guiGridListGetSelectedText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isMouseInPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPedDrivingVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPlayerInACL]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isSoundFinished]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element has finished.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleEmpty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[mathNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[math.percent]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[rangeToTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[renameAclGroup]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[secondsToTimeDesc]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setAccountName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is used to change an existing account's name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.compare]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a table is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[unbindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[isPedAimingNearPed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RangeToTable&amp;diff=44844</id>
		<title>RangeToTable</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RangeToTable&amp;diff=44844"/>
		<updated>2015-04-10T10:58:16Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Created page with &amp;quot;{{Useful Function}} {{Needs_Example}} __NOTOC__ This function converts a string range to a table containing number values  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table rangeToTable ( string ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function converts a string range to a table containing number values&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table rangeToTable ( string range )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''range''': The range string (eg. &amp;quot;1,4,10-15,2&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table containing all ranged values&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function rangeToTable( range )&lt;br /&gt;
    assert(range, type(range)==&amp;quot;string&amp;quot;, &amp;quot;Bad argument @ rangeToTable. Expected 'string', got '&amp;quot;..type(range)..&amp;quot;'&amp;quot;)&lt;br /&gt;
    local numbers = split(range, &amp;quot;,&amp;quot;)&lt;br /&gt;
    local output = {}&lt;br /&gt;
    for k, v in ipairs(numbers) do&lt;br /&gt;
        if tonumber(v) then&lt;br /&gt;
            table.insert(output, tonumber(v))&lt;br /&gt;
        else&lt;br /&gt;
            local st,en = gettok(v, 1, &amp;quot;-&amp;quot;), gettok(v, 2, &amp;quot;-&amp;quot;)&lt;br /&gt;
            for i = st, en, (st&amp;lt;en and 1 or -1) do&lt;br /&gt;
                table.insert(output, tonumber(i))&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return output&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Author: MrTasty'''&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Needs example&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--TODO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AclRemoveRight&amp;diff=44839</id>
		<title>AclRemoveRight</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AclRemoveRight&amp;diff=44839"/>
		<updated>2015-04-09T13:49:41Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}} &lt;br /&gt;
&amp;lt;!-- Describe in plain english what this function does. Don't go into details, just give an overview --&amp;gt;&lt;br /&gt;
This function removes the given right (string) from the given ACL.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool aclRemoveRight ( acl theAcl, string rightName ) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[acl]]:removeRight||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
&amp;lt;!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type --&amp;gt;&lt;br /&gt;
*'''theAcl:''' The ACL to remove the right from&lt;br /&gt;
*'''rightName:''' The ACL name to remove from the right from&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
&amp;lt;!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check --&amp;gt;&lt;br /&gt;
Returns ''true'' if the given right was successfully removed from the given ACL, ''false'' or ''nil'' if it could not be removed for some reason, ie. it didn't exist in the ACL.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example removes an acl right on resource start.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot,function()&lt;br /&gt;
   aclRemoveRight(aclGet(&amp;quot;Admin&amp;quot;),&amp;quot;function.setServerPassword&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&amp;lt;!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --&amp;gt;&lt;br /&gt;
{{ACL_functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_Tips&amp;diff=44834</id>
		<title>Scripting Tips</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_Tips&amp;diff=44834"/>
		<updated>2015-04-07T10:22:25Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains a variety of things that knowing, make life easier for MTA scripters.&lt;br /&gt;
&lt;br /&gt;
== General Lua ==&lt;br /&gt;
* The ''infinite loop / too long execution error'' which aborts execution can be disabled with ''debug.sethook(nil)''&lt;br /&gt;
* Be careful when looping a table where you intend to delete multiple rows, if 2 of them are in a row the 2nd one will get skipped! You must loop the table backwards (reverse ipairs). For example: ''for i = #table, 1, -1 do''&lt;br /&gt;
* Rather than having if checks inside if checks inside if checks, consider using ''return'' for example ''if (not ready) then return false end''&lt;br /&gt;
* Keep variable &amp;amp; function names short - longer names will make the file larger in size. In large files, this will increase download time.&lt;br /&gt;
== MTA Scripting ==&lt;br /&gt;
* Remember that 99% of the time it's a bug in your script, not an MTA bug! Don't report something to the mantis until you're absolutely certain the bug can be reproduced with a small piece of script.&lt;br /&gt;
* As MTA already has so many functions and events virtually everything you want to do is already possible, as long as you're willing to do the work! You'll find better solutions to problems as there are many ways to achieve the same thing as long as you know all the functions and events.&lt;br /&gt;
* If a script is getting too complicated, try putting back-end stuff in another file so the main script calls the functions in the 2nd one. For example rather than having meaningless things like ''vehicleTable[vehicle][7]'' in the main file, put that in a function in the 2nd file and have the main file call a meaningfully named function so rather than seeing a useless ''7'' you'd see something like ''getFuel'' and although this might take longer to set-up you'll save time in the long run as you'll spend less time being confused when you come back to it in a weeks time to debug a problem.&lt;br /&gt;
* Your client side scripts can cause desync if you're not careful, try to keep the psychical world equal with every player. For example if your script creates a client side object make sure your script will create it for everyone nearby, else people will be wondering why a player appears to be constantly floating and falling.&lt;br /&gt;
* Instead of using ''onClientResourceStart'' or ''onResourceStart'' events attached to ''resourceRoot'' like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function warnPeopleThatThisResourceStarted()&lt;br /&gt;
    outputChatBox(&amp;quot;The resource &amp;quot; .. getResourceName(resource) .. &amp;quot; has just started!&amp;quot;, 0, 255, 0)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, warnPeopleThatThisResourceStarted)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can also use this outside of any function:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;outputChatBox(&amp;quot;The resource &amp;quot; .. getResourceName(resource) .. &amp;quot; has just started!&amp;quot;, 0, 255, 0)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
And the result will be the same, because Lua executes every instruction in every script file of a resource when it starts.&lt;br /&gt;
* string.dump produces unsigned compiled Lua code which is not allowed for security reasons. The only way to transport code now is by using the source code. e.g.:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;exampleFunction = [===[&lt;br /&gt;
    return param&lt;br /&gt;
]===]&lt;br /&gt;
&lt;br /&gt;
local loadedFunction = loadstring(exampleFunction)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MTA Scripting - Element IDs Being Reused ==&lt;br /&gt;
* If your script is covered in [[isTimer]] and [[isElement]] checks to hide debug warnings from deleted elements not being dereferenced (making the variable nil) you will regret it when that element ID or timer pointer has to be re-used by MTA in a weeks time and your script starts acting strangely and you won't have a clue why. Dereference destroyed elements and disconnected players!&lt;br /&gt;
* Why would MTA reuse it in a weeks time? Everything has a userdata value whether it's a function or an element, there is a limited amount of these available meaning that eventually the server will be forced to use the same userdata value twice, as long as whatever that userdata value was for is no longer valid. This could happen within hours, weeks or even never depending on how many elements are being created and destroyed by your scripts.&lt;br /&gt;
* For example if you have a race server that has 100 objects in every map and the map was changing every 5 minutes your server would go through at least 1200 an hour, 28,800 a day, 201,600 a week in userdata values, it can't keep going up and up though eventually it will have to reuse the same userdata values and as long as you're dereferencing in your scripts, it won't be a problem.&lt;br /&gt;
&lt;br /&gt;
The is an example of a script which fails to dereference, because when the player quits their userdata value remains in the table, but what if in a weeks time another player joins and they get assigned the same userdata value?&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
local admins = {}&lt;br /&gt;
local secretPasswordOnlyAdminsShouldKnow = &amp;quot;12345678&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function adminLogin()&lt;br /&gt;
    if (hasObjectPermissionTo(source, &amp;quot;command.ban&amp;quot;, false)) then&lt;br /&gt;
        admins[source] = true&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, adminLogin)&lt;br /&gt;
&lt;br /&gt;
function cmdGetSecretPassword(plr)&lt;br /&gt;
    if (not admins[plr]) then&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(&amp;quot;The secret password is &amp;quot;..secretPasswordOnlyAdminsShouldKnow, plr)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;getsecretpass&amp;quot;, cmdGetSecretPassword)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some random player who joins in a weeks time gets the same userdata value as an admin, that player can now use &amp;quot;getsecretpass&amp;quot;. Solution? De-reference on destruction!&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function onQuit()&lt;br /&gt;
    admins[source] = nil&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerQuit&amp;quot;, root, onQuit)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Server Performance ==&lt;br /&gt;
* Server lagging? Check [[Debugging#Debugging_Performance_Issues|this page of debugging performance issues]]&lt;br /&gt;
* Using resourceRoot in event handlers for events from clients is much more efficient than using root.&lt;br /&gt;
* Try to be efficient, but if what you're doing is too time consuming or complex, is it really efficient?&lt;br /&gt;
* It's much more efficient to set player health client side, consider a client event all your server scripts can call to set a players health.&lt;br /&gt;
* Unless you have hundreds of players, don't worry about making little optimizations, check ''performancebrowser'' or ''ipb'' (ingame performancebrowser) and make sure no resource is using significantly more than the others.&lt;br /&gt;
&lt;br /&gt;
== Client Performance ==&lt;br /&gt;
* The biggest cause of client script CPU usage is anything done in onClient/Pre/Hud/Render because it is called so often. For example if you have a script which calls dxDrawLine3D 20 times, 60 times a second, if those lines are only in 1 part of the map, consider adding a [[getDistanceBetweenPoints3D]] check between the local player and the general area that those lines are in and if they're no where near the player, don't draw the lines.&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TriggerLatentServerEvent&amp;diff=44829</id>
		<title>TriggerLatentServerEvent</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TriggerLatentServerEvent&amp;diff=44829"/>
		<updated>2015-04-04T14:16:13Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function is the same as [[triggerServerEvent]] except the transmission rate of the data contained in the arguments can be limited and other network traffic is not blocked while the data is being transferred.&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 triggerLatentServerEvent ( string event, [int bandwidth=5000, bool persist=false,] element theElement, [arguments...] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''event:''' The name of the event to trigger server-side. You should register this event with [[addEvent]] and add at least one event handler using [[addEventHandler]].&lt;br /&gt;
*'''theElement:''' The element that is the [[Event system#Event handlers|source]] of the event. This could be another player, or if this isn't relevant, use the root element.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''bandwidth:''' The bytes per second rate to send the data contained in the arguments.&lt;br /&gt;
*'''persist:''' A bool indicating whether the transmission should be allowed to continue even after the resource that triggered it has since stopped.&lt;br /&gt;
*'''arguments...:''' A list of arguments to trigger with the event. You can pass any lua data type (except functions). You can also pass [[element]]s. The total amount of data should not exceed 100MB. &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event trigger has been sent, ''false'' if invalid arguments were specified.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
   --TODO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3.0-9.03772|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Element/Shader&amp;diff=44758</id>
		<title>Element/Shader</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Element/Shader&amp;diff=44758"/>
		<updated>2015-02-26T13:50:40Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The shader class represents a Microsoft HLSL Effect File(.fx) loaded by the client, which can be used instead of a texture when calling [[dxDrawImage]]&lt;br /&gt;
&lt;br /&gt;
The element type of this class is '''&amp;quot;shader&amp;quot;'''.&lt;br /&gt;
&lt;br /&gt;
==How HLSL Effect Files file integrate into MTA:SA==&lt;br /&gt;
&lt;br /&gt;
Note: This page assumes you know what an Effect File and HLSL is. If not, you better do some research first.&lt;br /&gt;
&lt;br /&gt;
You can use this [[shadertest resource]] to try the examples below. Copy the effect source from the code boxes into '''shadertest/clientshader.fx''' and (re)start shadertest to see the output.&lt;br /&gt;
&lt;br /&gt;
After you've done all that, (or maybe before if glancing below is making you panic), visit [[Shader examples|some more shader resource examples]].&lt;br /&gt;
&lt;br /&gt;
===Techniques===&lt;br /&gt;
Effect Files usually contain several techniques, but for simplicity, MTA will only use the first technique that will run correctly on the clients hardware. So, for any given Effect File, put your high end techniques first, and the simplest ones last. That way, players with good hardware get the best technique applied, and players with older hardware get at least something.&lt;br /&gt;
&lt;br /&gt;
===Simplest===&lt;br /&gt;
Here is the contents of an Effect File with one technique which should work on all hardware:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
//-- Declare the textures. These are set using dxSetShaderValue( shader, &amp;quot;Tex0&amp;quot;, texture )&lt;br /&gt;
texture Tex0;&lt;br /&gt;
texture Tex1;&lt;br /&gt;
&lt;br /&gt;
//-- Very simple technique&lt;br /&gt;
technique simple&lt;br /&gt;
{&lt;br /&gt;
    pass P0&lt;br /&gt;
    {&lt;br /&gt;
        //-- Set up texture stage 0&lt;br /&gt;
        Texture[0] = Tex0;&lt;br /&gt;
        ColorOp[0] = SelectArg1;&lt;br /&gt;
        ColorArg1[0] = Texture;&lt;br /&gt;
        AlphaOp[0] = SelectArg1;&lt;br /&gt;
        AlphaArg1[0] = Texture;&lt;br /&gt;
            &lt;br /&gt;
        //-- Disable texture stage 1&lt;br /&gt;
        ColorOp[1] = Disable;&lt;br /&gt;
        AlphaOp[1] = Disable;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
It doesn't use vertex or pixel shaders, only standard D3D render states.&lt;br /&gt;
Confusing reference of all the states you can set is here: http://msdn.microsoft.com/en-us/library/bb173347%28v=VS.85%29.aspx&lt;br /&gt;
&lt;br /&gt;
===Not so simple===&lt;br /&gt;
Here is an Effect File containing a vertex and pixel shader:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
//-- Declare the textures. These are set using dxSetShaderValue( shader, &amp;quot;Tex0&amp;quot;, texture )&lt;br /&gt;
texture Tex0;&lt;br /&gt;
texture Tex1;&lt;br /&gt;
&lt;br /&gt;
//-- Declare a user variable. This can be set using dxSetShaderValue( shader, &amp;quot;PositionOfCheese&amp;quot;, 1, 2, 3 )&lt;br /&gt;
float3 PositionOfCheese;&lt;br /&gt;
&lt;br /&gt;
//-- These variables are set automatically by MTA&lt;br /&gt;
float4x4 World;&lt;br /&gt;
float4x4 View;&lt;br /&gt;
float4x4 Projection;&lt;br /&gt;
float4x4 WorldViewProjection;&lt;br /&gt;
float Time;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
//-- Sampler for the main texture (needed for pixel shaders)&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
sampler Sampler0 = sampler_state&lt;br /&gt;
{&lt;br /&gt;
    Texture = (Tex0);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
//-- Structure of data sent to the vertex shader&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
struct VSInput&lt;br /&gt;
{&lt;br /&gt;
    float3 Position : POSITION;&lt;br /&gt;
    float4 Diffuse  : COLOR0;&lt;br /&gt;
    float2 TexCoord : TEXCOORD0;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
//-- Structure of data sent to the pixel shader ( from the vertex shader )&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
struct PSInput&lt;br /&gt;
{&lt;br /&gt;
  float4 Position : POSITION0;&lt;br /&gt;
  float4 Diffuse  : COLOR0;&lt;br /&gt;
  float2 TexCoord : TEXCOORD0;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
//-- VertexShaderExample&lt;br /&gt;
//--  1. Read from VS structure&lt;br /&gt;
//--  2. Process&lt;br /&gt;
//--  3. Write to PS structure&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
PSInput VertexShaderExample(VSInput VS)&lt;br /&gt;
{&lt;br /&gt;
    PSInput PS = (PSInput)0;&lt;br /&gt;
&lt;br /&gt;
    //-- Transform vertex position (You nearly always have to do something like this)&lt;br /&gt;
    PS.Position = mul(float4(VS.Position, 1), WorldViewProjection);&lt;br /&gt;
&lt;br /&gt;
    //-- Copy the color and texture coords so the pixel shader can use them&lt;br /&gt;
    PS.Diffuse = VS.Diffuse;&lt;br /&gt;
    PS.TexCoord = VS.TexCoord;&lt;br /&gt;
&lt;br /&gt;
    return PS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
//-- PixelShaderExample&lt;br /&gt;
//--  1. Read from PS structure&lt;br /&gt;
//--  2. Process&lt;br /&gt;
//--  3. Return pixel color&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
float4 PixelShaderExample(PSInput PS) : COLOR0&lt;br /&gt;
{&lt;br /&gt;
    //-- Modify the texture coord to make the image look all wobbly&lt;br /&gt;
    PS.TexCoord.y += sin(PS.TexCoord.y * 100 + Time * 10) * 0.03;&lt;br /&gt;
&lt;br /&gt;
    //-- Grab the pixel from the texture&lt;br /&gt;
    float4 finalColor = tex2D(Sampler0, PS.TexCoord);&lt;br /&gt;
&lt;br /&gt;
    //-- Apply color tint&lt;br /&gt;
    finalColor = finalColor * PS.Diffuse;&lt;br /&gt;
&lt;br /&gt;
    return finalColor;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
//-- Techniques&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
//--&lt;br /&gt;
//-- MTA will try this technique first:&lt;br /&gt;
//--&lt;br /&gt;
technique complercated&lt;br /&gt;
{&lt;br /&gt;
    pass P0&lt;br /&gt;
    {&lt;br /&gt;
        VertexShader = compile vs_2_0 VertexShaderExample();&lt;br /&gt;
        PixelShader  = compile ps_2_0 PixelShaderExample();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//--&lt;br /&gt;
//-- And if the preceding technique will not validate on&lt;br /&gt;
//-- the players computer, MTA will try this one:&lt;br /&gt;
//--&lt;br /&gt;
technique simple&lt;br /&gt;
{&lt;br /&gt;
    pass P0&lt;br /&gt;
    {&lt;br /&gt;
        //-- Set up texture stage 0&lt;br /&gt;
        Texture[0] = Tex0;&lt;br /&gt;
        ColorOp[0] = SelectArg1;&lt;br /&gt;
        ColorArg1[0] = Texture;&lt;br /&gt;
        AlphaOp[0] = SelectArg1;&lt;br /&gt;
        AlphaArg1[0] = Texture;&lt;br /&gt;
            &lt;br /&gt;
        //-- Disable texture stage 1&lt;br /&gt;
        ColorOp[1] = Disable;&lt;br /&gt;
        AlphaOp[1] = Disable;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Technique 'complercated' will be used if the computer supports Shader Model 2, otherwise technique 'simple' will be used. Comments in the source explain what MTA does and where.&lt;br /&gt;
&lt;br /&gt;
===Misc===&lt;br /&gt;
Points to remember when switching between editing lua and .fx files:&lt;br /&gt;
*HLSL statements often end with a ; (semi-colon)&lt;br /&gt;
*HLSL indices start from 0 (where as Lua usually starts from 1)&lt;br /&gt;
*HLSL compile errors can be viewed by typing 'debugscript 3' into the client console&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Shaders for world textures==&lt;br /&gt;
Here are a couple of examples of shaders to use when replacing world textures with [[engineApplyShaderToWorldTexture]]&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
This shader just replaces the texture and allows GTA to control all the render states.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
//-- Declare the texture. These are set using dxSetShaderValue( shader, &amp;quot;Tex0&amp;quot;, texture )&lt;br /&gt;
texture Tex0;&lt;br /&gt;
&lt;br /&gt;
technique simple&lt;br /&gt;
{&lt;br /&gt;
    pass P0&lt;br /&gt;
    {&lt;br /&gt;
        //-- Set up texture stage 0&lt;br /&gt;
        Texture[0] = Tex0;&lt;br /&gt;
&lt;br /&gt;
        //-- Leave the rest of the states to the default settings&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===Not so simple===&lt;br /&gt;
This shader can be used as a base for replacing a world texture if you intend to add some fancy effect.&lt;br /&gt;
It uses [[http://nightly.mtasa.com/files/shaders/mta-helper.fx mta-helper.fx]] to handle consistent naming of the preset shader settings (gWorld, gTexture0 etc.)&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mta-helper.fx''''' also contains some helpful functions which calculate GTA lighting.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
//-- Settings&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
texture Tex0;   //-- Replacement texture&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
// Include some common stuff&lt;br /&gt;
//---------------------------------------------------------------------&lt;br /&gt;
#include &amp;quot;mta-helper.fx&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
//-- Sampler for the new texture&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
sampler Sampler0 = sampler_state&lt;br /&gt;
{&lt;br /&gt;
    Texture = (Tex0);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
//-- Structure of data sent to the vertex shader&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
struct VSInput&lt;br /&gt;
{&lt;br /&gt;
    float3 Position : POSITION0;&lt;br /&gt;
    float3 Normal : NORMAL0;&lt;br /&gt;
    float4 Diffuse : COLOR0;&lt;br /&gt;
    float2 TexCoord : TEXCOORD0;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
//-- Structure of data sent to the pixel shader ( from the vertex shader )&lt;br /&gt;
//-----------------------------------------------------------------------&lt;br /&gt;
struct PSInput&lt;br /&gt;
{&lt;br /&gt;
    float4 Position : POSITION0;&lt;br /&gt;
    float4 Diffuse : COLOR0;&lt;br /&gt;
    float2 TexCoord : TEXCOORD0;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//--------------------------------------------------------------------------------------------&lt;br /&gt;
//-- VertexShaderFunction&lt;br /&gt;
//--  1. Read from VS structure&lt;br /&gt;
//--  2. Process&lt;br /&gt;
//--  3. Write to PS structure&lt;br /&gt;
//--------------------------------------------------------------------------------------------&lt;br /&gt;
PSInput VertexShaderFunction(VSInput VS)&lt;br /&gt;
{&lt;br /&gt;
    PSInput PS = (PSInput)0;&lt;br /&gt;
&lt;br /&gt;
    //-- Calculate screen pos of vertex&lt;br /&gt;
    PS.Position = mul(float4(VS.Position, 1), gWorldViewProjection);&lt;br /&gt;
&lt;br /&gt;
    //-- Pass through tex coord&lt;br /&gt;
    PS.TexCoord = VS.TexCoord;&lt;br /&gt;
&lt;br /&gt;
    //-- Calculate GTA lighting for buildings&lt;br /&gt;
    PS.Diffuse = MTACalcGTABuildingDiffuse( VS.Diffuse );&lt;br /&gt;
    //--&lt;br /&gt;
    //-- NOTE: The above line is for GTA buildings.&lt;br /&gt;
    //-- If you are replacing a vehicle texture, do this instead:&lt;br /&gt;
    //--&lt;br /&gt;
    //--      // Calculate GTA lighting for vehicles&lt;br /&gt;
    //--      float3 WorldNormal = MTACalcWorldNormal( VS.Normal );&lt;br /&gt;
    //--      PS.Diffuse = MTACalcGTAVehicleDiffuse( WorldNormal, VS.Diffuse );&lt;br /&gt;
&lt;br /&gt;
    return PS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//--------------------------------------------------------------------------------------------&lt;br /&gt;
//-- PixelShaderFunction&lt;br /&gt;
//--  1. Read from PS structure&lt;br /&gt;
//--  2. Process&lt;br /&gt;
//--  3. Return pixel color&lt;br /&gt;
//--------------------------------------------------------------------------------------------&lt;br /&gt;
float4 PixelShaderFunction(PSInput PS) : COLOR0&lt;br /&gt;
{&lt;br /&gt;
    //-- Get texture pixel&lt;br /&gt;
    float4 texel = tex2D(Sampler0, PS.TexCoord);&lt;br /&gt;
&lt;br /&gt;
    //-- Apply diffuse lighting&lt;br /&gt;
    float4 finalColor = texel * PS.Diffuse;&lt;br /&gt;
&lt;br /&gt;
    return finalColor;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//--------------------------------------------------------------------------------------------&lt;br /&gt;
//-- Techniques&lt;br /&gt;
//--------------------------------------------------------------------------------------------&lt;br /&gt;
technique tec&lt;br /&gt;
{&lt;br /&gt;
    pass P0&lt;br /&gt;
    {&lt;br /&gt;
        VertexShader = compile vs_2_0 VertexShaderFunction();&lt;br /&gt;
        PixelShader = compile ps_2_0 PixelShaderFunction();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//-- Fallback&lt;br /&gt;
technique fallback&lt;br /&gt;
{&lt;br /&gt;
    pass P0&lt;br /&gt;
    {&lt;br /&gt;
        //-- Replace texture&lt;br /&gt;
        Texture[0] = Tex0;&lt;br /&gt;
&lt;br /&gt;
        //-- Leave the rest of the states to the default settings&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above code as it stands will calculate the correct lighting for GTA buildings. If you are replacing a vehicle, change:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
    //-- Calculate GTA lighting for buildings&lt;br /&gt;
    PS.Diffuse = MTACalcGTABuildingDiffuse( VS.Diffuse );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
to:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
    //-- Calculate GTA lighting for vehicles&lt;br /&gt;
    float3 WorldNormal = MTACalcWorldNormal( VS.Normal );&lt;br /&gt;
    PS.Diffuse = MTACalcGTAVehicleDiffuse( WorldNormal, VS.Diffuse );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
==Multiple pass shaders==&lt;br /&gt;
To do more than one pass, add '''pass''' blocks like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
//-- Declare the texture. These are set using dxSetShaderValue( shader, &amp;quot;Tex0&amp;quot;, texture )&lt;br /&gt;
texture Tex0;&lt;br /&gt;
&lt;br /&gt;
technique simple&lt;br /&gt;
{&lt;br /&gt;
    pass P0&lt;br /&gt;
    {&lt;br /&gt;
        // First pass&lt;br /&gt;
        Texture[0] = Tex0;&lt;br /&gt;
    }&lt;br /&gt;
    pass P1&lt;br /&gt;
    {&lt;br /&gt;
        // Second pass&lt;br /&gt;
        SrcBlend = Add;&lt;br /&gt;
        DestBlend = One;&lt;br /&gt;
    }&lt;br /&gt;
    pass P2&lt;br /&gt;
    {&lt;br /&gt;
        // Third pass&lt;br /&gt;
        SrcBlend = InvDestColor;&lt;br /&gt;
        DestBlend = InvSrcColor;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
==Related scripting functions==&lt;br /&gt;
===Client===&lt;br /&gt;
{{Drawing functions}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Element Types]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=43865</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=43865"/>
		<updated>2015-01-03T14:36:13Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[attachEffect]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[bindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts and formats large numbers.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertServerTickToTimeStamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[dxDrawAnimWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[dxDrawCircle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a number of 2D lines in order to achieve a circle shape on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws 2D text with hexadecimal support on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawEmptyRec]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws an empty 2D rectangle on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function generates a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateRandomASCIIString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a given birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getBanFromName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This functions returns the ban of the given playername.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBoundControls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getCurrentFPS]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementsInDimension]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getElementsWithinMarker]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getKeyFromValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string of all logged-in administrators separated by two whitespace characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxHealth]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from their serial.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerAcls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getPlayersByData]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getPlayerCity]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This functions returns a string containing the player's city name&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceScripts]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource scripts.&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-family:'Georgia',sans-serif; 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;
*[[getTeamFromColor]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getValidVehicleModels]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getVehicleRespawnPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get the respawn position of a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all children of a XML node.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[guiGridListGetSelectedText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isMouseInPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPedDrivingVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPlayerInACL]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[isSoundFinished]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element has finished.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleEmpty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[mathNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[math.percent]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[renameAclGroup]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[secondsToTimeDesc]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setAccountName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is used to change an existing account's name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.compare]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a table is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[unbindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsMouseInPosition&amp;diff=43864</id>
		<title>IsMouseInPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsMouseInPosition&amp;diff=43864"/>
		<updated>2015-01-03T14:34:41Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Created page with &amp;quot;{{Useful Function}} {{Needs Example}} &amp;lt;lowercasetitle/&amp;gt; __NOTOC__ This function allows you to check whether the mouse cursor/pointer is within a rectangular position ==Syntax=...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to check whether the mouse cursor/pointer is within a rectangular position&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isMouseInPosition ( int x, int y, int width, int height )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''x''': Left-most X position for detection (absolute)&lt;br /&gt;
* '''y''': Top-most Y position for detection (absolute)&lt;br /&gt;
* '''width''': Width for detection (absolute)&lt;br /&gt;
* '''heigh''': Height for detection (absolute)&lt;br /&gt;
&lt;br /&gt;
===Return===&lt;br /&gt;
Returns true/false depending on whether the mouse was within the specified position or not&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
    if ( not isCursorShowing ( ) ) then&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    local sx, sy = guiGetScreenSize ( )&lt;br /&gt;
    local cx, cy = getCursorPosition ( )&lt;br /&gt;
    local cx, cy = ( cx * sx ), ( cy * sy )&lt;br /&gt;
    if ( cx &amp;gt;= x and cx &amp;lt;= x + width ) and ( cy &amp;gt;= y and cy &amp;lt;= y + height ) then&lt;br /&gt;
        return true&lt;br /&gt;
    else&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example==&lt;br /&gt;
Missing&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetTimer&amp;diff=41622</id>
		<title>SetTimer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetTimer&amp;diff=41622"/>
		<updated>2014-08-23T23:00:02Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function allows you to trigger a function after a number of milliseconds have elapsed. You can call one of your own functions or a built-in function. For example, you could set a timer to spawn a player after a number of seconds have elapsed.&lt;br /&gt;
&lt;br /&gt;
Once a timer has finished repeating, it no longer exists.&lt;br /&gt;
&lt;br /&gt;
'''The minimum accepted interval is 50ms.'''&lt;br /&gt;
&lt;br /&gt;
Multi Theft Auto guarantees that the timer will be triggered after ''at least'' the interval you specify. The resolution of the timer is tied to the frame rate (server side and client-side). All the overdue timers are triggered at a single point each frame. This means that if, for example, the player is running at 30 frames per second, then two timers specified to occur after 100ms and 110ms would more than likely occur during the same frame, as the difference in time between the two timers (10ms) is less than half the length of the frame (33ms). As with most timers provided by other languages, you shouldn't rely on the timer triggering at an exact point in the future. &lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
timer setTimer ( function theFunction, int timeInterval, int timesToExecute, [ var arguments... ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||Timer.create||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theFunction:''' The function you wish the timer to call. (Notice: Do not use a 'local' function, it must be global!)&lt;br /&gt;
{{New feature/item|3.0141|1.4.1|6773|&lt;br /&gt;
Added ''sourceTimer'' global variable to timer's callback function&lt;br /&gt;
}}&lt;br /&gt;
*'''timeInterval:''' The number of milliseconds that should elapse before the function is called. (the minimum is 50)(1000 milliseconds = 1 second)&lt;br /&gt;
*'''timesToExecute:''' The number of times you want the timer to execute, or 0 for infinite repetitions.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''arguments:''' Any arguments you wish to pass to the function can be listed after the ''timesToExecute'' argument. Note that any tables you want to pass will get cloned, whereas metatables will get lost. Also changes you make in the original table before the function gets called won't get transferred.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[timer]] pointer if the timer was set successfully, ''false'' if the arguments are invalid or the timer could not be set.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example will output some text after a small delay.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- define function to be called&lt;br /&gt;
function delayedChat ( text )&lt;br /&gt;
	outputChatBox ( &amp;quot;Delayed text: &amp;quot; .. text )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- set a timer so the function is called after 1 second&lt;br /&gt;
setTimer ( delayedChat, 1000, 1, &amp;quot;Hello, World!&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 second after the line above has been executed, the text ''Delayed text: Hello, World!'' will be displayed in the chat box.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example will nest a whole function within a timer. This is nice for things like setting variables without having to call a function outside of your code block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function mainFunction()&lt;br /&gt;
        outputChatBox (&amp;quot;Instant text!&amp;quot;)&lt;br /&gt;
	setTimer ( function()&lt;br /&gt;
		outputChatBox ( &amp;quot;5 second delay text!&amp;quot; )&lt;br /&gt;
	end, 5000, 1 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
mainFunction() --call function&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsElementWaitingForGroundToLoad&amp;diff=41224</id>
		<title>IsElementWaitingForGroundToLoad</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsElementWaitingForGroundToLoad&amp;diff=41224"/>
		<updated>2014-08-07T18:45:26Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needs_Checking|Example is wrong? --[[User:MrTasty|MrTasty]] ([[User talk:MrTasty|talk]]) 18:45, 7 August 2014 (UTC)}}&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0140|1.4.0|6715|This function checks if an [[element]] is frozen (unable to move without scripting) waiting until a [[client]] loads collisions of the area it is in. This allows MTA to automatically freeze vehicles when nobody is near them so they don't fall through the map, for example.}}&lt;br /&gt;
{{Note|When vehicles are frozen waiting for collisions to load they '''do not''' overwrite the frozen status set by [[setElementFrozen]].}}&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 isElementWaitingForGroundToLoad ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''theElement:''' the element to check its frozen waiting for collisions to load status. It can be a [[vehicle]], [[ped]] or [[player]].&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the specified [[element]] is frozen waiting for collisions of the area to load. Returns ''false'' if it's not or if the specified variable is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Serverside example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
The next code snippet outputs a message when a vehicle respawns far away from players.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function notifyFarRespawn()&lt;br /&gt;
    outputChatBox(&amp;quot;* A &amp;quot; .. getVehicleName(source) .. &amp;quot; respawned far away! Find it quick!&amp;quot;, root, 128, 255, 0)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleRespawn&amp;quot;, root, notifyFarRespawn)&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Matrix&amp;diff=41189</id>
		<title>Matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Matrix&amp;diff=41189"/>
		<updated>2014-08-06T14:22:43Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
[[Category:Incomplete]]&lt;br /&gt;
The Matrix class is a class introduced in 1.4&lt;br /&gt;
&lt;br /&gt;
===Metamethods===&lt;br /&gt;
&lt;br /&gt;
*[[Matrix.__tostring|__tostring]]&lt;br /&gt;
*[[Matrix.__gc|__gc]]&lt;br /&gt;
*[[Matrix.__add|__add]]&lt;br /&gt;
*[[Matrix.__sub|__sub]]&lt;br /&gt;
*[[Matrix.__mul|__mul]]&lt;br /&gt;
*[[Matrix.__div|__div]]&lt;br /&gt;
&lt;br /&gt;
===Methods===&lt;br /&gt;
&lt;br /&gt;
*[[Matrix.create|create]]&lt;br /&gt;
*[[Matrix.getPosition|getPosition]]&lt;br /&gt;
*[[Matrix.getRotation|getRotation]]&lt;br /&gt;
*[[Matrix.getFront|getFront]]&lt;br /&gt;
*[[Matrix.getRight|getRight]]&lt;br /&gt;
*[[Matrix.getUp|getUp]]&lt;br /&gt;
*[[Matrix.getUp|getUp]]&lt;br /&gt;
*[[Matrix.setPosition|setPosition]]&lt;br /&gt;
*[[Matrix.setFront|setFront]]&lt;br /&gt;
*[[Matrix.setRight|setRight]]&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
*[[Matrix.position|position]]&lt;br /&gt;
*[[Matrix.rotation|rotation]]&lt;br /&gt;
*[[Matrix.front|front]]&lt;br /&gt;
*[[Matrix.right|right]]&lt;br /&gt;
*[[Matrix.up|up]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Vector&amp;diff=41188</id>
		<title>Vector</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Vector&amp;diff=41188"/>
		<updated>2014-08-06T14:22:25Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Redirected page to Vector3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Vector3]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Vector3&amp;diff=41187</id>
		<title>Vector3</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Vector3&amp;diff=41187"/>
		<updated>2014-08-06T14:22:23Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: I might have forgot some - please add the others if that's the case.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
[[Category:Incomplete]]&lt;br /&gt;
The Vector3 class is a class introduced in 1.4&lt;br /&gt;
&lt;br /&gt;
===Methods===&lt;br /&gt;
&lt;br /&gt;
*[[Vector3.create|create]]&lt;br /&gt;
*[[Vector3.getX|getX]]&lt;br /&gt;
*[[Vector3.getY|getY]]&lt;br /&gt;
*[[Vector3.getZ|getZ]]&lt;br /&gt;
*[[Vector3.getNormalized|getNormalized]]&lt;br /&gt;
*[[Vector3.getSquaredLength|getSquaredLength]]&lt;br /&gt;
*[[Vector3.getLength|getLength]]&lt;br /&gt;
*[[Vector3.normalize|normalize]]&lt;br /&gt;
*[[Vector3.dot|dot]]&lt;br /&gt;
*[[Vector3.cross|cross]]&lt;br /&gt;
*[[Vector3.setX|setX]]&lt;br /&gt;
*[[Vector3.setY|setY]]&lt;br /&gt;
*[[Vector3.setZ|setZ]]&lt;br /&gt;
&lt;br /&gt;
===Variables===&lt;br /&gt;
&lt;br /&gt;
*[[Vector3.x|x]]&lt;br /&gt;
*[[Vector3.y|y]]&lt;br /&gt;
*[[Vector3.z|z]]&lt;br /&gt;
*[[Vector3.normalized|normalized]]&lt;br /&gt;
*[[Vector3.length|length]]&lt;br /&gt;
*[[Vector3.squaredLength|squaredLength]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TeaDecode&amp;diff=41167</id>
		<title>TeaDecode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TeaDecode&amp;diff=41167"/>
		<updated>2014-08-04T15:18:41Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server_client function}}&lt;br /&gt;
{{New feature/item|9.06056|1.3.5|6056|&lt;br /&gt;
This function decrypts given [https://en.wikipedia.org/wiki/Base64 base64] representation of encrypted data using the [https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string teaDecode ( string data, string key )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''data:''' The block of data you want to decrypt&lt;br /&gt;
*'''key:''' The key that should be used for decryption (Only first 16 characters are used)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns string containing the decrypted data if the decryption process was successfully completed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a /teadecrypt command, which reverts the TEA on a given string with the specified key, if any.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
[lua]&lt;br /&gt;
function decrypt(cmd, theString, key)&lt;br /&gt;
    if theString then&lt;br /&gt;
        if not key then&lt;br /&gt;
            key = string.rep(string.char(math.random(string.byte(&amp;quot;a&amp;quot;), string.byte(&amp;quot;Z&amp;quot;))), 10) -- Generate a random key of 10 characters&lt;br /&gt;
        end&lt;br /&gt;
        local decodedString = teaDecode(theString, key) -- Encode the string with the key&lt;br /&gt;
        outputChatBox(&amp;quot;The encoded string is: &amp;quot; .. encodedString .. &amp;quot; (used key: &amp;quot; .. key .. &amp;quot;)&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Syntax: /&amp;quot; .. cmd .. &amp;quot; (string) [key].&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;teadecrypt&amp;quot;, decrypt)&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TeaDecode&amp;diff=41166</id>
		<title>TeaDecode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TeaDecode&amp;diff=41166"/>
		<updated>2014-08-04T15:18:09Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server_client function}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
{{New feature/item|9.06056|1.3.5|6056|&lt;br /&gt;
This function decrypts given [https://en.wikipedia.org/wiki/Base64 base64] representation of encrypted data using the [https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string teaDecode ( string data, string key )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''data:''' The block of data you want to decrypt&lt;br /&gt;
*'''key:''' The key that should be used for decryption (Only first 16 characters are used)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns string containing the decrypted data if the decryption process was successfully completed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a /teadecrypt command, which reverts the TEA on a given string with the specified key, if any.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
[lua]&lt;br /&gt;
function decrypt(cmd, theString, key)&lt;br /&gt;
    if theString then&lt;br /&gt;
        if not key then&lt;br /&gt;
            key = string.rep(string.char(math.random(string.byte(&amp;quot;a&amp;quot;), string.byte(&amp;quot;Z&amp;quot;))), 10) -- Generate a random key of 10 characters&lt;br /&gt;
        end&lt;br /&gt;
        local decodedString = teaDecode(theString, key) -- Encode the string with the key&lt;br /&gt;
        outputChatBox(&amp;quot;The encoded string is: &amp;quot; .. encodedString .. &amp;quot; (used key: &amp;quot; .. key .. &amp;quot;)&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Syntax: /&amp;quot; .. cmd .. &amp;quot; (string) [key].&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;teadecrypt&amp;quot;, decrypt)&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TeaEncode&amp;diff=41165</id>
		<title>TeaEncode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TeaEncode&amp;diff=41165"/>
		<updated>2014-08-04T15:18:05Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server_client function}}&lt;br /&gt;
&lt;br /&gt;
{{New feature/item|9.06056|1.3.5|6056|&lt;br /&gt;
This functions performs the [https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm] on the given string and returns the [https://en.wikipedia.org/wiki/Base64 base64] representation of the encrypted block of data.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string teaEncode ( string data, string key )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''data:''' The block of data you want to encrypt&lt;br /&gt;
*'''key:''' The key that should be used for encryption (Only first 16 characters are used)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the [https://en.wikipedia.org/wiki/Base64 base64] representation of the encrypted data if the encryption process was successfully completed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a /teaencrypt command, which performs the TEA on a given string with the specified key, if any.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
[lua]&lt;br /&gt;
function encrypt(cmd, theString, key)&lt;br /&gt;
    if theString then&lt;br /&gt;
        if not key then&lt;br /&gt;
            key = string.rep(string.char(math.random(string.byte(&amp;quot;a&amp;quot;), string.byte(&amp;quot;Z&amp;quot;))), 10) -- Generate a random key of 10 characters&lt;br /&gt;
        end&lt;br /&gt;
        local encodedString = teaEncode(theString, key) -- Encode the string with the key&lt;br /&gt;
        outputChatBox(&amp;quot;The encoded string is: &amp;quot; .. encodedString .. &amp;quot; (used key: &amp;quot; .. key .. &amp;quot;)&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Syntax: /&amp;quot; .. cmd .. &amp;quot; (string) [key].&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;teaencrypt&amp;quot;, encrypt)&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TeaEncode&amp;diff=41164</id>
		<title>TeaEncode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TeaEncode&amp;diff=41164"/>
		<updated>2014-08-04T15:16:59Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server_client function}}&lt;br /&gt;
&lt;br /&gt;
{{New feature/item|9.06056|1.3.5|6056|&lt;br /&gt;
This functions performs the [https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm] on the given string and returns the [https://en.wikipedia.org/wiki/Base64 base64] representation of the encrypted block of data.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string teaEncode ( string data, string key )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''data:''' The block of data you want to encrypt&lt;br /&gt;
*'''key:''' The key that should be used for encryption (Only first 16 characters are used)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the [https://en.wikipedia.org/wiki/Base64 base64] representation of the encrypted data if the encryption process was successfully completed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a /teaencrypt command, which performs the TEA on a given string with the specified key, if any.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
[lua]&lt;br /&gt;
function encrypt(cmd, theString, key)&lt;br /&gt;
    if theString then&lt;br /&gt;
        if not key then&lt;br /&gt;
            key = string.rep(string.char(math.random(string.byte(&amp;quot;a&amp;quot;), string.byte(&amp;quot;Z&amp;quot;))), 10) -- Generate a random key of 10 characters&lt;br /&gt;
        end&lt;br /&gt;
        local encodedString = teaEncode(theString, key) -- Encode the string with the key&lt;br /&gt;
        outputChatBox(&amp;quot;The encoded string is: &amp;quot; .. encodedString .. &amp;quot; (used key: &amp;quot; .. key .. &amp;quot;)&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Syntax: /&amp;quot; .. cmd .. &amp;quot; (string) [key].&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;teaencrypt&amp;quot;, encrypt)&lt;br /&gt;
[/lua]&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=TeaDecode&amp;diff=41163</id>
		<title>TeaDecode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=TeaDecode&amp;diff=41163"/>
		<updated>2014-08-04T15:16:58Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server_client function}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
{{New feature/item|9.06056|1.3.5|6056|&lt;br /&gt;
This function decrypts given [https://en.wikipedia.org/wiki/Base64 base64] representation of encrypted data using the [https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string teaDecode ( string data, string key )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''data:''' The block of data you want to decrypt&lt;br /&gt;
*'''key:''' The key that should be used for decryption (Only first 16 characters are used)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns string containing the decrypted data if the decryption process was successfully completed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a /teadecrypt command, which reverts the TEA on a given string with the specified key, if any.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
[lua]&lt;br /&gt;
function decrypt(cmd, theString, key)&lt;br /&gt;
    if theString then&lt;br /&gt;
        if not key then&lt;br /&gt;
            key = string.rep(string.char(math.random(string.byte(&amp;quot;a&amp;quot;), string.byte(&amp;quot;Z&amp;quot;))), 10) -- Generate a random key of 10 characters&lt;br /&gt;
        end&lt;br /&gt;
        local decodedString = teaDecode(theString, key) -- Encode the string with the key&lt;br /&gt;
        outputChatBox(&amp;quot;The encoded string is: &amp;quot; .. encodedString .. &amp;quot; (used key: &amp;quot; .. key .. &amp;quot;)&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Syntax: /&amp;quot; .. cmd .. &amp;quot; (string) [key].&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;teadecrypt&amp;quot;, decrypt)&lt;br /&gt;
[/lua]&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetBoundControls&amp;diff=41162</id>
		<title>GetBoundControls</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetBoundControls&amp;diff=41162"/>
		<updated>2014-08-04T15:00:05Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Returns a list of control names that are bound to the specified key.&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 getBoundControls ( string key )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The name of the key. See [[Key names]].&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If one or more controls are bound to the specified key, a table is returned containing the names of all the bound controls. If no controls are bound or an invalid name was passed, returns empty ''table''.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local controlTable = { &amp;quot;fire&amp;quot;, &amp;quot;next_weapon&amp;quot;, &amp;quot;previous_weapon&amp;quot;, &amp;quot;forwards&amp;quot;, &amp;quot;backwards&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;zoom_in&amp;quot;, &amp;quot;zoom_out&amp;quot;,&lt;br /&gt;
 &amp;quot;change_camera&amp;quot;, &amp;quot;jump&amp;quot;, &amp;quot;sprint&amp;quot;, &amp;quot;look_behind&amp;quot;, &amp;quot;crouch&amp;quot;, &amp;quot;action&amp;quot;, &amp;quot;walk&amp;quot;, &amp;quot;aim_weapon&amp;quot;, &amp;quot;conversation_yes&amp;quot;, &amp;quot;conversation_no&amp;quot;,&lt;br /&gt;
 &amp;quot;group_control_forwards&amp;quot;, &amp;quot;group_control_back&amp;quot;, &amp;quot;enter_exit&amp;quot;, &amp;quot;vehicle_fire&amp;quot;, &amp;quot;vehicle_secondary_fire&amp;quot;, &amp;quot;vehicle_left&amp;quot;, &amp;quot;vehicle_right&amp;quot;,&lt;br /&gt;
 &amp;quot;steer_forward&amp;quot;, &amp;quot;steer_back&amp;quot;, &amp;quot;accelerate&amp;quot;, &amp;quot;brake_reverse&amp;quot;, &amp;quot;radio_next&amp;quot;, &amp;quot;radio_previous&amp;quot;, &amp;quot;radio_user_track_skip&amp;quot;, &amp;quot;horn&amp;quot;, &amp;quot;sub_mission&amp;quot;,&lt;br /&gt;
 &amp;quot;handbrake&amp;quot;, &amp;quot;vehicle_look_left&amp;quot;, &amp;quot;vehicle_look_right&amp;quot;, &amp;quot;vehicle_look_behind&amp;quot;, &amp;quot;vehicle_mouse_look&amp;quot;, &amp;quot;special_control_left&amp;quot;, &amp;quot;special_control_right&amp;quot;,&lt;br /&gt;
 &amp;quot;special_control_down&amp;quot;, &amp;quot;special_control_up&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
function getBoundControls (key)&lt;br /&gt;
    local controls = {}&lt;br /&gt;
    for _,control in ipairs(controlTable) do&lt;br /&gt;
        for k in pairs(getBoundKeys(control)) do&lt;br /&gt;
            if (k == key) then&lt;br /&gt;
                controls[control] = true&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return controls&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Author: Lex128&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
This code adds a special action when activated detonator and blocks its actual use in the game.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function detonatorAction (key, state)&lt;br /&gt;
    if (getPedWeapon (localPlayer) ~= 40) then return end          -- make sure that the detonator is in the hands of&lt;br /&gt;
&lt;br /&gt;
    outputChatBox (&amp;quot;Whohooo... BOOM!&amp;quot;, 255, 0, 0)                  -- make necessary actions&lt;br /&gt;
    for control in pairs (getBoundControls(key)) do&lt;br /&gt;
        setControlState (control, false)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bindKey (&amp;quot;mouse1&amp;quot;, &amp;quot;down&amp;quot;, detonatorAction)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example 2==&lt;br /&gt;
This code checks if someone has 'sprint' bound onto the mouse wheel (a well-known glitch which is now disabled by default) and kicks a player for having it bound&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onStart()&lt;br /&gt;
    if ( (getBoundControls(&amp;quot;mouse_wheel_up&amp;quot;)[&amp;quot;sprint&amp;quot;]) or (getBoundControls(&amp;quot;mouse_wheel_down&amp;quot;)[&amp;quot;sprint&amp;quot;]) ) then&lt;br /&gt;
        triggerServerEvent(&amp;quot;kickPlayerForCheating&amp;quot;, root, &amp;quot;supersprint binds&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, onStart)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Serverside&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;
addEvent(&amp;quot;kickPlayerForCheating&amp;quot;, true)&lt;br /&gt;
addEventHandler(&amp;quot;kickPlayerForCheating&amp;quot;, root, function(cheat)&lt;br /&gt;
    kickPlayer(client, &amp;quot;Anti Cheat&amp;quot;, &amp;quot;Cheat detected: &amp;quot;..cheat)&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetBoundControls&amp;diff=41161</id>
		<title>GetBoundControls</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetBoundControls&amp;diff=41161"/>
		<updated>2014-08-04T14:59:17Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Returns a list of control names that are bound to the specified key.&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 getBoundControls ( string key )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''key:''' The name of the key. See [[Key names]].&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If one or more controls are bound to the specified key, a table is returned containing the names of all the bound controls. If no controls are bound or an invalid name was passed, returns empty ''table''.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local controlTable = { &amp;quot;fire&amp;quot;, &amp;quot;next_weapon&amp;quot;, &amp;quot;previous_weapon&amp;quot;, &amp;quot;forwards&amp;quot;, &amp;quot;backwards&amp;quot;, &amp;quot;left&amp;quot;, &amp;quot;right&amp;quot;, &amp;quot;zoom_in&amp;quot;, &amp;quot;zoom_out&amp;quot;,&lt;br /&gt;
 &amp;quot;change_camera&amp;quot;, &amp;quot;jump&amp;quot;, &amp;quot;sprint&amp;quot;, &amp;quot;look_behind&amp;quot;, &amp;quot;crouch&amp;quot;, &amp;quot;action&amp;quot;, &amp;quot;walk&amp;quot;, &amp;quot;aim_weapon&amp;quot;, &amp;quot;conversation_yes&amp;quot;, &amp;quot;conversation_no&amp;quot;,&lt;br /&gt;
 &amp;quot;group_control_forwards&amp;quot;, &amp;quot;group_control_back&amp;quot;, &amp;quot;enter_exit&amp;quot;, &amp;quot;vehicle_fire&amp;quot;, &amp;quot;vehicle_secondary_fire&amp;quot;, &amp;quot;vehicle_left&amp;quot;, &amp;quot;vehicle_right&amp;quot;,&lt;br /&gt;
 &amp;quot;steer_forward&amp;quot;, &amp;quot;steer_back&amp;quot;, &amp;quot;accelerate&amp;quot;, &amp;quot;brake_reverse&amp;quot;, &amp;quot;radio_next&amp;quot;, &amp;quot;radio_previous&amp;quot;, &amp;quot;radio_user_track_skip&amp;quot;, &amp;quot;horn&amp;quot;, &amp;quot;sub_mission&amp;quot;,&lt;br /&gt;
 &amp;quot;handbrake&amp;quot;, &amp;quot;vehicle_look_left&amp;quot;, &amp;quot;vehicle_look_right&amp;quot;, &amp;quot;vehicle_look_behind&amp;quot;, &amp;quot;vehicle_mouse_look&amp;quot;, &amp;quot;special_control_left&amp;quot;, &amp;quot;special_control_right&amp;quot;,&lt;br /&gt;
 &amp;quot;special_control_down&amp;quot;, &amp;quot;special_control_up&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
function getBoundControls (key)&lt;br /&gt;
    local controls = {}&lt;br /&gt;
    for _,control in ipairs(controlTable) do&lt;br /&gt;
        for k in pairs(getBoundKeys(control)) do&lt;br /&gt;
            if (k == key) then&lt;br /&gt;
                controls[control] = true&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return controls&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Author: Lex128&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example 1==&lt;br /&gt;
This code adds a special action when activated detonator and blocks its actual use in the game.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function detonatorAction (key, state)&lt;br /&gt;
    if (getPedWeapon (localPlayer) ~= 40) then return end          -- make sure that the detonator is in the hands of&lt;br /&gt;
&lt;br /&gt;
    outputChatBox (&amp;quot;Whohooo... BOOM!&amp;quot;, 255, 0, 0)                  -- make necessary actions&lt;br /&gt;
    for control in pairs (getBoundControls(key)) do&lt;br /&gt;
        setControlState (control, false)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bindKey (&amp;quot;mouse1&amp;quot;, &amp;quot;down&amp;quot;, detonatorAction)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Example 2==&lt;br /&gt;
This code checks if someone has 'sprint' bound onto the mouse wheel (a well-known glitch which is now disabled by default) and kicks a player for having it bound&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onStart()&lt;br /&gt;
    if getBoundControls(&amp;quot;mouse_wheel_up&amp;quot;) or getBoundControls(&amp;quot;mouse_wheel_down&amp;quot;) then&lt;br /&gt;
        triggerServerEvent(&amp;quot;kickPlayerForCheating&amp;quot;, root, &amp;quot;supersprint binds&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, onStart)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Serverside&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;
addEvent(&amp;quot;kickPlayerForCheating&amp;quot;, true)&lt;br /&gt;
addEventHandler(&amp;quot;kickPlayerForCheating&amp;quot;, root, function(cheat)&lt;br /&gt;
    kickPlayer(client, &amp;quot;Anti Cheat&amp;quot;, &amp;quot;Cheat detected: &amp;quot;..cheat)&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>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsKeyBound&amp;diff=41160</id>
		<title>IsKeyBound</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsKeyBound&amp;diff=41160"/>
		<updated>2014-08-04T14:48:08Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function can be used to find out if a key has already been bound.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isKeyBound ( player thePlayer, string key, [ string keyState, function handler ] ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player you're checking.&lt;br /&gt;
*'''key:''' The key you're checking. See [[Key names]] for a list of valid key names.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''keyState:''' Is the state of the key when it calls the function, Can be either:&lt;br /&gt;
**'''&amp;quot;up&amp;quot;:''' when the key is released&lt;br /&gt;
**'''&amp;quot;down&amp;quot;:''' when the key is pressed&lt;br /&gt;
*'''handler:''' The function you're checking against&lt;br /&gt;
Note: If you do not specify a ''keyState'' or ''handler'', any instances of ''key'' being bound will cause ''isKeyBound'' to return ''true''.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This function tells everyone in the server if someone has numpad 9 bound!&lt;br /&gt;
function onPlayerJoin ()&lt;br /&gt;
  if (isKeyBound (source,&amp;quot;num_9&amp;quot;)) then -- if num pad 9 is bound&lt;br /&gt;
    outputChatBox (getPlayerName (source) .. &amp;quot; has bound numpad 9!&amp;quot;,getRootElement(),255,0,0,false) -- let see everybody that he has binded it&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler (&amp;quot;onPlayerJoin&amp;quot;,getRootElement(),onPlayerJoin) -- add event.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetChatboxLayout&amp;diff=40994</id>
		<title>GetChatboxLayout</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetChatboxLayout&amp;diff=40994"/>
		<updated>2014-07-22T21:54:15Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Fixed a typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
Returns information about how the chatbox looks.&lt;br /&gt;
&lt;br /&gt;
These values come from the file called: [[Chatboxpresents.xml]] but it depends on what type of preset you currently have, which is chosen from your settings in the 'Interface' tab.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool/int/table getChatboxLayout ( [ string CVar ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''CVar:''' the name of the property you want returned. Can be the following values:&lt;br /&gt;
**'''chat_font''' - Returns the chatbox font&lt;br /&gt;
**'''chat_lines''' - Returns how many lines the chatbox has&lt;br /&gt;
**'''chat_color''' - Returns the background color of the chatbox&lt;br /&gt;
**'''chat_text_color''' - Returns the chatbox text color&lt;br /&gt;
**'''chat_input_color''' - Returns the background color of the chatbox input&lt;br /&gt;
**'''chat_input_prefix_color''' - Returns the color of the input prefix text&lt;br /&gt;
**'''chat_input_text_color''' - Returns the color of the text in the chatbox input&lt;br /&gt;
**'''chat_scale''' - Returns the scale of the text in the chatbox&lt;br /&gt;
**'''chat_width''' - Returns the scale of the background width&lt;br /&gt;
**'''chat_css_style_text''' - Returns whether text fades out over time&lt;br /&gt;
**'''chat_css_style_background''' - Returns whether the background fades out over time&lt;br /&gt;
**'''chat_line_life''' - Returns how long it takes for text to start fading out&lt;br /&gt;
**'''chat_line_fade_out''' - Returns how long takes for text to fade out&lt;br /&gt;
**'''chat_use_cegui''' - Returns whether CEGUI is used to render the chatbox&lt;br /&gt;
**'''text_scale''' - Returns text scale&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*4 numbers if the CVar contains &amp;quot;color&amp;quot;&lt;br /&gt;
*2 numbers if '''chat_scale''' was entered&lt;br /&gt;
*1 number if any other CVar was specified&lt;br /&gt;
*a table of all CVar values, if CVar was not specified&lt;br /&gt;
*''false'' if an invalid CVar was specified&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This code makes the chatbox empty when you type /clear &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;clear&amp;quot;,&lt;br /&gt;
    function ()&lt;br /&gt;
        local lines = getChatboxLayout()[&amp;quot;chat_lines&amp;quot;]&lt;br /&gt;
        for i=1,lines do&lt;br /&gt;
            outputChatBox(&amp;quot;&amp;quot;)&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;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Vehicle_IDs&amp;diff=40978</id>
		<title>Vehicle IDs</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Vehicle_IDs&amp;diff=40978"/>
		<updated>2014-07-21T16:05:18Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Trains and Railroad Cars */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This is a list of GTA:SA's vehicle ID numbers, as listed in the vehicles.ide file. These vehicle ID numbers are used for several vehicle scripting functions.&lt;br /&gt;
&lt;br /&gt;
Lua table of all the valid vehicle IDs listed on this page:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585,&lt;br /&gt;
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460,&lt;br /&gt;
417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, &lt;br /&gt;
438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, &lt;br /&gt;
423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, &lt;br /&gt;
567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, &lt;br /&gt;
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, &lt;br /&gt;
606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lua table of vehicles that are not lockable:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;notLockableVehicles = {594, 606, 607, 611, 584, 608, 435, 450, 591, 539, 441, 464, 501, 465, 564, 472, 473, 493, 595, 484, 430, &lt;br /&gt;
453, 452, 446, 454, 581, 509, 481, 462, 521, 463, 510, 522, 461, 448, 468, 586, 425, 520}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lua table of vehicles without number plates:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;noNumberPlates = { 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 509, 481, &lt;br /&gt;
510, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 }&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==2-Door and Compact cars==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Alpha&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;602&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Hustler&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;545&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Blista Compact&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;496&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Majestic&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;517&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Bravura&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;401&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Manana&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;410&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Buccaneer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;518&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Picador&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;600&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Cadrona&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;527&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Previon&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;436&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Club&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;589&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Stafford&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;580&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Esperanto&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;419&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Stallion&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;439&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Feltzer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;533&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Tampa&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;549&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Fortune&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;526&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Virgo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;491&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Hermes&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;474&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 4-Door and Luxury cars==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Admiral&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;445&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Oceanic&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;467&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Damaged Glendale&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;604&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Premier&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;426&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Elegant&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;507&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Primo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;547&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Emperor&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;585&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Sentinel&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;405&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Euros&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;587&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Stretch&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;409&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Glendale&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;466&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Sunrise&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;550&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Greenwood&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;492&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Tahoma&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;566&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Intruder&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;546&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Vincent&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;540&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Merit&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;551&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Washington&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;421&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Nebula&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;516&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Willard&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;529&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Aircraft==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;&lt;br /&gt;
  Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Andromada&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;592&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    Nevada&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;553&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;AT-400&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;577&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    News Chopper&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;488&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Beagle&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;511&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    Police Maverick&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;497&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Cargobob&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;548&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    Raindance&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;563&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Cropduster&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;512&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    Rustler&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;476&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Dodo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;593&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    Seasparrow&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;447&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Hunter&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;425&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    Shamal&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;519&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Hydra&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;520&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    Skimmer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;460&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Leviathan&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;417&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    Sparrow&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;469&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Maverick&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;487&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
    Stuntplane&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;513&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Bikes==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;BF-400&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;581&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Mountain Bike&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;510&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Bike&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;509&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;NRG-500&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;522&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;BMX&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;481&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;PCJ-600&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;461&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Faggio&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;462&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Pizza Boy&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;448&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;FCR-900&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;521&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Sanchez&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; 468&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Freeway&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;463&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Wayfarer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;586&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Boats==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Coastguard&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;472&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Dinghy&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;473&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Jetmax&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;493&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Launch&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;595&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Marquis&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;484&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Predator&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;430&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Reefer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;453&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Speeder&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;452&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Squalo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;446&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Tropic&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;454&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Civil Servant / Public Transportation (Road Vehicles)==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Baggage&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;485&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Utility Van&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;552&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Bus&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;431&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Cabbie&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;438&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Coach&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;437&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Sweeper&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;574&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Taxi&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;420&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Towtruck&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;525&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Trashmaster&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;408&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Government Vehicles==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Ambulance&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;416&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Police Car (Los Santos)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;596&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Barracks&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;433&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Police Car (San Fierro)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;597&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Enforcer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;427&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Police Ranger&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;599&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;FBI Rancher&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;490&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Rhino&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;432&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;FBI Truck&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;528&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;S.W.A.T.&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;601&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Fire Truck&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;407&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Securicar&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;428&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Fire Truck (Ladder)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;544&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;HPV1000&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;523&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Patriot&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;470&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Police Car (Las Venturas)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;598&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Heavy and Utility Trucks==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Benson&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;499&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Hotdog&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;588&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Black Boxville&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;609&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Linerunner&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;403&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Boxville&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;498&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Linerunner (From &amp;quot;Tanker Commando&amp;quot;)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;514&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Cement Truck&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;524&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Mr. Whoopee&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;423&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Combine Harvester&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;532&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Mule&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;414&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;DFT-30&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;578&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Packer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;443&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Dozer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;486&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Roadtrain&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;515&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Dumper&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;406&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Tractor&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;531&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Dune&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;573&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Yankee&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;456&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Flatbed&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;455&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Light Trucks and Vans==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Berkley's RC Van&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;459&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Sadler&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;543&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Bobcat&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;422&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Tug&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;583&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Burrito&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;482&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Walton&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;478&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Damaged Sadler&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;605&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Yosemite&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;554&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Forklift&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;530&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Moonbeam&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;418&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Mower&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;572&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;News Van&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;582&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Pony&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;413&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Rumpo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;440&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lowriders==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Blade&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;536&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Broadway&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;575&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Remington&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;534&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Savanna&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;567&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Slamvan&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;535&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Tornado&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;576&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Voodoo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;412&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Muscle Cars==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Buffalo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;402&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Clover&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;542&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Phoenix&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;603&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Sabre&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;475&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Trains and Railroad Cars==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Tram&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;449&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Freight&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;537&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Brown Streak&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;538&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Brown Streak Carriage&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;570&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Removed in version [https://code.google.com/p/mtasa-blue/source/detail?r=2880 1.1-r2880], but available from [https://code.google.com/p/mtasa-blue/source/detail?r=5934 1.4-r5934] and forth.&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Flat Freight&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;569&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Box Freight&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;590&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RC Vehicles==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;RC Bandit&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;441&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;RC Baron&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;464&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;RC Goblin&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;501&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;RC Raider&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;465&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;RC Tiger&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;564&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Recreational==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Bandito&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;568&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Monster 3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;557&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;BF Injection&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;424&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Quadbike&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;471&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Bloodring Banger&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;504&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Sandking&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;495&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Caddy&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;457&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Vortex&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;539&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Camper&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;483&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Journey&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;508&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Kart&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;571&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Mesa&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;500&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Monster&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;444&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Monster 2&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;556&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Street Racers==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Banshee&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;429&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Infernus&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;411&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Bullet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;541&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Jester&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;559&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Cheetah&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;415&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Stratum&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;561&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Comet&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;480&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Sultan&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;560&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Elegy&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;562&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Super GT&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;506&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Flash&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;565&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Turismo&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;451&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Hotknife&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;434&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Uranus&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;558&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Hotring Racer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;494&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Windsor&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;555&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Hotring Racer 2&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;502&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;ZR-350&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;477&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Hotring Racer 3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;503&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SUVs and Wagons==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Huntley&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;579&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Landstalker&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;400&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Perennial&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;404&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Rancher&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;489&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Rancher (From &amp;quot;Lure&amp;quot;)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;505&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Regina&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;479&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Romero&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;442&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Solair&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;458&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Trailers==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;218&amp;quot;&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th width=&amp;quot;24&amp;quot;&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Baggage Trailer (covered)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;606&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Baggage Trailer (Uncovered)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;607&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Farm Trailer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;610&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;Street Clean&amp;quot; Trailer&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;611&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Trailer (From &amp;quot;Tanker Commando&amp;quot;)(*PRONE TO CRASHES*)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;584&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Trailer (Stairs)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;608&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Trailer 1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;435&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Trailer 2&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;450&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Trailer 3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;591&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Misc==&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot; class=&amp;quot;unnamed1&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th width=&amp;quot;218&amp;quot;&amp;gt;Name&amp;lt;/th&amp;gt;&amp;lt;th width=&amp;quot;24&amp;quot;&amp;gt;ID&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;RC Cam (flower pot)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;594&amp;lt;/td&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Vehicle Functions==&lt;br /&gt;
{{Vehicle functions}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[id|ID Lists]]&lt;br /&gt;
[[it:ID Veicoli]]&lt;br /&gt;
[[ru:Vehicle IDs]]&lt;br /&gt;
[[de:Fahrzeug IDs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:ID Lists]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientVehicleDamage&amp;diff=39927</id>
		<title>OnClientVehicleDamage</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientVehicleDamage&amp;diff=39927"/>
		<updated>2014-06-14T20:53:47Z</updated>

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

		<summary type="html">&lt;p&gt;MrTasty: Added rotation parameters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
&lt;br /&gt;
Draws a string of text on the screen for one frame. In order for the text to stay visible continuously, you need to call this function with the same parameters on each frame update (see [[onClientRender]]).&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 dxDrawText ( string text, float left, float top [, float right=left, float bottom=top, int color=white, &lt;br /&gt;
                  float scale=1, mixed font=&amp;quot;default&amp;quot;, string alignX=&amp;quot;left&amp;quot;, string alignY=&amp;quot;top&amp;quot;,&lt;br /&gt;
                  bool clip=false, bool wordBreak=false, bool postGUI=false,&lt;br /&gt;
                  bool colorCoded=false, bool subPixelPositioning=false, &lt;br /&gt;
                  float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''text:''' the text to draw&lt;br /&gt;
*'''left:''' the absolute X coordinate of the top left corner of the text&lt;br /&gt;
*'''top:''' the absolute Y coordinate of the top left corner of the text&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''right:''' the absolute X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking.&lt;br /&gt;
*'''bottom:''' the absolute Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking.&lt;br /&gt;
*'''color:''' the color of the text, a value produced by [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
*'''scale:''' the size of the text.{{New feature|3.0110|1.1|'''scale:''' can (optionally) be specified as two floats. i.e. '''scaleX, scaleY'''}}&lt;br /&gt;
*'''font:''' Either a custom [[DX font]] element or the name of a built-in DX font:&lt;br /&gt;
{{DxFonts}}&lt;br /&gt;
*'''alignX:''' horizontal alignment of the text within the bounding box. Can be '''&amp;quot;left&amp;quot;''', '''&amp;quot;center&amp;quot;''' or '''&amp;quot;right&amp;quot;'''.&lt;br /&gt;
*'''alignY:''' vertical alignment of the text within the bounding box. Can be '''&amp;quot;top&amp;quot;''', '''&amp;quot;center&amp;quot;''' or '''&amp;quot;bottom&amp;quot;'''.&lt;br /&gt;
*'''clip:''' if set to ''true'', the parts of the text that don't fit within the bounding box will be cut off.&lt;br /&gt;
*'''wordBreak:''' if set to ''true'', the text will wrap to a new line whenever it reaches the right side of the bounding box. If ''false'', the text will always be completely on one line.&lt;br /&gt;
* '''postGUI:''' A bool representing whether the text should be drawn on top of or behind any ingame GUI (rendered by CEGUI).&lt;br /&gt;
{{New feature/item|3.0135|1.3.0|0|&lt;br /&gt;
'''Note: These parameters only work from version 1.3.0-9.03986 onwards:'''&lt;br /&gt;
*'''colorCoded:''' Set to true to enable embedded #FFFFFF color codes. '''Note: clip and wordBreak are forced false if this is set.'''&lt;br /&gt;
*'''subPixelPositioning:''' A bool representing whether the text can be positioned sub-pixel-ly. Looks nicer for moving/scaling animations.&lt;br /&gt;
}}&lt;br /&gt;
{{New feature/item|3.0135|1.3.5|0|&lt;br /&gt;
*'''fRotation:''' Rotation'''&lt;br /&gt;
*'''fRotationCenterX:''' Rotation Origin X'''&lt;br /&gt;
*'''fRotationCenterY:''' Rotation Origin Y'''&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example code will add the current zone name in the lower left corner of the players' screens.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local screenWidth, screenHeight = guiGetScreenSize ( ) -- Get the screen resolution (width and height)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function createText ( )&lt;br /&gt;
    local playerX, playerY, playerZ = getElementPosition ( localPlayer )       -- Get our player's coordinates.&lt;br /&gt;
    local playerZoneName = getZoneName ( playerX, playerY, playerZ )          -- Get name of the zone the player is in.&lt;br /&gt;
&lt;br /&gt;
    -- Draw zone name text's shadow.&lt;br /&gt;
    dxDrawText ( playerZoneName, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, &amp;quot;pricedown&amp;quot; )&lt;br /&gt;
    -- Draw zone name text.&lt;br /&gt;
    dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, &amp;quot;pricedown&amp;quot; ) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function HandleTheRendering ( )&lt;br /&gt;
    addEventHandler ( &amp;quot;onClientRender&amp;quot;, root, createText ) -- keep the text visible with onClientRender.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler ( &amp;quot;onClientResourceStart&amp;quot;, resourceRoot, HandleTheRendering )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03986|Added colorCoded and subPixelPositioning arguments}}&lt;br /&gt;
{{ChangelogItem|1.3.5|Added fRotation, fRotationCenterX and fRotationCenterY arguments}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetChatboxLayout&amp;diff=38638</id>
		<title>GetChatboxLayout</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetChatboxLayout&amp;diff=38638"/>
		<updated>2014-01-22T20:33:08Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
Returns information about how the chatbox looks.&lt;br /&gt;
&lt;br /&gt;
These values comes from the file called: [[Chatboxpresents.xml]] but it depends on what type of preset you currently have, which is chosen from your settings in the 'Interface' tab.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool/int/table getChatboxLayout ( [ string CVar ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''CVar:''' the name of the property you want returned. Can be the following values:&lt;br /&gt;
**'''chat_font''' - Returns the chatbox font&lt;br /&gt;
**'''chat_lines''' - Returns how many lines the chatbox has&lt;br /&gt;
**'''chat_color''' - Returns the background color of the chatbox&lt;br /&gt;
**'''chat_text_color''' - Returns the chatbox text color&lt;br /&gt;
**'''chat_input_color''' - Returns the background color of the chatbox input&lt;br /&gt;
**'''chat_input_prefix_color''' - Returns the color of the input prefix text&lt;br /&gt;
**'''chat_input_text_color''' - Returns the color of the text in the chatbox input&lt;br /&gt;
**'''chat_scale''' - Returns the scale of the text in the chatbox&lt;br /&gt;
**'''chat_width''' - Returns the scale of the background width&lt;br /&gt;
**'''chat_css_style_text''' - Returns whether text fades out over time&lt;br /&gt;
**'''chat_css_style_background''' - Returns whether the background fades out over time&lt;br /&gt;
**'''chat_line_life''' - Returns how long it takes for text to start fading out&lt;br /&gt;
**'''chat_line_fade_out''' - Returns how long takes for text to fade out&lt;br /&gt;
**'''chat_use_cegui''' - Returns whether CEGUI is used to render the chatbox&lt;br /&gt;
**'''text_scale''' - Returns text scale&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*4 numbers if the CVar contains &amp;quot;color&amp;quot;&lt;br /&gt;
*2 numbers if '''chat_scale''' was entered&lt;br /&gt;
*1 number if any other CVar was specified&lt;br /&gt;
*a table of all CVar values, if CVar was not specified&lt;br /&gt;
*''false'' if an invalid CVar was specified&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This code makes the chatbox empty when you type /clear &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;clear&amp;quot;,&lt;br /&gt;
    function ()&lt;br /&gt;
        local lines = getChatboxLayout()[&amp;quot;chat_lines&amp;quot;]&lt;br /&gt;
        for i=1,lines do&lt;br /&gt;
            outputChatBox(&amp;quot;&amp;quot;)&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;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetChatboxLayout&amp;diff=38637</id>
		<title>GetChatboxLayout</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetChatboxLayout&amp;diff=38637"/>
		<updated>2014-01-22T20:31:07Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Added 'table of all CVar values' to returns if CVar was not specified&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
Returns information about how the chatbox looks.&lt;br /&gt;
&lt;br /&gt;
These values comes from the file called: [[Chatboxpresents.xml]] but it depends on what type of preset you currently have, which is chosen from your settings in the 'Interface' tab.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool / int getChatboxLayout ( [ string CVar ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''CVar:''' the name of the property you want returned. Can be the following values:&lt;br /&gt;
**'''chat_font''' - Returns the chatbox font&lt;br /&gt;
**'''chat_lines''' - Returns how many lines the chatbox has&lt;br /&gt;
**'''chat_color''' - Returns the background color of the chatbox&lt;br /&gt;
**'''chat_text_color''' - Returns the chatbox text color&lt;br /&gt;
**'''chat_input_color''' - Returns the background color of the chatbox input&lt;br /&gt;
**'''chat_input_prefix_color''' - Returns the color of the input prefix text&lt;br /&gt;
**'''chat_input_text_color''' - Returns the color of the text in the chatbox input&lt;br /&gt;
**'''chat_scale''' - Returns the scale of the text in the chatbox&lt;br /&gt;
**'''chat_width''' - Returns the scale of the background width&lt;br /&gt;
**'''chat_css_style_text''' - Returns whether text fades out over time&lt;br /&gt;
**'''chat_css_style_background''' - Returns whether the background fades out over time&lt;br /&gt;
**'''chat_line_life''' - Returns how long it takes for text to start fading out&lt;br /&gt;
**'''chat_line_fade_out''' - Returns how long takes for text to fade out&lt;br /&gt;
**'''chat_use_cegui''' - Returns whether CEGUI is used to render the chatbox&lt;br /&gt;
**'''text_scale''' - Returns text scale&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*4 numbers if the CVar contains &amp;quot;color&amp;quot;&lt;br /&gt;
*2 numbers if '''chat_scale''' was entered&lt;br /&gt;
*1 number if any other CVar was specified&lt;br /&gt;
*a table of all CVar values, if CVar was not specified&lt;br /&gt;
*''false'' if an invalid CVar was specified&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This code makes the chatbox empty when you type /clear &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;clear&amp;quot;,&lt;br /&gt;
    function ()&lt;br /&gt;
        local lines = getChatboxLayout()[&amp;quot;chat_lines&amp;quot;]&lt;br /&gt;
        for i=1,lines do&lt;br /&gt;
            outputChatBox(&amp;quot;&amp;quot;)&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;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=38549</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=38549"/>
		<updated>2014-01-19T11:24:01Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: Added 'getKeyFromValueInTable' and 'secondsToTimeDesc'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any clientside function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function center the window in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if it's arguments are of the right types and calls the error-function if one isn't.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts large numbers and adds commas to it. (Example: 100000 -&amp;gt; 100,000)&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Fix for hidden coroutine error messages&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawAnimWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Create Animated Dx Window&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawCircle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 2D line in a circle shape on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawColorText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a dx text with #RRGGBB color codes support.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawPartialCircle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 2D line in a partial circle shape on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculate a font size from given height for dxDraw.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Accurately measures the pixel height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FewPlayersOnTeams]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets a team from it's few Players.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[GenerateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can generate a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all the alive players by a client side, so you can store them into a Gridlist or something like that, faster.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getBoundControls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a list of control names that are bound to the specified key.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» 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;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsInDimension]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets the elements that are in the specified dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsWithinMarker]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets the elements that are in a markers colshape.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[getKeyFromValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; 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;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will give the online admins.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all online staff, names separated by two spaces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersByData]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets players who have data name you passed to it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get player From his Name part.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets all the players in a photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromSerial]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets an online player from their serial.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceScripts]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource scripts.&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 percentage requested.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTeamFromColor]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gets a team from it's color. (Related to: [[getTeamFromName]])&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» With this function you can get the UNIX timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getValidVehicleModels]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table containing valid MTA Vehicle models.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns all children of a node&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getVehicleRespawnPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get the spawn position of a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Adjusts the combobox to have a correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element was in the player's camera picture.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check is the element's range to the main point is smaller than (or as big as) the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementTeam]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if element is team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementWithinAColShape]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if the [[element]] is in a [[colshape]].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a ped is aiming.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInACL]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function will check to see if a player element is in an ACL group.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if the player in the team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Checks if the given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleEmpty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a vehicle is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isSoundFinished]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks sound finished or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Returns an iterator for your for loops saving time typing ipairs( getElementsByType( type ) ), instead you type: iterElements( type ).&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mathNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is a workaround for the clientside floating-point precision of 24-bits&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicles weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[secondsToTimeDesc]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set moving element speed in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside 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;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This clientside function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts a text from a text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allow 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;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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.compare]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check if both tables is equal. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function check is empty table or not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Merges two or more tables in the first.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random variable from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Finds the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used clientside.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; 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-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a phisical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetKeyFromValueInTable&amp;diff=38548</id>
		<title>GetKeyFromValueInTable</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetKeyFromValueInTable&amp;diff=38548"/>
		<updated>2014-01-19T11:20:27Z</updated>

		<summary type="html">&lt;p&gt;MrTasty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function can be used to find the key of a specified value in a specified table. &lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;element/int/float/string getKeyFromValueInTable(table theTable, mixed searchFor )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theTable''': The table where to look for the specified value.&lt;br /&gt;
* '''searchFor''': The string/number/element to find the key of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the key of the searched value, or ''false'' if not found.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Function source&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 getKeyFromValueInTable(a, b)&lt;br /&gt;
    for k,v in ipairs(a) do&lt;br /&gt;
        if v == b then&lt;br /&gt;
           return k&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
Author: MrTasty&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example output the cost of the item specified by the player who entered the command.&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' This is not the most efficient way, as it won't allow you to have more than 1 item of the same cost.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
shopItems = {&lt;br /&gt;
    --[PRICE] = &amp;quot;ITEM NAME&amp;quot;,&lt;br /&gt;
    [10] = &amp;quot;Sprunk Soda&amp;quot;,&lt;br /&gt;
    [12] = &amp;quot;eCola&amp;quot;,&lt;br /&gt;
    [17] = &amp;quot;Pisswasser&amp;quot;,&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;getcostof&amp;quot;, function(player, command, item)&lt;br /&gt;
    if item then&lt;br /&gt;
        local cost = getKeyFromValueInTable(shopItems, item) --Find the key (the price in this case) of entered item name&lt;br /&gt;
        if cost then&lt;br /&gt;
            outputChatBox(item..&amp;quot; costs $&amp;quot;..cost, player, 255, 0, 0) --If the cost was found, output it to the command executor&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox(item..&amp;quot; is not available in our shop.&amp;quot;, player, 255, 0, 0) --If it wasn't, tell the command executor that the item does not have a cost (ie: not in the shop)&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Syntax error. Valid syntax is: /&amp;quot;..command..&amp;quot; &amp;lt;item name&amp;gt;&amp;quot;, player, 255, 0, 0) --Output valid syntax in case the executor did not specify the item name to search for&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>MrTasty</name></author>
	</entry>
</feed>