<?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=50p</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=50p"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/50p"/>
	<updated>2026-05-21T08:38:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineLoadTXD&amp;diff=24358</id>
		<title>EngineLoadTXD</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineLoadTXD&amp;diff=24358"/>
		<updated>2010-08-13T12:49:46Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function loads a RenderWare Texture Dictionary (TXD) file into GTA. The texture dictionary can then be used to provide textures.&lt;br /&gt;
&lt;br /&gt;
This is a client side function. Be sure to transfer your TXD file by including it in the meta file.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
txd engineLoadTXD ( string txd_file [, bool filteringEnabled = true ] ) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
[[Image:Filtering.jpg|thumb|Difference between texture filtering modes (left = filtering disabled, right = filtering enabled).|284x230px]]&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''txd_file:''' The [[filepath]] to the txd file you want to load&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''filteringEnabled:''' Whether to enable texture filtering.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[TXD]] if the file was loaded, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example loads a combination of a custom DFF and TXD file to replace the Euros vehicle in-game. The collisions are embedded inside the DFF file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox ( &amp;quot;&amp;gt; replacing the euros vehicle&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
txd = engineLoadTXD ( &amp;quot;data/euros.txd&amp;quot; )&lt;br /&gt;
engineImportTXD ( txd, 587 )&lt;br /&gt;
dff = engineLoadDFF ( &amp;quot;data/euros.dff&amp;quot;, 587 )&lt;br /&gt;
engineReplaceModel ( dff, 587 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example loads a combination of custom DFF, TXD and COL files to replace an in-game model of a set of floors.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox ( &amp;quot;&amp;gt; loading floor objects&amp;quot; )&lt;br /&gt;
txd_floors = engineLoadTXD ( &amp;quot;models/office_floors.txd&amp;quot; )&lt;br /&gt;
engineImportTXD ( txd_floors, 3781 )&lt;br /&gt;
col_floors = engineLoadCOL ( &amp;quot;models/office_floors.col&amp;quot; )&lt;br /&gt;
dff_floors = engineLoadDFF ( &amp;quot;models/office_floors.dff&amp;quot;, 0 )&lt;br /&gt;
engineReplaceCOL ( col_floors, 3781 )&lt;br /&gt;
engineReplaceModel ( dff_floors, 3781 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=24345</id>
		<title>AddCommandHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=24345"/>
		<updated>2010-08-12T10:54:35Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{Note_box|It is strongly advised that you do not use the same name for your handler function as the command name, as this can lead to confusion if multiple handler functions are used. Use a name that describes your handler's purpose more specifically.}}&lt;br /&gt;
This function will attach a scripting function (handler) to a console command, so that whenever a player or administrator uses the command the function is called.&lt;br /&gt;
&lt;br /&gt;
Multiple command handlers can be attached to a single command, and they will be called in the order that the handlers were attached. Equally, multiple commands can be handled by a single function, and the ''commandName'' parameter used to decide the course of action.&lt;br /&gt;
&lt;br /&gt;
For users, a command is in the format:&lt;br /&gt;
&lt;br /&gt;
''commandName'' ''argument1'' ''argument2''&lt;br /&gt;
&lt;br /&gt;
This can be triggered from the player's console or directly from the chat box by prefixing the message with a forward slash (''/''). For server side handlers, the server admin is also able to trigger these directly from the server's console in the same way as they are triggered from a player's console.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addCommandHandler ( string commandName, function handlerFunction, [bool restricted = false, bool caseSensitive = true] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''commandName:''' This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function.&lt;br /&gt;
*'''handlerFunction:''' This is the function that you want the command to trigger, which has to be defined before you add the handler. This function can take two parameters, playerSource and commandName, followed by as many parameters you expect after your command (see below). These are all optional.&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''restricted:''' Specify whether or not this command should be restricted by default. Use this on commands that should be inaccessible to everyone as default except special users specified in the ACL (Access Control List). This is to make sure admin commands such as ie. 'punish' won't be available to everyone if a server administrator forgets masking it in ACL. This argument defaults to false if nothing is specified.&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
*'''caseSensitive:''' Specifies if the command handler will ignore the case for this command name.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addCommandHandler ( string commandName, function handlerFunction, [bool caseSensitive = true] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''commandName:''' This is the name of the command you wish to attach a handler to. This is what must be typed into the console to trigger the function.&lt;br /&gt;
*'''handlerFunction:''' This is the function that you want the command to trigger, which has to be defined before you add the handler. This function can take two parameters, playerSource and commandName, followed by as many parameters you expect after your command (see below). These are all optional.&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
*'''caseSensitive:''' Specifies if the command handler will ignore the case for this command name.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Handler function parameters====&lt;br /&gt;
These are the parameters for the handler function that is called when the command is used.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;player playerSource, string commandName, [string arg1, string arg2, ...] &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''playerSource:''' The player who triggered the command. If not triggered by a player (e.g. by admin), this will be ''false''.&lt;br /&gt;
* '''commandName:''' The name of the command triggered. This is useful if multiple commands go through one function.&lt;br /&gt;
* '''arg1, arg2, ...:''' Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain [[nil]]. You can deal with a variable number of arguments using the vararg expression, as shown in '''Example 4''' below.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; string commandName, [string arg1, string arg2, ...] &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* '''commandName:''' The name of the command triggered. This is useful if multiple commands go through one function.&lt;br /&gt;
* '''arg1, arg2, ...:''' Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain [[nil]]. You can deal with a variable number of arguments using the vararg expression, as shown in '''Example 4''' below.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the command handler was added successfully, ''false'' otherwise.&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;
'''Example 1:''' This example defines a command handler for the command ''createmarker''. This will create a red marker at the position of the player player who uses it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleCreateMarker ( playerSource )&lt;br /&gt;
	-- If a player triggered it (rather than the admin) then&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get that player's position&lt;br /&gt;
		local x, y, z = getElementPosition ( playerSource )&lt;br /&gt;
		-- Create a size 2, red checkpoint marker at their position&lt;br /&gt;
		createMarker ( x, y, z, &amp;quot;checkpoint&amp;quot;, 2, 255, 0, 0, 255 )&lt;br /&gt;
		-- Output it in his chat box&lt;br /&gt;
		outputChatBox ( &amp;quot;You got a red marker&amp;quot;, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Attach the 'consoleCreateMarker' function to the &amp;quot;createmarker&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, consoleCreateMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' A simple health setting command. If a player types ''/sethealth X'' in the chatbox his health will be set to X. Note that the function [[setElementHealth]] is used rather than something like &amp;quot;setPlayerHealth&amp;quot;. This function is more generic and can also be used to set the health of vehicles.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetHealth(playerSource, commandName, health)&lt;br /&gt;
	setElementHealth(playerSource, tonumber(health))&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;sethealth&amp;quot;, consoleSetHealth)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 3:''' This example implements a ''set_vehicle_color'' command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle this command&lt;br /&gt;
function consoleSetVehicleColor ( playerSource, commandName, col1, col2, col3, col4 )&lt;br /&gt;
	-- If a player triggered this in-game&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get the player's vehicle&lt;br /&gt;
		local playerVehicle = getPedOccupiedVehicle ( playerSource )&lt;br /&gt;
		-- If the player is in a vehicle and we've got at least 1 parameter&lt;br /&gt;
		if ( playerVehicle and col1 ) then&lt;br /&gt;
			-- Get the vehicle's existing color and use it if fewer than 4 arguments were passed&lt;br /&gt;
			local exCol1, exCol2, exCol3, exCol4 = getVehicleColor ( playerVehicle )&lt;br /&gt;
&lt;br /&gt;
			if not col2 then col2 = exCol2 end&lt;br /&gt;
			if not col3 then col3 = exCol3 end&lt;br /&gt;
			if not col4 then col4 = exCol4 end&lt;br /&gt;
&lt;br /&gt;
			-- Set the vehicle's color&lt;br /&gt;
			setVehicleColor ( playerVehicle, col1, col2, col3, col4 )&lt;br /&gt;
		else&lt;br /&gt;
			-- If we didn't get at least 1 parameter or the player doesn't have a vehicle, display some help text&lt;br /&gt;
			outputConsole ( &amp;quot;This function will set your current vehicle's colors. A vehicle can have up to 4 colors.&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;Syntax: set_vehicle_color color1 [ color2 color3 color4 ]&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;You must be in a vehicle to use this function.&amp;quot;, playerSource )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Attach the 'consoleSetVehicleColor' function to the &amp;quot;set_vehicle_color&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;set_vehicle_color&amp;quot;, consoleSetVehicleColor )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 4:''' This example makes use of Lua's vararg expression to implement a ''check_parameters'' command to count the number of parameters passed, merge them all into a single string and output it. This is also shows you how you can use table.concat to merge all the passed arguments. This is particularly useful when you want to read in a sentence of text passed from the user. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle this command (which can accept a variable number of arguments after commandName)&lt;br /&gt;
function consoleCheckParameters ( playerSource, commandName, ... )&lt;br /&gt;
	-- If a player, not an admin, triggered it,&lt;br /&gt;
	if playerSource then&lt;br /&gt;
		-- Get the number of arguments in the arg table (arg table is the same as: {...})&lt;br /&gt;
		local parameterCount = #arg&lt;br /&gt;
		-- Output it to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Number of parameters: &amp;quot; .. parameterCount, playerSource )&lt;br /&gt;
		-- Join them together in a single comma-separated string&lt;br /&gt;
		local stringWithAllParameters = table.concat( arg, &amp;quot;, &amp;quot; )&lt;br /&gt;
		-- Output this parameter list to the player's chatbox&lt;br /&gt;
		outputChatBox ( &amp;quot;Parameters passed: &amp;quot; .. stringWithAllParameters, playerSource )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Attach the 'consoleCheckParameters' function to the &amp;quot;check_parameters&amp;quot; command&lt;br /&gt;
addCommandHandler ( &amp;quot;check_parameters&amp;quot;, consoleCheckParameters )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 5:''' This example shows using a single function to handle multiple command handlers. This isn't advised for general usage, as it makes code harder to understand, but where multiple command handlers share some logic, it can be a useful way of reducing duplicated code. Generally, it would be preferable to put this shared logic in a separate function instead, as this gives you more control over the flow.&lt;br /&gt;
&amp;lt;!-- commands are case sensitive by default, in this example too --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- make the function&lt;br /&gt;
function moneyCmd(player, cmd, amount)&lt;br /&gt;
    if getElementData(player, &amp;quot;canUseMoneyFunctions&amp;quot;) then -- the shared logic&lt;br /&gt;
        if cmd == &amp;quot;givemoney&amp;quot; then&lt;br /&gt;
            amount  = tonumber(amount)&lt;br /&gt;
            if amount then&lt;br /&gt;
                givePlayerMoney(player, amount)&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox(&amp;quot;[usage] /givemoney [amount]&amp;quot;, player)&lt;br /&gt;
            end&lt;br /&gt;
        else if cmd == &amp;quot;takemoney&amp;quot; then&lt;br /&gt;
            amount = tonumber(amount)&lt;br /&gt;
            if amount then&lt;br /&gt;
                takePlayerMoney(player, amount)&lt;br /&gt;
            else&lt;br /&gt;
                outputChatBox(&amp;quot;[usage] /takemoney [amount]&amp;quot;, player)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;You aren't able to use this command&amp;quot;, player)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
addCommandHandler(&amp;quot;givemoney&amp;quot;, moneyCmd);&lt;br /&gt;
addCommandHandler(&amp;quot;takemoney&amp;quot;, moneyCmd);&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;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
'''Example 1:''' This creates a GUI window and allows a player to change its alpha (transparency) value with a command. Note that, in a clientside script, the player using the command is not passed as a parameter to the handler function, since it is always the local player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;--Create a window&lt;br /&gt;
myWindow = guiCreateWindow ( 0.30, 0.10, 0.5, 0.60, &amp;quot;GUI window title&amp;quot;, true )&lt;br /&gt;
&lt;br /&gt;
--Add a command handler to change the alpha of the GUI window. Usage example: 'alpha 0.15'&lt;br /&gt;
function changeAlpha ( commandName, alphaAmount )&lt;br /&gt;
	-- All command parameters are strings, so we'll convert the value to a number first&lt;br /&gt;
	alphaAmount = tonumber(alphaAmount)&lt;br /&gt;
	guiSetAlpha ( myWindow, alphaAmount )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;alpha&amp;quot;, changeAlpha )&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;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Optional_Arguments&amp;diff=24344</id>
		<title>Optional Arguments</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Optional_Arguments&amp;diff=24344"/>
		<updated>2010-08-12T01:37:22Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Optional Arguments]] are arguments that are passed to a function but are not required for the function to run. Often, if you do not specify them, default values will be used instead.&lt;br /&gt;
&lt;br /&gt;
When looking at the Syntax for an argument, Optional arguments are always enclosed in Square brackets.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;createVehicle ( int model, float x, float y, float z, [ float rx, float ry, float rz ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, '''rx''', '''ry''', and '''rz''' are [[Optional Arguments]].&lt;br /&gt;
&lt;br /&gt;
==Using Optional Arguments==&lt;br /&gt;
&lt;br /&gt;
[[Optional Arguments]] have one limitation. You cannot use any optional arguments unless ''all previous arguments are also supplied.''&lt;br /&gt;
&lt;br /&gt;
This means that in the previous example, if you wanted to supply '''rz''', you would also need to supply '''rx''', and '''ry''' ''in order.''&lt;br /&gt;
&lt;br /&gt;
[[pl:Argumenty opcjonalne]]&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[ru:Optional Arguments]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetTrafficLightState&amp;diff=24282</id>
		<title>SetTrafficLightState</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetTrafficLightState&amp;diff=24282"/>
		<updated>2010-08-09T15:03:43Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
Sets the current traffic light state. This state controls the traffic light colors. For instance, state '''1''' will cause the north and south traffic lights to be amber, and the ones left and east will turn red.&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 setTrafficLightState ( int state )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''state''': The [[Traffic_light_states|state]] you wish to use (possible values: 0-9)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the state was successfully set, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example doesn't exist&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{World_functions}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Needs_Example]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientRender&amp;diff=24179</id>
		<title>OnClientRender</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientRender&amp;diff=24179"/>
		<updated>2010-08-06T17:44:28Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Example - happy now?! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}} &lt;br /&gt;
This event is triggered every time GTA renders a new frame. It is required for the DirectX drawing functions, and also useful for other clientside operations that have to be applied repeatedly with very short time differences between them.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
''None''&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes the camera follow the player in a GTA2-like way. This will be a little bit laggy. If you want the camera to follow something (eg. player or vehicle) then use [[onClientPreRender]] instead.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
root = getRootElement ()&lt;br /&gt;
function updateCamera ()&lt;br /&gt;
	local x, y, z = getElementPosition ( getLocalPlayer () )&lt;br /&gt;
	setCameraMatrix ( x, y, z + 50, x, y, z )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientRender&amp;quot;, root, updateCamera )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Other client events===&lt;br /&gt;
{{Client_other_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientRender&amp;diff=24178</id>
		<title>OnClientRender</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientRender&amp;diff=24178"/>
		<updated>2010-08-06T16:12:53Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Added example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}} &lt;br /&gt;
This event is triggered every time GTA renders a new frame. It is required for the DirectX drawing functions, and also useful for other clientside operations that have to be applied repeatedly with very short time differences between them.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
''None''&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example makes the camera follow the player in a GTA2-like way. This will be a little bit laggy. If you want the camera to follow something (eg. player or vehicle) then use [[onClientPreRender]] instead.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
root = getRootElement ()&lt;br /&gt;
function updateCamera ()&lt;br /&gt;
	local x, y, z = getElementPosition ( getLocalPlayer () )&lt;br /&gt;
	setCameraMatrix ( x, y, z + 50, x, y, z )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPreRender&amp;quot;, root, updateCamera )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Other client events===&lt;br /&gt;
{{Client_other_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24126</id>
		<title>IterElements</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24126"/>
		<updated>2010-07-29T22:10:50Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is useful for '''for''' loops. You don't have to type ''ipairs( getElementsByType( &amp;quot;player&amp;quot; ) )'' but simply ''iterElements( &amp;quot;player&amp;quot; )''. It's very useful if you have many for loops in your code. [[doForAllElements]] has to iterate through elements every time you call 1 function per call but this iterates through elements and what you do to/with the elements is up to you.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;iterator iterElements( string elementType )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''elementType''': Type of the elements that you want to iterate through.&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 iterElements( elementType )&lt;br /&gt;
	local i = 0;&lt;br /&gt;
	local tab = getElementsByType( elementType );&lt;br /&gt;
	return function( )&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
		if tab[ i ] then&lt;br /&gt;
			return i, tab[ i ];&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will iterate through all players and vehicles. It will heal the players, give them $1000, send them a message informing them about the action and fix all vehicles when the resource starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;, getResourceRootElement( ),&lt;br /&gt;
    function( )&lt;br /&gt;
        for _, plr in iterElements( &amp;quot;player&amp;quot; ) do&lt;br /&gt;
            setElementHealth( plr, 100 );&lt;br /&gt;
            givePlayerMoney( plr, 1000 );&lt;br /&gt;
            outputChatBox( &amp;quot;You've just been healed and given $1000!&amp;quot;, plr );&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        for _, veh in iterElements( &amp;quot;vehicle&amp;quot; ) do&lt;br /&gt;
            fixVehicle( veh );&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24125</id>
		<title>IterElements</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24125"/>
		<updated>2010-07-29T22:09:47Z</updated>

		<summary type="html">&lt;p&gt;50p: Undo revision 24122 by Lil Toady (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is useful for '''for''' loops. You don't have to type ''ipairs( getElementsByType( &amp;quot;player&amp;quot; ) )'' but simply ''iterElements( &amp;quot;player&amp;quot; )''. It's very useful if you have many for loops in your code. [[doForAllElements]] has to iterate through elements every time you call 1 function per call but this iterates and what you do to the elements is up to you.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;iterator iterElements( string elementType )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''elementType''': Type of the elements that you want to iterate through.&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 iterElements( elementType )&lt;br /&gt;
	local i = 0;&lt;br /&gt;
	local tab = getElementsByType( elementType );&lt;br /&gt;
	return function( )&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
		if tab[ i ] then&lt;br /&gt;
			return i, tab[ i ];&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will iterate through all players and vehicles. It will heal the players, give them $1000, send them a message informing them about the action and fix all vehicles when the resource starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;, getResourceRootElement( ),&lt;br /&gt;
    function( )&lt;br /&gt;
        for _, plr in iterElements( &amp;quot;player&amp;quot; ) do&lt;br /&gt;
            setElementHealth( plr, 100 );&lt;br /&gt;
            givePlayerMoney( plr, 1000 );&lt;br /&gt;
            outputChatBox( &amp;quot;You've just been healed and given $1000!&amp;quot;, plr );&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        for _, veh in iterElements( &amp;quot;vehicle&amp;quot; ) do&lt;br /&gt;
            fixVehicle( veh );&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PlaySound3D&amp;diff=24078</id>
		<title>PlaySound3D</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PlaySound3D&amp;diff=24078"/>
		<updated>2010-07-20T19:39:23Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Required Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
Creates a [[sound]] element in the GTA world and plays it immediately after creation for the local player. [[setElementPosition]] can be used to move the [[sound]] element around after it has been created.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
'''Note:''' The only supported audio formats are MP3, WAV, OGG, RIFF, MOD, XM, IT and S3M.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;element playSound3D ( string soundPath, float x, float y, float z, [ bool looped = false ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''soundPath:''' The [[filepath]] to the sound file you want to play. (Sound file has to be predefined in the [[meta.xml]] file with &amp;lt;file /&amp;gt; tag.)&lt;br /&gt;
*'''x:''' A floating point number representing the X coordinate on the map.&lt;br /&gt;
*'''y:''' A floating point number representing the Y coordinate on the map.&lt;br /&gt;
*'''z:''' A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''looped:''' A [[boolean]] representing whether the sound will be looped. To loop the sound, use ''true''.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[sound]] element if the sound was successfully created, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a looping sound within a pizza shop. The pizza shop is in san fierro near pier 69&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart()&lt;br /&gt;
	local sound = playSound3D(&amp;quot;sounds/song.mp3&amp;quot;, 373.14, -125.21, 1001, true) &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(getThisResource()), onResourceStart)&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;
{{Client_audio_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PlaySound&amp;diff=24077</id>
		<title>PlaySound</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PlaySound&amp;diff=24077"/>
		<updated>2010-07-20T19:38:59Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
Creates a [[sound]] element and plays it immediately after creation for the local player.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
'''Note:''' The only supported audio formats are MP3, WAV, OGG, RIFF, MOD, XM, IT and S3M.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;element playSound ( string soundPath, [ bool looped = false ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''soundPath:''' The [[filepath]] to the sound file you want to play. (Sound file has to be predefined in the [[meta.xml]] file with &amp;lt;file /&amp;gt; tag.)&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''looped:''' A [[boolean]] representing whether the sound will be looped. To loop the sound, use ''true''.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[sound]] element if the sound was successfully created, ''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;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function wasted (killer, weapon, bodypart) &lt;br /&gt;
	local sound = playSound(&amp;quot;sounds/wasted.mp3&amp;quot;) --Play wasted.mp3 from the sounds folder&lt;br /&gt;
	setSoundVolume(sound, 0.5) -- set the sound volume to 50%&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onClientPlayerWasted&amp;quot;, getLocalPlayer(), wasted) --add the event handler&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;
{{Client_audio_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=24049</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=24049"/>
		<updated>2010-07-14T22:08:11Z</updated>

		<summary type="html">&lt;p&gt;50p: &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;
&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;
&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;
&lt;br /&gt;
*[[doForAllElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function can be used to execute a specified function for all elements of a specified type.&amp;lt;/span&amp;gt;&lt;br /&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;
&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;
&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;
&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;
&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;
&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 [http://en.wikipedia.org/wiki/Unix_time UNIX timestamp].&amp;lt;/span&amp;gt;&lt;br /&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;
&lt;br /&gt;
*[[IsYearALeapYear]] &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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24048</id>
		<title>IterElements</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24048"/>
		<updated>2010-07-14T22:07:41Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is useful for '''for''' loops. You don't have to type ''ipairs( getElementsByType( &amp;quot;player&amp;quot; ) )'' but simply ''iterElements( &amp;quot;player&amp;quot; )''. It's very useful if you have many for loops in your code. [[doForAllElements]] has to iterate through elements every time you call 1 function per call but this iterates and what you do to the elements is up to you.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;iterator iterElements( string elementType )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''elementType''': Type of the elements that you want to iterate through.&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 iterElements( elementType )&lt;br /&gt;
	local i = 0;&lt;br /&gt;
	local tab = getElementsByType( elementType );&lt;br /&gt;
	return function( )&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
		if tab[ i ] then&lt;br /&gt;
			return i, tab[ i ];&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will iterate through all players and vehicles. It will heal the players, give them $1000, send them a message informing them about the action and fix all vehicles when the resource starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;, getResourceRootElement( ),&lt;br /&gt;
    function( )&lt;br /&gt;
        for _, plr in iterElements( &amp;quot;player&amp;quot; ) do&lt;br /&gt;
            setElementHealth( plr, 100 );&lt;br /&gt;
            givePlayerMoney( plr, 1000 );&lt;br /&gt;
            outputChatBox( &amp;quot;You've just been healed and given $1000!&amp;quot;, plr );&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        for _, veh in iterElements( &amp;quot;vehicle&amp;quot; ) do&lt;br /&gt;
            fixVehicle( veh );&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=24047</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=24047"/>
		<updated>2010-07-14T22:07:34Z</updated>

		<summary type="html">&lt;p&gt;50p: &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;
&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;
&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;
&lt;br /&gt;
*[[doForAllElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function can be used to execute a specified function for all elements of a specified type.&amp;lt;/span&amp;gt;&lt;br /&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;
&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;
&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;
&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;
&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 [http://en.wikipedia.org/wiki/Unix_time UNIX timestamp].&amp;lt;/span&amp;gt;&lt;br /&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;
&lt;br /&gt;
*[[IsYearALeapYear]] &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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&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;
&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24046</id>
		<title>IterElements</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IterElements&amp;diff=24046"/>
		<updated>2010-07-14T22:04:52Z</updated>

		<summary type="html">&lt;p&gt;50p: Created page with '{{Useful Function}} &amp;lt;lowercasetitle/&amp;gt; __NOTOC__ This function is useful for '''for''' loops. You don't have to type ''ipairs( getElementsByType( &amp;quot;player&amp;quot; ) )'' but simply ''iterE…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is useful for '''for''' loops. You don't have to type ''ipairs( getElementsByType( &amp;quot;player&amp;quot; ) )'' but simply ''iterElements( &amp;quot;player&amp;quot; )''. It's very useful if you have many for loops in your code. [[doForAllElements]] has to iterate through elements every time you call 1 function per call but this iterates and what you do to the elements is up to you.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;iterator iterElements( string elementType )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''elementType''': Type of the elements that you want to iterate through.&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 iterElements( elementType )&lt;br /&gt;
	local i = 0;&lt;br /&gt;
	local tab = getElementsByType( elementType );&lt;br /&gt;
	return function( )&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
		if tab[ i ] then&lt;br /&gt;
			return i, tab[ i ];&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will iterate through all players and vehicles. It will heal the players, give them $1000, send them a message informing them about the action and fix all vehicles when the resource starts.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;, getResourceRootElement( ),&lt;br /&gt;
    function( )&lt;br /&gt;
        for _, plr in iterElements( &amp;quot;player&amp;quot; ) do&lt;br /&gt;
            setElementHealth( plr, 100 );&lt;br /&gt;
            givePlayerMoney( plr, 1000 );&lt;br /&gt;
            outputChatBox( &amp;quot;You've just been healed and given $1000!&amp;quot;, plr );&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        for _, veh in iterElements( &amp;quot;vehicle&amp;quot; ) do&lt;br /&gt;
            fixVehicle( veh );&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CSharp_SDK&amp;diff=23959</id>
		<title>CSharp SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CSharp_SDK&amp;diff=23959"/>
		<updated>2010-07-08T20:39:58Z</updated>

		<summary type="html">&lt;p&gt;50p: /* fixed link to my wiki profile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
Many languages can make HTTP POST requests with JSON, C# can do too. This is C# SDK for MTA. It allows you to call any HTTP exported functions from resources. The SDK itself is very basic and easy to use. It was mainly created to extend [[MTASE|MTA:Script Editor]] functionality. Feel free to modify it however you like but don't remove original author. If you want your changes to be published, please speak to [[User:50p|50p]] on MTA forums [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 HERE]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to==&lt;br /&gt;
First of all, you have to include your files in your project. Once you've done this, you are ready to use SDK.&lt;br /&gt;
&lt;br /&gt;
1. Add MTA_SDK.cs and MTA_LuaArgs.cs to your project file and import the SDK namespace in your file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;using MTA_SDK;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Create instance of MTA class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA server = new MTA();	//-- default params (for IP and port, respectively) are: &amp;quot;localhost&amp;quot; and 22005&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;//-- if you don't want to make a call to your local server then you can connect to remote server with the following parameters:&lt;br /&gt;
MTA server = new MTA( &amp;quot;IP&amp;quot;, port );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;//-- if you get errors about authorization then you should use the account you created on your server &lt;br /&gt;
//-- (the account that is allowed to visit HTTP sites of your server, preferably admin):&lt;br /&gt;
MTA server = new MTA( &amp;quot;IP&amp;quot;, port, &amp;quot;username&amp;quot;, &amp;quot;password&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Create instance of MTA_LuaArgs class to create list of arguments that is passed to the function call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA_LuaArgs luaArgs = new MTA_LuaArgs( );&lt;br /&gt;
luaArgs.AddValue( &amp;quot;hello&amp;quot; );&lt;br /&gt;
luaArgs.AddValue( &amp;quot;world&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA_LuaArgs luaArgs = new MTA_LuaArgs( &amp;quot;hello&amp;quot;, &amp;quot;world&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Call function exported from resource (in meta.xml: &amp;lt;export function=&amp;quot;functionName&amp;quot; http=&amp;quot;true&amp;quot; /&amp;gt;, REMEMBER! http attribute has to be true!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string returned = server.CallFunction( &amp;quot;sampleResource&amp;quot;, &amp;quot;functionName&amp;quot;, luaArgs );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And here is the sample Lua function (functionName) that we're trying to call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function functionName( param1, param2 )&lt;br /&gt;
	outputChatBox( &amp;quot;Function called from SDK with args: &amp;quot; .. param1 .. &amp;quot;, &amp;quot; .. param2 );&lt;br /&gt;
	return true;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
You can download C# MTA SDK here:&lt;br /&gt;
*[http://scripteditor.beta.mtasa.com/files/MTA_SDK_1.0.zip C# MTA SDK 1.0]&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
If you have any questions/suggestions you can contact author on MTA forum or IRC '''#mta''' and '''#mtatools''' channels hosted on GTANet.com server.&lt;br /&gt;
*[http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleCurrentGear&amp;diff=23853</id>
		<title>GetVehicleCurrentGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleCurrentGear&amp;diff=23853"/>
		<updated>2010-07-03T14:24:52Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
&lt;br /&gt;
Gets the specified vehicle's current gear.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getVehicleCurrentGear ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' the vehicle to get the gear of&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the gear if successful, ''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;
Example of a program that outputs the current gear to the lower, center of the screen&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
g_player = getLocalPlayer()&lt;br /&gt;
g_root = getRootElement()&lt;br /&gt;
&lt;br /&gt;
function makeGearGui( )&lt;br /&gt;
	local sx,sy = guiGetScreenSize()&lt;br /&gt;
	local wx = 50&lt;br /&gt;
	local wy = 50&lt;br /&gt;
	gearLabel = guiCreateLabel(((sx/2)-wx),(sy-wy),wx,wy,&amp;quot;5&amp;quot;,false)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onRender()&lt;br /&gt;
	g_vehicle = getPedOccupiedVehicle(g_player)&lt;br /&gt;
	if g_vehicle then&lt;br /&gt;
		g_curGear = tostring(getVehicleCurrentGear(g_vehicle))&lt;br /&gt;
		guiSetText(gearLabel,g_curGear)&lt;br /&gt;
	else&lt;br /&gt;
		guiSetText(gearLabel,&amp;quot;&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
makeGearGui()&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;,g_root,onRender)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerConnect&amp;diff=23601</id>
		<title>OnPlayerConnect</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerConnect&amp;diff=23601"/>
		<updated>2010-06-04T12:56:48Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when a player attempts to connect to the server.&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 playerNick, string playerIP, string playerUsername, string playerSerial, int playerVersion&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''playerNick''': The player's current nickname.&lt;br /&gt;
*'''playerIP''': The player's current IP.&lt;br /&gt;
*'''playerUsername''': The player's community username.&lt;br /&gt;
*'''playerSerial''': The player's serial number.&lt;br /&gt;
''Extra parameter from 1.0.2 onwards:''&lt;br /&gt;
*'''playerVersion''': The player's MTA version in pure numerical form, e.g. ''''256'''' for 1.0, ''''257'''' for 1.0.1, etc.&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
If this event is [[Event system#Canceling|canceled]], the player will be disconnected with an error message saying the reason specified in cancelEvent or &amp;quot;Disconnected: server refused the connection&amp;quot; if none was specified.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
This example cancels connection attempts of people who use the nick &amp;quot;Player&amp;quot; or outputs some data about the connecting player otherwise.&lt;br /&gt;
&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--when a player connects&lt;br /&gt;
function playerConnect (playerNick, playerIP, playerUsername, playerSerial, playerVersion)&lt;br /&gt;
    if playerNick == &amp;quot;Player&amp;quot; then --check if his nick is &amp;quot;Player&amp;quot;&lt;br /&gt;
        cancelEvent(true,&amp;quot;The nick \&amp;quot;Player\&amp;quot; is not allowed, please change it to something else. You can change your nick in Settings menu Multiplayer tab.&amp;quot;) --in that case refuse the connection&lt;br /&gt;
    else&lt;br /&gt;
        --output some data about the player&lt;br /&gt;
        outputChatBox (playerNick..&amp;quot; just connected to the server.&amp;quot;)&lt;br /&gt;
        outputChatBox (&amp;quot;IP: &amp;quot;..playerIP..&amp;quot; Username: &amp;quot;..playerUsername..&amp;quot; Serial: &amp;quot;..playerSerial)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--add the playerConnect function as a handler for onPlayerConnect&lt;br /&gt;
addEventHandler (&amp;quot;onPlayerConnect&amp;quot;, getRootElement(), playerConnect)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&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 cancels connection if player uses older MTA (older than 1.0.3)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerConnect&amp;quot;, getRootElement(),&lt;br /&gt;
    function ( _,_,_,_, clientVersion )&lt;br /&gt;
        if ( clientVersion &amp;lt; 259 ) then&lt;br /&gt;
            cancelEvent( true, &amp;quot;Update your MTA before you join this server!&amp;quot; );&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
{{See also/Server event|Player events}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Known_Issues_-_FAQ&amp;diff=23496</id>
		<title>Known Issues - FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Known_Issues_-_FAQ&amp;diff=23496"/>
		<updated>2010-05-15T16:07:49Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Halt after MTA splash screen */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Post here your proposed Q&amp;amp;A, regarding the known problems with MTA:SA and their solutions, especially the problems we are encountering now, that might be also encountered by users in the final release. You're also welcome to edit them grammar/style wise.&lt;br /&gt;
&lt;br /&gt;
[[Resource:Editor#FAQ|Map editor FAQ/known issues can be found here.]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[MTA 0.5 Known Issues|Known issues for MTA 0.5 can be found here.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Client ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
==== I have the Steam version of GTA San Andreas.  How can I play MTASA? ====&lt;br /&gt;
The Steam version of GTASA is current incompatible with MTASA.  However, by following a few simple steps, the Steam version can be made to work:&lt;br /&gt;
* Find a '''GTA SA 1.00 No CD''' (Google will give useful results).  You should obtain a 1.00 Cracked/NoCd EXE, not a Disc image.  Any HOODLUM release will work fine.&lt;br /&gt;
* Open the download with Winrar or other similar archive tools, and inside there should be a gta_sa.exe.  Place this file inside your installation directory.  This is normally '''C:\Program Files\Steam\steamapps\common\grand theft auto san andreas'''.  No files need to be replaced during this process.&lt;br /&gt;
&lt;br /&gt;
This procedure will not affect your Steam version of GTASA, but will allow MTASA to boot alongside it.&lt;br /&gt;
&lt;br /&gt;
==== Does MTASA work with v1.01 or v2.00 of GTA San Andreas? ====&lt;br /&gt;
No. It can be made to work with them however - please see [http://forum.multitheftauto.com/viewtopic.php?t=15151 this forum topic] for instructions on patching the exe.&lt;br /&gt;
&lt;br /&gt;
==== Initial black screen/hanging GTA splash screens ====&lt;br /&gt;
* '''MTA shows a permanent black screen or hanging GTA splash screens.'''&lt;br /&gt;
&lt;br /&gt;
It may be necessary that during/after the logo splash screens in Grand Theft Auto you have to give some input in order to skip the videos correctly. Try to click your left-mouse button a few times, or tapping a few keys.&lt;br /&gt;
&lt;br /&gt;
* '''MTA shows a permanent black screen after the GTA splash screens (possibly with text in the bottom right corner).'''&lt;br /&gt;
&lt;br /&gt;
This can be related to a lack of support for DirectX or video card features, on your system, which are needed to run the dynamically rendered menu. This dynamic menu is enabled by default. You can disable it by opening your [[coreconfig.xml]] configuration file located in the ''GTA San Andreas\MTA'' directory, and changing the value of ''menu_options'' to ''248''.&lt;br /&gt;
&lt;br /&gt;
==== Halt after MTA splash screen ====&lt;br /&gt;
* '''Nothing happens after the 'Stop playing with yourself' splash screen'''&lt;br /&gt;
&lt;br /&gt;
If you use nVidia GeForce, try turning off nView Desktop Manager before starting MTA.&lt;br /&gt;
&lt;br /&gt;
Also try deleting GTA San Andreas settings file (&amp;quot;gta_sa.set&amp;quot;) in &amp;quot;Documents\GTA San Andreas User Files&amp;quot; folder.&lt;br /&gt;
&lt;br /&gt;
If it all fails and you run Kaspersky Anti-Virus or Internet Security, make sure status of &amp;quot;multi theft auto.exe&amp;quot; in not restricted. Other anti-virus software may block MTA from running.&lt;br /&gt;
&lt;br /&gt;
==== Crash after MTA splash screen ====&lt;br /&gt;
* '''MTA crashes after the 'Stop playing with yourself' logo. Both single player and the MTA: Race ran fine before.'''&lt;br /&gt;
&lt;br /&gt;
Try downloading the latest DirectX Runtime files from [http://www.microsoft.com/downloads/details.aspx?FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&amp;amp;DisplayLang=en Microsoft]. Also check in Task Manager, if gta_sa.exe process isn't already running.&lt;br /&gt;
&lt;br /&gt;
If you run at any substandard resolutions (e.g. 960x720), try to change your resolution to a commonly supported one (e.g. 640×480, 800×600, 1024×768, 1152×864, 1280×1024) by launching Grand Theft Auto: San Andreas in normal mode, setting the new resolution and exiting.&lt;br /&gt;
&lt;br /&gt;
If you are a user of Windows Vista or Windows 7, try the following:&lt;br /&gt;
* Enable Windows XP SP3 compatiblity mode for both Multi Theft Auto.exe and gta_sa.exe, setting their privilege level to &amp;quot;Run this program as an administrator&amp;quot;.&lt;br /&gt;
* Configure Data Execution Prevention: Use the setting ''Turn DEP for all programs and services except those I select''.  Click ''add'' and find &amp;quot;Multi Theft Auto.exe&amp;quot; and &amp;quot;gta_sa.exe&amp;quot; and add them.&lt;br /&gt;
* Run MTASA as administrator.&lt;br /&gt;
&lt;br /&gt;
==== You receive an error stating &amp;quot;San Andreas data files have been modified&amp;quot; ====&lt;br /&gt;
&lt;br /&gt;
You can fix this by downloading [http://community.mtasa.com/data.zip this archive] and extracting it into your Grand Theft Auto San Andreas\data directory. Make sure to replace '''all''' files. If that doesn't work, try reinstalling GTA San Andreas.&lt;br /&gt;
&lt;br /&gt;
==== Assertion in CMainMenu.cpp line 106 upon launching MTASA  ====&lt;br /&gt;
* '''I'm getting an assertion in CMainMenu.cpp (line 106) after I have launched MTASA. I'm able to ignore it, but then game crashes after I try to connect to a server.'''&lt;br /&gt;
&lt;br /&gt;
This is likely caused by GTASA or MTA:SA being installed in a path that contains non-ASCII characters (eg. Cyrillic, Polish, Japanese) in it.  &lt;br /&gt;
&lt;br /&gt;
To resolve this, you need to uninstall MTA:SA and GTASA, then install them in such paths that don't contain such characters.&lt;br /&gt;
&lt;br /&gt;
==== Crash after connecting to any server ====&lt;br /&gt;
* '''MTASA crashes upon connecting to any server. Single player runs fine.'''&lt;br /&gt;
&lt;br /&gt;
Single player mods can affect the way MTA:SA works, potentially causing crashes - you should always use a clean GTASA install for MTA:SA.&lt;br /&gt;
&lt;br /&gt;
This might also occur on non-modded installs, when your GTASA executable is in an unsupported by MTA:SA version (eg. 1.0 German or Australian). To resolve this, use [http://forum.multitheftauto.com/viewtopic.php?f=89&amp;amp;t=15151 our converter].&lt;br /&gt;
&lt;br /&gt;
==== Controls not working ====&lt;br /&gt;
* '''My controls don't seem to work as they should.'''&lt;br /&gt;
&lt;br /&gt;
Try using the 'copygtacontrols' command in the console.&lt;br /&gt;
&lt;br /&gt;
==== Incorrect models ====&lt;br /&gt;
* '''Woman model's breasts look awkward ingame / I'm seeing odd, spider-like shaped player models.'''&lt;br /&gt;
&lt;br /&gt;
This is caused by the way GTA handles player stats. To fix this, be sure to set both fat and muscles player stats to 0, when you're changing player skin.&lt;br /&gt;
&lt;br /&gt;
==== Incorrect drive-by functionality ====&lt;br /&gt;
* '''Drivebys arent working as they should'''&lt;br /&gt;
&lt;br /&gt;
Drivebys are handled by script, and will change depending on the loaded gamemode.&lt;br /&gt;
&lt;br /&gt;
==== Unsaved settings ====&lt;br /&gt;
* '''My MTA setting(s) didn't get saved (...) I crashed.'''&lt;br /&gt;
&lt;br /&gt;
First, configure the MTA the way you want to, then exit the game and launch it again. Settings should get saved. Alternatively, try removing the coreconfig.xml file, then configure it and quit the game.&lt;br /&gt;
&lt;br /&gt;
==== Gamepad support ====&lt;br /&gt;
* '''MTA doesn't recognise my gamepad'''&lt;br /&gt;
&lt;br /&gt;
Ensure that your controller is the first controller recognised by Windows (MTA will only use the first controller).  You can configure your gamepad in options in MTASA's main menu.&lt;br /&gt;
&lt;br /&gt;
==== Free mouselook not working properly ====&lt;br /&gt;
* '''MTA doesnt recognise my mouse'''&lt;br /&gt;
&lt;br /&gt;
Some people got problems with their mouse in MTA. They can use it in the menu, connect to a server, but they can't use the mouse for free look.&lt;br /&gt;
This problem can be solved by entering a server, click your Win/Windows key at your keyboard once, and then click your mouse.&lt;br /&gt;
If that doesn't work try starting GTA in Singleplayer, go to options &amp;gt; controler setup and set &amp;quot;Configuration&amp;quot; to &amp;quot;Mouse + Keys&amp;quot; instead of &amp;quot;Joypad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Server browser not working ====&lt;br /&gt;
* '''The in-game server browser shows &amp;quot;Loading&amp;quot; but does not come up with any servers'''&lt;br /&gt;
&lt;br /&gt;
Depending on the type and status of the internet connection you are using, it can take up to a few seconds for the server browser to retrieve all the servers. Please wait a little longer for the results to appear.&lt;br /&gt;
&lt;br /&gt;
If all else fails, you can logon to [http://www.game-monitor.com/search.php?game=mta GameMonitor], and click the green play icon to play on that server.&lt;br /&gt;
&lt;br /&gt;
==== Invalid serial number ====&lt;br /&gt;
* '''I am getting an 'Invalid serial number' error when trying to launch or play the game'''&lt;br /&gt;
&lt;br /&gt;
You are running an outdated version of Multi Theft Auto. Head over to the [http://mtasa.com/ main page] and download the latest version of Multi Theft Auto.&lt;br /&gt;
&lt;br /&gt;
==== 'Network module could not be located' ====&lt;br /&gt;
* '''I am getting 'Network module could not be located' error message upon launching MTA:SA&lt;br /&gt;
&lt;br /&gt;
Copy the file 'net.dll' from your GTA:SA/mta directory into your GTA:SA directory, overwriting existing files.&lt;br /&gt;
&lt;br /&gt;
==== 'Network module not compatible!' on MTA:SA launch ====&lt;br /&gt;
* '''I am getting 'Network module not compatible!' error message upon launching MTA:SA&lt;br /&gt;
&lt;br /&gt;
This could mean that your MTA:SA install is incomplete or broken. Reinstall it.&lt;br /&gt;
&lt;br /&gt;
==== 'No such mod installed (deathmatch)' ====&lt;br /&gt;
* '''I am getting a 'No such mod installed (deathmatch)' error message when trying to connect to any server&lt;br /&gt;
&lt;br /&gt;
'''Option 1:''' Simply re-install MTA. &amp;lt;br&amp;gt;&lt;br /&gt;
'''Option 2:''' Run both gta_sa.exe and Multi Theft Auto.exe with administrator privileges.&lt;br /&gt;
&lt;br /&gt;
==== D3dx9_**.dll is not found ====&lt;br /&gt;
* '''When I start Multi Theft Auto: San Andreas I am getting an error D3dx9_**.dll (** = a number) cannot be found.&lt;br /&gt;
&lt;br /&gt;
This means that DirectX 9 is not installed or not up to date.&lt;br /&gt;
To install/update DirectX download the [http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3 DirectX End-User Runtime Web Installer] from the Microsoft download site.&lt;br /&gt;
&lt;br /&gt;
=== Windows Vista®-related ===&lt;br /&gt;
&lt;br /&gt;
==== Crash on connect ====&lt;br /&gt;
* '''I seem to crash whenever I connect to a server just before I go in-game on Vista'''&lt;br /&gt;
&lt;br /&gt;
This seems to be an issue with the Microsoft DirectX April 2006 SDK Redistributable DLL file (d3dx9_30.dll) when running in compatibility mode. Please make sure that compatibility mode is competely turned off for  '''both''' your GTA_SA.exe and Multi Theft Auto.exe executables.&lt;br /&gt;
&lt;br /&gt;
==== Clock manipulation error ====&lt;br /&gt;
* '''I am getting 'Clock manipulation detected!' error message upon launching MTA:SA&lt;br /&gt;
&lt;br /&gt;
This is caused by incorrect system date/time being set (which could be a result of wrong settings or a faulty battery on the pc's motherboard). Setting time and date again should fix the problem.&lt;br /&gt;
&lt;br /&gt;
It might also happen if you are using an AMD Athlon 64 X2 processor with some old drivers. Update them at [http://support.amd.com/us/Pages/drivers.aspx AMD's site].&lt;br /&gt;
&lt;br /&gt;
==== Halt on launch ====&lt;br /&gt;
* '''When I launch MTA:SA, nothing happens (GTA_SA.exe is running but not loading up)&lt;br /&gt;
&lt;br /&gt;
Run MTA:SA with Administrator privileges. To do this, right click on the installer executable, choose 'Properties', go into 'Compatibility' tab and tick the check box on the last field and try again.&lt;br /&gt;
&lt;br /&gt;
==== General GTA problems ====&lt;br /&gt;
* '''I have unexplainable GTA problems or crashes'''&lt;br /&gt;
&lt;br /&gt;
Make sure your computer as well as your GTA install meet the [[Deathmatch_Client_Manual#System_requirements|minimum requirements]] and that you are not running in any 98/2000/XP/2003 compatibility modes.&lt;br /&gt;
&lt;br /&gt;
Also try the solutions from these pages:&lt;br /&gt;
* http://www.gtaforums.com/index.php?showtopic=273549&amp;amp;view=findpost&amp;amp;p=4537502&lt;br /&gt;
* http://pullmonkey.com/2007/4/30/how-i-got-gta-san-andreas-to-work-with-a-crappy-os-vista&lt;br /&gt;
&lt;br /&gt;
== Server ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
==== Fatal error 3 ====&lt;br /&gt;
* '''I'm getting ''Fatal Error 3'' whenever I connect to my server'''&lt;br /&gt;
&lt;br /&gt;
This error happens when the server you are trying to connect to is unable to provide you the required downloads, because it does not have http downloading enabled. Be sure to set the '''httpdownload''' configuration tag in your configuration to '''1'''.&lt;br /&gt;
==== Download error 9: Error downloading requested files ====&lt;br /&gt;
* '''I'm getting ''Download Error 9: Error downloading requested files'' whenever I connect to my server'''&lt;br /&gt;
&lt;br /&gt;
This error happens when the server you are trying to connect to is unable to provide you with a valid link. This results in a 404 (Not found) HTTP error and an error at your end.&lt;br /&gt;
&lt;br /&gt;
* If you are running the built-in server ('''httpserver''' is set to '''1''' and '''httpdownloadurl''' is empty), make sure that your HTTP server is accessible (you can try to access it by using a browser) for everyone.&lt;br /&gt;
&lt;br /&gt;
* If you have configured an external web server ('''httpdownloadurl''' is set to your custom URL), make sure that your HTTP is accessible and make sure you have read the [[Deathmatch_Server_Manual#Configuring_an_external_web_server | Configuring an external web server]] guide.&lt;br /&gt;
==== Download error 28 ====&lt;br /&gt;
Try closing anti-virus or firewall applications. If it then works, try adding an exception to your firewall to allow your http port through.&lt;br /&gt;
&lt;br /&gt;
=== Windows-related ===&lt;br /&gt;
No known reported issues in the version {{Current Version|full}}.&lt;br /&gt;
&lt;br /&gt;
=== Linux-related ===&lt;br /&gt;
====Default nohup creates infinitely big nohup.out====&lt;br /&gt;
&lt;br /&gt;
Temporary fix, disable the nohup file: 'nohup ./mta_server &amp;gt; /dev/null &amp;amp;'&lt;br /&gt;
&lt;br /&gt;
[[es:Problemas Conocidos - FAQ]]&lt;br /&gt;
[[it:Bugs noti e FAQ]]&lt;br /&gt;
[[ru:Known Issues - FAQ]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:50p&amp;diff=23014</id>
		<title>User:50p</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:50p&amp;diff=23014"/>
		<updated>2010-04-24T00:59:05Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Tools / Programming ==&lt;br /&gt;
[[MTASE|MTA:Script Editor]] - From scripters for scripters. As its name says, it's a script editor with many features that are designed only for creating resources for MTA:SA.&lt;br /&gt;
&lt;br /&gt;
[http://forum.multitheftauto.com/viewtopic.php?f=108&amp;amp;t=27406| MTA:SA Map Exporter (3DS MAXScript)] - Script for 3DS Max to let you generate files required for MTA:SA custom maps.&lt;br /&gt;
&lt;br /&gt;
[http://forum.mtasa.com/viewtopic.php?f=91&amp;amp;t=22247| Meta.xml generator] - Easy to use and helps to understand what MTA's meta.xml files are for.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=5| Speedometer] - Nice looking digital speedometer. 1st speedometer for MTA. 1 of the top downloaded resource.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=8| Speedometer (with needle)] - 1st needle speedometer! (WARNING! May freeze your PC for loading time)&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=38| Welcome window] - Simple &amp;quot;Welcome&amp;quot; window with a logo at the top. Can be used as &amp;quot;Accept the rules if you want to play&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=54| Bank System] - One and the only bank system out there released to public. One of the most downloaded resource!&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=124| Show position] - Its first objective was to show your current position at the bottom of the screen. Then it evolved. It lets you save coordinates with simple command: &amp;quot;// &amp;lt;comment&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=127| Got hit!] - Have you played FPS games? Have you noticed some on screen effects when you get hit? This script creates the &amp;quot;hit effect&amp;quot; on screen when you get hit. Parts of the screen go red depending on the direction from which you got hit.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=169| Mod Shop] - One and the only modification shop for your vehicles. Let you players modify their vehicles like they used to do in Single-Player&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=186| Chatbox Ads] - Do you want to show ads in chatbox? Do you want to advert your other server? Simply, use this easy to use script.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=202| Anti-Flood/Spam] - Have you had problems with chatbox spammers? Use this script and stop them from flooding your chatbox again. Easy to use with a few settings.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=234| Peds!!] - Sample ped script. Creates a ped which can follow you. It also gives them health bar which you can disable if you want to.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=241| GUI Library] - Creating GUI elements hasn't been easier. Make your scripts clean, easy to read. GUI event handling is much easier.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=427| Need for Speed-like NOS] - Did you enjoy the nitro in Need for Speed (hold button to use, release to stop)? Then that's what you are looking for. This script allows you to control how much NOS you use.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=623| Save'n'Load] - &amp;quot;Save and Load&amp;quot; - Bookmark your locations and go straight there with just 2 buttons. Ctrl + [0-9] to save your current position. Alt + [0-9] to load previously bookmarked location.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ART (3D modelling) ==&lt;br /&gt;
http://y50p.deviantart.com/ - Find some of my 3D work there.&lt;br /&gt;
&lt;br /&gt;
== Youtube ==&lt;br /&gt;
http://www.youtube.com/user/y50p - Watch all my videos there.&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:50p&amp;diff=23012</id>
		<title>User:50p</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:50p&amp;diff=23012"/>
		<updated>2010-04-24T00:54:06Z</updated>

		<summary type="html">&lt;p&gt;50p: Created page with '__TOC__  == Tools / Programming == MTA:Script Editor - From scripters for scripters. As its name says, it's a script editor with many features that are designed only fo…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Tools / Programming ==&lt;br /&gt;
[[MTASE|MTA:Script Editor]] - From scripters for scripters. As its name says, it's a script editor with many features that are designed only for creating resources for MTA:SA.&lt;br /&gt;
&lt;br /&gt;
[http://forum.multitheftauto.com/viewtopic.php?f=108&amp;amp;t=27406| MTA:SA Map Exporter (3DS MAXScript)] - Script for 3DS Max to let you generate files required for MTA:SA custom maps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=5| Speedometer] - Nice looking digital speedometer. 1st speedometer for MTA. 1 of the top downloaded resource.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=8| Speedometer (with needle)] - 1st needle speedometer! (WARNING! May freeze your PC for loading time)&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=38| Welcome window] - Simple &amp;quot;Welcome&amp;quot; window with a logo at the top. Can be used as &amp;quot;Accept the rules if you want to play&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=54| Bank System] - One and the only bank system out there released to public. One of the most downloaded resource!&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=124| Show position] - Its first objective was to show your current position at the bottom of the screen. Then it evolved. It lets you save coordinates with simple command: &amp;quot;// &amp;lt;comment&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=127| Got hit!] - Have you played FPS games? Have you noticed some on screen effects when you get hit? This script creates the &amp;quot;hit effect&amp;quot; on screen when you get hit. Parts of the screen go red depending on the direction from which you got hit.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=169| Mod Shop] - One and the only modification shop for your vehicles. Let you players modify their vehicles like they used to do in Single-Player&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=186| Chatbox Ads] - Do you want to show ads in chatbox? Do you want to advert your other server? Simply, use this easy to use script.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=202| Anti-Flood/Spam] - Have you had problems with chatbox spammers? Use this script and stop them from flooding your chatbox again. Easy to use with a few settings.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=234| Peds!!] - Sample ped script. Creates a ped which can follow you. It also gives them health bar which you can disable if you want to.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=241| GUI Library] - Creating GUI elements hasn't been easier. Make your scripts clean, easy to read. GUI event handling is much easier.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=427| Need for Speed-like NOS] - Did you enjoy the nitro in Need for Speed (hold button to use, release to stop)? Then that's what you are looking for. This script allows you to control how much NOS you use.&lt;br /&gt;
&lt;br /&gt;
[http://community.mtasa.com/index.php?p=resources&amp;amp;s=details&amp;amp;id=623| Save'n'Load] - &amp;quot;Save and Load&amp;quot; - Bookmark your locations and go straight there with just 2 buttons. Ctrl + [0-9] to save your current position. Alt + [0-9] to load previously bookmarked location.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ART (3D modelling) ==&lt;br /&gt;
http://y50p.deviantart.com/ - Find some of my 3D work there.&lt;br /&gt;
&lt;br /&gt;
== Youtube ==&lt;br /&gt;
http://www.youtube.com/user/y50p - Watch all my videos there.&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsTimer&amp;diff=22886</id>
		<title>IsTimer</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsTimer&amp;diff=22886"/>
		<updated>2010-04-16T19:59:34Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function checks if a variable is a [[timer]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server and client&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;bool isTimer ( var theVariable )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theVariable''': The variable that we want to check.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the passed value is a timer, ''false'' otherwise.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example uses isTimer to prevent players from using chat/teamchat/me more than once a second, to prevent spammers.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This anti spam is just an example and won't work if you have other scripts and game modes which manipulate chat,&lt;br /&gt;
-- If you do then this script would need to be put with the other script/gamemode that handles chat else cancelEvent() won't work.&lt;br /&gt;
&lt;br /&gt;
antiSpam = {} -- This makes a table called antiSpam&lt;br /&gt;
function antiChatSpam() -- The function that the event has called. Will stop all mainchat/teamchat/me spam.&lt;br /&gt;
	if isTimer(antiSpam[source]) then -- Check if timer is running using isTimer (this is an example of its use and all)&lt;br /&gt;
		cancelEvent()  -- If timer is running then cancel the event&lt;br /&gt;
		outputChatBox(&amp;quot;Sorry mate, you may only send 1 message a second to prevent spam.&amp;quot;, source, 255, 255, 0) -- Message to player&lt;br /&gt;
	else&lt;br /&gt;
		antiSpam[source] = setTimer(function(source) antiSpam[source] = nil end, 1000, 1, source) -- Timer lasting 1 second.&lt;br /&gt;
		-- The &amp;quot;function(source) antiSpam[source] = nil end&amp;quot; should clear the player from table after 1 second so he can chat again. &lt;br /&gt;
                -- antiSpam[source] = setTimer(... is using the table to bind that player to the timer.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerChat&amp;quot;, root, antiChatSpam) -- Event we're using, don't waste your time with getRootElement() (root is the same)&lt;br /&gt;
-- You now have an antispam to prevent people super spamming your chatbox!&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>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=StopResource&amp;diff=22868</id>
		<title>StopResource</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=StopResource&amp;diff=22868"/>
		<updated>2010-04-12T15:32:32Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function stops a running resource.&amp;lt;br&amp;gt;&lt;br /&gt;
'''Note:''' This function does not stop the resource immediately, so don't expect that it starts stopping until the [[onResourceStop]] event for that resource is triggered. This happens after the scripts are done executing for this server frame.&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 stopResource ( resource theResource )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theResource:''' the [[resource]] that should be stopped.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the resource was stopped, ''false'' if the stopping failed, or an invalid resource was passed.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This function stops all running resources except the current one.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function stopAllResources()&lt;br /&gt;
    -- we store a table of resources&lt;br /&gt;
    local allResources = getResources()&lt;br /&gt;
    -- for each one of them,&lt;br /&gt;
    for i, resource in ipairs(allResources) do&lt;br /&gt;
        -- if it's running, and it is not the current resource&lt;br /&gt;
        if ( getResourceState(resource) == &amp;quot;running&amp;quot; ) and ( resource ~= getThisResource() ) then&lt;br /&gt;
            -- then stop it&lt;br /&gt;
            stopResource(resource)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Resource_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=22397</id>
		<title>MTASE</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=22397"/>
		<updated>2010-02-10T21:18:23Z</updated>

		<summary type="html">&lt;p&gt;50p: /*Problems with loading some resources (meta.xml)*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;float: right; border-collapse: collapse; width: 270px&amp;quot;&lt;br /&gt;
|[[Image:MTASElogo_wiki.png]]&lt;br /&gt;
|}&lt;br /&gt;
{{TOClimit|1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Intoduction==&lt;br /&gt;
MTA Script Editor is a tool for Lua scripters. What we are aiming for is to speed up process of developing resources. We thought that process of creating new resources and testing them is, let's be honest... a pain in the ass. Management of the resources is a bit annoying sometimes. For instance, if you want to add a new script file to your resource you have to create it and add path to it into meta.xml, it happens that you forget about adding the file to meta.xml and you end up being surprised that your script didn't work at all. We wanted to do something that would speed this up so you could add a new file within a few seconds. If you use custom sounds, you can preview them within Script Editor just by double-clicking it in the resource explorer. We are aiming for something that reminds Visual Studio IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Things the tool offers==&lt;br /&gt;
We have been working on this tool for long but we had a long break due to lack of time and now I'm the only one working on this because education is more important than &amp;quot;having nice time&amp;quot;. Even though I'm working alone we are progressing smoothly. Currently we have implemented the followings:&lt;br /&gt;
&lt;br /&gt;
*Loading resources&lt;br /&gt;
*Easy resource management&lt;br /&gt;
*Preview sound files&lt;br /&gt;
*Preview image files&lt;br /&gt;
*Lua and XML syntax highlighting&lt;br /&gt;
*On-the-fly Lua syntax checker&lt;br /&gt;
*New resource wizard - allows you to create new resource with a few clicks&lt;br /&gt;
*Switching between resources&lt;br /&gt;
*C#'s #region-like grouping code - useful when working in teams and to keep the code clean&lt;br /&gt;
*Start/stop server and client&lt;br /&gt;
*Join your local server with 1 click&lt;br /&gt;
*Switch between game and Script Editor with only one key on the keyboard&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Screenshots==&lt;br /&gt;
*'''Main window''' - overall look of the application. On the right you can see a list of MTA functions. You can choose what functions you want to be displayed by changing item in the combo box above it. Are you going to ask what this &amp;quot;silly table&amp;quot; at the bottom of the window is doing? I knew it... It's the syntax checker. As you script the syntax is checked by Lua engine and outputs any errors you've made in the script. It speed up progress because you don't have to go into game and restart the resource to check if you fixed the syntax error. I made a little error on line 1 to show you how it looks:&lt;br /&gt;
[[Image:MTASEmainwnd.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''New resource wizard''' - create a resource with 5 simple steps (3 steps are optional):&lt;br /&gt;
[[Image:MTASEnewreswizard.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Sound player''' - preview sounds by double-clicking sound file in the resource explorer:&lt;br /&gt;
[[Image:MTASEsoundplayer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Image viewer''' - preview images by hovering you cursor over nodes in resource explorer:&lt;br /&gt;
[[Image:MTASEimageviewer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Suggested functions''' - a &amp;quot;window&amp;quot; similar to the one in Visual Studio showing a list of functions. It also shows a tooltip telling you what the function does and its parameters. It also contains all exported functions from every resource. You can add a 3 new attributes to your exported function tag in meta.xml to let Script Editor display descriptive tooltip, like on the screenshot:&lt;br /&gt;
**'''retval:''' return type (eg. bool, marker, int, etc.)&lt;br /&gt;
**'''params:''' list of parameters&lt;br /&gt;
**'''description:''' short description of the function[/list]&lt;br /&gt;
[[Image:MTSEsuggestedfuncs.png]]&lt;br /&gt;
:(screenshot show an example of exported function that in meta.xml looks like the following:)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;export function=&amp;quot;getBankMarkers&amp;quot; retval=&amp;quot;table&amp;quot; params=&amp;quot;void&amp;quot; description=&amp;quot;Returns a table containing all bank markers.&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''MTA Server Configuration''' - a window where you can change server's settings. You won't have to open mtaserver.conf and change the server settings, startup resources, adding modules, etc.&lt;br /&gt;
[[Image:MTASEserverconfig.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Customize syntax highlighter''' - you can customize many syntax highlighter properties&lt;br /&gt;
[[Image:MTASEcustomizesyntax.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Exported functions''' - you can view all exported functions from every resource&lt;br /&gt;
[[Image:MTASEfuncs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
As you can see we want to simplify resource development and it seems to look pretty nice but we are still in development. There are some good key features that would attract you as a scripter. While we are still in development we wanted to ask you what you think about this tool and what would you like to see included in the release (do not ask when! we do not know when). Any suggestions? You're welcome to suggest some features and if possible we will do our best to implement it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* To run this application you need to have .NET 2.0 Framework installed.&lt;br /&gt;
* You should be able to run it on Windows XP and Vista. Never tested on Windows 7.&lt;br /&gt;
* You must have both MTA Client and Server installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
To download the tool go to our thread on MTA forum [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 HERE]. That thread is updated frequently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error/Warning messages at startup===&lt;br /&gt;
&lt;br /&gt;
===File name: 'irrKlang.NET2.0, Version=1.1.3.0, Culture=neutral, PublicKeyToken=a854741bd80517c7' ---&amp;gt; System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)===&lt;br /&gt;
This message appears most likely for Windows XP/Vista '''64bit''' users. It may occur on 32bit OS if that machine doesn't have .NET 2.0 SP1 installed.&lt;br /&gt;
&lt;br /&gt;
There is only 1 known way to solve the problem...: Make sure you have .NET 2.0 SP1 installed, if you don't have it you can download it from [http://www.microsoft.com/Downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&amp;amp;displaylang=en Microsoft Download Center].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error parsing meta.xml===&lt;br /&gt;
The reason why this window comes up should be explained in the message. It's most likely that your meta.xml has the following XML declarations:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-16&amp;quot; ?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To solve the problem, simply open the file in WordPad or Notepad (Notepad++ may not solve the problem so use the Windows one), remove that line and save the changes.&lt;br /&gt;
&lt;br /&gt;
.NET 2.0 XML parser doesn't like not &amp;quot;well-formed&amp;quot; XML files, so you may get different messages with different meta.xml files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Not able to save file===&lt;br /&gt;
If you can't seem to be able to save a file that's probably because you created a new file and the file wasn't added to any resource. This is a bug and will be fixed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem with horizontal scrollbar===&lt;br /&gt;
If you have too long line and you paste some code on it, you may get a problem of not being able to scroll to the left (beginning of the line). This is problem with 3rd party library MTA:SE is using. It is not going to be fixed by its author (he's inactive for over 2 years now) and it's hard for us to find what is causing it. In fact, I was also given a link to another nice syntax highlighter library which I may use in the future. I hope this one doesn't have that problem.&lt;br /&gt;
If you encounter this problem there are a few ways to get to the beginning of the line.&lt;br /&gt;
* start highlighting this line so that caret moves to the left&lt;br /&gt;
* press Home key on your keyboard to move caret to the first character on a line&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problems with loading some resources (meta.xml)===&lt;br /&gt;
If you have problems with some resources not being loaded and you get message your resource will not be shown in Resource Explorer, there are few things you can do to fix it:&lt;br /&gt;
- Make sure your files in not encoded in Unicode (you can open it in Windows' Notepad and save the meta.xml with ANSI encoding, don't use Notepad++ for this task since it may not change file encoding at all).&lt;br /&gt;
- Make sure you don't have &amp;quot;&amp;amp;&amp;quot; (ampersand) sign anywhere in the file since it may cause meta.xml not being parsed correctly. This is caused by .NET Framework XML parser.&lt;br /&gt;
&lt;br /&gt;
Probably both of these can be fixed by changing/adding little piece of code but unfortunately I wasn't able to figure out what. If you know what can cause this parser error in C# .NET XML parser than don't hesitate and share this knowledge with me so I can fix this problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
We have an IRC channel on GTANet.com network which you can join, ask questions or even give suggestions. The channel name is #mtatools. You can also find us on [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 MTA forum]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Credits==&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p] - programmer &amp;amp; UI designer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=30686 Fenix1042] - programmer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=22437 Cazomino05] - xml files with mta functions and events&lt;br /&gt;
* MTA Developers - delivering the amazing GTA:SA multiplayer mod that has almost unlimited possibilities&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CSharp_SDK&amp;diff=22290</id>
		<title>CSharp SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CSharp_SDK&amp;diff=22290"/>
		<updated>2010-01-17T21:56:28Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
Many languages can make HTTP POST requests with JSON, C# can do too. This is C# SDK for MTA. It allows you to call any HTTP exported functions from resources. The SDK itself is very basic and easy to use. It was mainly created to extend [[MTASE|MTA:Script Editor]] functionality. Feel free to modify it however you like but don't remove original author. If you want your changes to be published, please speak to [[50p]] on MTA forums [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 HERE]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to==&lt;br /&gt;
First of all, you have to include your files in your project. Once you've done this, you are ready to use SDK.&lt;br /&gt;
&lt;br /&gt;
1. Add MTA_SDK.cs and MTA_LuaArgs.cs to your project file and import the SDK namespace in your file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;using MTA_SDK;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Create instance of MTA class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA server = new MTA();	//-- default params (for IP and port, respectively) are: &amp;quot;localhost&amp;quot; and 22005&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;//-- if you don't want to make a call to your local server then you can connect to remote server with the following parameters:&lt;br /&gt;
MTA server = new MTA( &amp;quot;IP&amp;quot;, port );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;//-- if you get errors about authorization then you should use the account you created on your server &lt;br /&gt;
//-- (the account that is allowed to visit HTTP sites of your server, preferably admin):&lt;br /&gt;
MTA server = new MTA( &amp;quot;IP&amp;quot;, port, &amp;quot;username&amp;quot;, &amp;quot;password&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Create instance of MTA_LuaArgs class to create list of arguments that is passed to the function call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA_LuaArgs luaArgs = new MTA_LuaArgs( );&lt;br /&gt;
luaArgs.AddValue( &amp;quot;hello&amp;quot; );&lt;br /&gt;
luaArgs.AddValue( &amp;quot;world&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA_LuaArgs luaArgs = new MTA_LuaArgs( &amp;quot;hello&amp;quot;, &amp;quot;world&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Call function exported from resource (in meta.xml: &amp;lt;export function=&amp;quot;functionName&amp;quot; http=&amp;quot;true&amp;quot; /&amp;gt;, REMEMBER! http attribute has to be true!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string returned = server.CallFunction( &amp;quot;sampleResource&amp;quot;, &amp;quot;functionName&amp;quot;, luaArgs );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And here is the sample Lua function (functionName) that we're trying to call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function functionName( param1, param2 )&lt;br /&gt;
	outputChatBox( &amp;quot;Function called from SDK with args: &amp;quot; .. param1 .. &amp;quot;, &amp;quot; .. param2 );&lt;br /&gt;
	return true;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
You can download C# MTA SDK here:&lt;br /&gt;
*[http://scripteditor.beta.mtasa.com/files/MTA_SDK_1.0.zip C# MTA SDK 1.0]&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
If you have any questions/suggestions you can contact author on MTA forum or IRC '''#mta''' and '''#mtatools''' channels hosted on GTANet.com server.&lt;br /&gt;
*[http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=22288</id>
		<title>MTASE</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=22288"/>
		<updated>2010-01-17T18:20:21Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Problem with horizontal scrollbar */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;float: right; border-collapse: collapse; width: 270px&amp;quot;&lt;br /&gt;
|[[Image:MTASElogo_wiki.png]]&lt;br /&gt;
|}&lt;br /&gt;
{{TOClimit|1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Intoduction==&lt;br /&gt;
MTA Script Editor is a tool for Lua scripters. What we are aiming for is to speed up process of developing resources. We thought that process of creating new resources and testing them is, let's be honest... a pain in the ass. Management of the resources is a bit annoying sometimes. For instance, if you want to add a new script file to your resource you have to create it and add path to it into meta.xml, it happens that you forget about adding the file to meta.xml and you end up being surprised that your script didn't work at all. We wanted to do something that would speed this up so you could add a new file within a few seconds. If you use custom sounds, you can preview them within Script Editor just by double-clicking it in the resource explorer. We are aiming for something that reminds Visual Studio IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Things the tool offers==&lt;br /&gt;
We have been working on this tool for long but we had a long break due to lack of time and now I'm the only one working on this because education is more important than &amp;quot;having nice time&amp;quot;. Even though I'm working alone we are progressing smoothly. Currently we have implemented the followings:&lt;br /&gt;
&lt;br /&gt;
*Loading resources&lt;br /&gt;
*Easy resource management&lt;br /&gt;
*Preview sound files&lt;br /&gt;
*Preview image files&lt;br /&gt;
*Lua and XML syntax highlighting&lt;br /&gt;
*On-the-fly Lua syntax checker&lt;br /&gt;
*New resource wizard - allows you to create new resource with a few clicks&lt;br /&gt;
*Switching between resources&lt;br /&gt;
*C#'s #region-like grouping code - useful when working in teams and to keep the code clean&lt;br /&gt;
*Start/stop server and client&lt;br /&gt;
*Join your local server with 1 click&lt;br /&gt;
*Switch between game and Script Editor with only one key on the keyboard&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Screenshots==&lt;br /&gt;
*'''Main window''' - overall look of the application. On the right you can see a list of MTA functions. You can choose what functions you want to be displayed by changing item in the combo box above it. Are you going to ask what this &amp;quot;silly table&amp;quot; at the bottom of the window is doing? I knew it... It's the syntax checker. As you script the syntax is checked by Lua engine and outputs any errors you've made in the script. It speed up progress because you don't have to go into game and restart the resource to check if you fixed the syntax error. I made a little error on line 1 to show you how it looks:&lt;br /&gt;
[[Image:MTASEmainwnd.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''New resource wizard''' - create a resource with 5 simple steps (3 steps are optional):&lt;br /&gt;
[[Image:MTASEnewreswizard.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Sound player''' - preview sounds by double-clicking sound file in the resource explorer:&lt;br /&gt;
[[Image:MTASEsoundplayer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Image viewer''' - preview images by hovering you cursor over nodes in resource explorer:&lt;br /&gt;
[[Image:MTASEimageviewer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Suggested functions''' - a &amp;quot;window&amp;quot; similar to the one in Visual Studio showing a list of functions. It also shows a tooltip telling you what the function does and its parameters. It also contains all exported functions from every resource. You can add a 3 new attributes to your exported function tag in meta.xml to let Script Editor display descriptive tooltip, like on the screenshot:&lt;br /&gt;
**'''retval:''' return type (eg. bool, marker, int, etc.)&lt;br /&gt;
**'''params:''' list of parameters&lt;br /&gt;
**'''description:''' short description of the function[/list]&lt;br /&gt;
[[Image:MTSEsuggestedfuncs.png]]&lt;br /&gt;
:(screenshot show an example of exported function that in meta.xml looks like the following:)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;export function=&amp;quot;getBankMarkers&amp;quot; retval=&amp;quot;table&amp;quot; params=&amp;quot;void&amp;quot; description=&amp;quot;Returns a table containing all bank markers.&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''MTA Server Configuration''' - a window where you can change server's settings. You won't have to open mtaserver.conf and change the server settings, startup resources, adding modules, etc.&lt;br /&gt;
[[Image:MTASEserverconfig.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Customize syntax highlighter''' - you can customize many syntax highlighter properties&lt;br /&gt;
[[Image:MTASEcustomizesyntax.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Exported functions''' - you can view all exported functions from every resource&lt;br /&gt;
[[Image:MTASEfuncs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
As you can see we want to simplify resource development and it seems to look pretty nice but we are still in development. There are some good key features that would attract you as a scripter. While we are still in development we wanted to ask you what you think about this tool and what would you like to see included in the release (do not ask when! we do not know when). Any suggestions? You're welcome to suggest some features and if possible we will do our best to implement it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* To run this application you need to have .NET 2.0 Framework installed.&lt;br /&gt;
* You should be able to run it on Windows XP and Vista. Never tested on Windows 7.&lt;br /&gt;
* You must have both MTA Client and Server installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
To download the tool go to our thread on MTA forum [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 HERE]. That thread is updated frequently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error/Warning messages at startup===&lt;br /&gt;
&lt;br /&gt;
===File name: 'irrKlang.NET2.0, Version=1.1.3.0, Culture=neutral, PublicKeyToken=a854741bd80517c7' ---&amp;gt; System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)===&lt;br /&gt;
This message appears most likely for Windows XP/Vista '''64bit''' users. It may occur on 32bit OS if that machine doesn't have .NET 2.0 SP1 installed.&lt;br /&gt;
&lt;br /&gt;
There is only 1 known way to solve the problem...: Make sure you have .NET 2.0 SP1 installed, if you don't have it you can download it from [http://www.microsoft.com/Downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&amp;amp;displaylang=en Microsoft Download Center].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error parsing meta.xml===&lt;br /&gt;
The reason why this window comes up should be explained in the message. It's most likely that your meta.xml has the following XML declarations:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-16&amp;quot; ?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To solve the problem, simply open the file in WordPad or Notepad (Notepad++ may not solve the problem so use the Windows one), remove that line and save the changes.&lt;br /&gt;
&lt;br /&gt;
.NET 2.0 XML parser doesn't like not &amp;quot;well-formed&amp;quot; XML files, so you may get different messages with different meta.xml files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Not able to save file===&lt;br /&gt;
If you can't seem to be able to save a file that's probably because you created a new file and the file wasn't added to any resource. This is a bug and will be fixed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem with horizontal scrollbar===&lt;br /&gt;
If you have too long line and you paste some code on it, you may get a problem of not being able to scroll to the left (beginning of the line). This is problem with 3rd party library MTA:SE is using. It is not going to be fixed by its author (he's inactive for over 2 years now) and it's hard for us to find what is causing it. In fact, I was also given a link to another nice syntax highlighter library which I may use in the future. I hope this one doesn't have that problem.&lt;br /&gt;
If you encounter this problem there are a few ways to get to the beginning of the line.&lt;br /&gt;
* start highlighting this line so that caret moves to the left&lt;br /&gt;
* press Home key on your keyboard to move caret to the first character on a line&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
We have an IRC channel on GTANet.com network which you can join, ask questions or even give suggestions. The channel name is #mtatools. You can also find us on [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 MTA forum]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Credits==&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p] - programmer &amp;amp; UI designer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=30686 Fenix1042] - programmer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=22437 Cazomino05] - xml files with mta functions and events&lt;br /&gt;
* MTA Developers - delivering the amazing GTA:SA multiplayer mod that has almost unlimited possibilities&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=22287</id>
		<title>MTASE</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=22287"/>
		<updated>2010-01-17T18:18:54Z</updated>

		<summary type="html">&lt;p&gt;50p: /* FAQ - horizontal scrollbar problem*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;float: right; border-collapse: collapse; width: 270px&amp;quot;&lt;br /&gt;
|[[Image:MTASElogo_wiki.png]]&lt;br /&gt;
|}&lt;br /&gt;
{{TOClimit|1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Intoduction==&lt;br /&gt;
MTA Script Editor is a tool for Lua scripters. What we are aiming for is to speed up process of developing resources. We thought that process of creating new resources and testing them is, let's be honest... a pain in the ass. Management of the resources is a bit annoying sometimes. For instance, if you want to add a new script file to your resource you have to create it and add path to it into meta.xml, it happens that you forget about adding the file to meta.xml and you end up being surprised that your script didn't work at all. We wanted to do something that would speed this up so you could add a new file within a few seconds. If you use custom sounds, you can preview them within Script Editor just by double-clicking it in the resource explorer. We are aiming for something that reminds Visual Studio IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Things the tool offers==&lt;br /&gt;
We have been working on this tool for long but we had a long break due to lack of time and now I'm the only one working on this because education is more important than &amp;quot;having nice time&amp;quot;. Even though I'm working alone we are progressing smoothly. Currently we have implemented the followings:&lt;br /&gt;
&lt;br /&gt;
*Loading resources&lt;br /&gt;
*Easy resource management&lt;br /&gt;
*Preview sound files&lt;br /&gt;
*Preview image files&lt;br /&gt;
*Lua and XML syntax highlighting&lt;br /&gt;
*On-the-fly Lua syntax checker&lt;br /&gt;
*New resource wizard - allows you to create new resource with a few clicks&lt;br /&gt;
*Switching between resources&lt;br /&gt;
*C#'s #region-like grouping code - useful when working in teams and to keep the code clean&lt;br /&gt;
*Start/stop server and client&lt;br /&gt;
*Join your local server with 1 click&lt;br /&gt;
*Switch between game and Script Editor with only one key on the keyboard&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Screenshots==&lt;br /&gt;
*'''Main window''' - overall look of the application. On the right you can see a list of MTA functions. You can choose what functions you want to be displayed by changing item in the combo box above it. Are you going to ask what this &amp;quot;silly table&amp;quot; at the bottom of the window is doing? I knew it... It's the syntax checker. As you script the syntax is checked by Lua engine and outputs any errors you've made in the script. It speed up progress because you don't have to go into game and restart the resource to check if you fixed the syntax error. I made a little error on line 1 to show you how it looks:&lt;br /&gt;
[[Image:MTASEmainwnd.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''New resource wizard''' - create a resource with 5 simple steps (3 steps are optional):&lt;br /&gt;
[[Image:MTASEnewreswizard.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Sound player''' - preview sounds by double-clicking sound file in the resource explorer:&lt;br /&gt;
[[Image:MTASEsoundplayer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Image viewer''' - preview images by hovering you cursor over nodes in resource explorer:&lt;br /&gt;
[[Image:MTASEimageviewer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Suggested functions''' - a &amp;quot;window&amp;quot; similar to the one in Visual Studio showing a list of functions. It also shows a tooltip telling you what the function does and its parameters. It also contains all exported functions from every resource. You can add a 3 new attributes to your exported function tag in meta.xml to let Script Editor display descriptive tooltip, like on the screenshot:&lt;br /&gt;
**'''retval:''' return type (eg. bool, marker, int, etc.)&lt;br /&gt;
**'''params:''' list of parameters&lt;br /&gt;
**'''description:''' short description of the function[/list]&lt;br /&gt;
[[Image:MTSEsuggestedfuncs.png]]&lt;br /&gt;
:(screenshot show an example of exported function that in meta.xml looks like the following:)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;export function=&amp;quot;getBankMarkers&amp;quot; retval=&amp;quot;table&amp;quot; params=&amp;quot;void&amp;quot; description=&amp;quot;Returns a table containing all bank markers.&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''MTA Server Configuration''' - a window where you can change server's settings. You won't have to open mtaserver.conf and change the server settings, startup resources, adding modules, etc.&lt;br /&gt;
[[Image:MTASEserverconfig.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Customize syntax highlighter''' - you can customize many syntax highlighter properties&lt;br /&gt;
[[Image:MTASEcustomizesyntax.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Exported functions''' - you can view all exported functions from every resource&lt;br /&gt;
[[Image:MTASEfuncs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
As you can see we want to simplify resource development and it seems to look pretty nice but we are still in development. There are some good key features that would attract you as a scripter. While we are still in development we wanted to ask you what you think about this tool and what would you like to see included in the release (do not ask when! we do not know when). Any suggestions? You're welcome to suggest some features and if possible we will do our best to implement it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* To run this application you need to have .NET 2.0 Framework installed.&lt;br /&gt;
* You should be able to run it on Windows XP and Vista. Never tested on Windows 7.&lt;br /&gt;
* You must have both MTA Client and Server installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
To download the tool go to our thread on MTA forum [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 HERE]. That thread is updated frequently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error/Warning messages at startup===&lt;br /&gt;
&lt;br /&gt;
===File name: 'irrKlang.NET2.0, Version=1.1.3.0, Culture=neutral, PublicKeyToken=a854741bd80517c7' ---&amp;gt; System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)===&lt;br /&gt;
This message appears most likely for Windows XP/Vista '''64bit''' users. It may occur on 32bit OS if that machine doesn't have .NET 2.0 SP1 installed.&lt;br /&gt;
&lt;br /&gt;
There is only 1 known way to solve the problem...: Make sure you have .NET 2.0 SP1 installed, if you don't have it you can download it from [http://www.microsoft.com/Downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&amp;amp;displaylang=en Microsoft Download Center].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error parsing meta.xml===&lt;br /&gt;
The reason why this window comes up should be explained in the message. It's most likely that your meta.xml has the following XML declarations:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-16&amp;quot; ?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To solve the problem, simply open the file in WordPad or Notepad (Notepad++ may not solve the problem so use the Windows one), remove that line and save the changes.&lt;br /&gt;
&lt;br /&gt;
.NET 2.0 XML parser doesn't like not &amp;quot;well-formed&amp;quot; XML files, so you may get different messages with different meta.xml files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Not able to save file===&lt;br /&gt;
If you can't seem to be able to save a file that's probably because you created a new file and the file wasn't added to any resource. This is a bug and will be fixed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem with horizontal scrollbar===&lt;br /&gt;
If you have too long line and you paste some code on it, you may get a problem of not being able to scroll to the left (beginning of the line). This is problem with 3rd party library MTA:SE is using. It is not going to be fixed by its author (he's inactive for over 2 years now) and it's hard for us to find what is causing it.&lt;br /&gt;
If you encounter this problem there are a few ways to get to the beginning of the line.&lt;br /&gt;
* start highlighting this line so that caret moves to the left&lt;br /&gt;
* press Home key on your keyboard to move caret to the first character on a line&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
We have an IRC channel on GTANet.com network which you can join, ask questions or even give suggestions. The channel name is #mtatools. You can also find us on [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 MTA forum]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Credits==&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p] - programmer &amp;amp; UI designer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=30686 Fenix1042] - programmer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=22437 Cazomino05] - xml files with mta functions and events&lt;br /&gt;
* MTA Developers - delivering the amazing GTA:SA multiplayer mod that has almost unlimited possibilities&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetGarageOpen&amp;diff=22009</id>
		<title>SetGarageOpen</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetGarageOpen&amp;diff=22009"/>
		<updated>2009-12-03T20:38:06Z</updated>

		<summary type="html">&lt;p&gt;50p: Undo revision 22008 by Dzakub (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function opens or closes the specified garage door in the world.&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 setGarageOpen ( int garageID, bool open )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''garageID:''' The [[Garage|garage ID]] that represents the garage door being opened or closed.&lt;br /&gt;
*'''isOpen:''' A boolean indicating whether or not to open the door.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' if an invalid garage id was given.&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 opens a garage door when a player enters a collision shape near it, and closes it when they leave:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
GARAGE_ID = 25&lt;br /&gt;
&lt;br /&gt;
-- create a collision shape and attach event handlers to it when the resource starts&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;, getResourceRootElement(getThisResource()),&lt;br /&gt;
function (resource)&lt;br /&gt;
	local garageCube = createColCube(1337, 194, 28, 6, 10, 4)&lt;br /&gt;
	addEventHandler(&amp;quot;onColShapeHit&amp;quot;, garageCube, onGarageCubeHit)&lt;br /&gt;
	addEventHandler(&amp;quot;onColShapeLeave&amp;quot;, garageCube, onGarageCubeLeave)&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
-- open the door when someone enters the garage's collision shape&lt;br /&gt;
function onGarageCubeHit(hitElement, matchingDimension)&lt;br /&gt;
	if (getElementType(hitElement) == &amp;quot;player&amp;quot;) then&lt;br /&gt;
		-- check to make sure the door is closed&lt;br /&gt;
		if (not isGarageOpen(GARAGE_ID)) then&lt;br /&gt;
			-- open the door&lt;br /&gt;
			setGarageOpen(GARAGE_ID, true)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- close the door when someone leaves the garage's collision shape&lt;br /&gt;
function onGarageCubeLeave(leaveElement, matchingDimension)&lt;br /&gt;
	if (getElementType(leaveElement) == &amp;quot;player&amp;quot;) then&lt;br /&gt;
		-- check to make sure the door is open&lt;br /&gt;
		if (isGarageOpen(GARAGE_ID)) then&lt;br /&gt;
			-- close the door&lt;br /&gt;
			setGarageOpen(GARAGE_ID, false)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{World functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=22007</id>
		<title>IsVehicleTaxiLightOn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsVehicleTaxiLightOn&amp;diff=22007"/>
		<updated>2009-12-02T12:16:18Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
[[Category:Needs_Example]]&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)&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 isVehicleTaxiLightOn ( vehicle taxi )              &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''taxi:''' The vehicle element of the taxi that you wish to get the light state of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the light is on, ''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 binds the 'o' key to a function that toggles the taxi's light on and off, if you're in a taxi.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function toggleTaxiLight()&lt;br /&gt;
	local thePlayer = getLocalPlayer()&lt;br /&gt;
	local theVehicle = getPedOccupiedVehicle(thePlayer)&lt;br /&gt;
	if thePlayer == getVehicleOccupant(theVehicle, 0) then -- if is a driver&lt;br /&gt;
		local id = getElementModel(theVehicle) -- getting vehicle model&lt;br /&gt;
		if ((id == 420) or (id== 438)) then -- if is a taxi&lt;br /&gt;
			local lights = isVehicleTaxiLightOn(theVehicle) -- getting vehicle lights state&lt;br /&gt;
			setVehicleTaxiLightOn(theVehicle, not lights) -- switch lights&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bindKey(&amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, toggleTaxiLight) -- binding the function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{vehicle functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=21987</id>
		<title>MTASE</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=21987"/>
		<updated>2009-11-29T13:14:59Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;float: right; border-collapse: collapse; width: 270px&amp;quot;&lt;br /&gt;
|[[Image:MTASElogo_wiki.png]]&lt;br /&gt;
|}&lt;br /&gt;
{{TOClimit|1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Intoduction==&lt;br /&gt;
MTA Script Editor is a tool for Lua scripters. What we are aiming for is to speed up process of developing resources. We thought that process of creating new resources and testing them is, let's be honest... a pain in the ass. Management of the resources is a bit annoying sometimes. For instance, if you want to add a new script file to your resource you have to create it and add path to it into meta.xml, it happens that you forget about adding the file to meta.xml and you end up being surprised that your script didn't work at all. We wanted to do something that would speed this up so you could add a new file within a few seconds. If you use custom sounds, you can preview them within Script Editor just by double-clicking it in the resource explorer. We are aiming for something that reminds Visual Studio IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Things the tool offers==&lt;br /&gt;
We have been working on this tool for long but we had a long break due to lack of time and now I'm the only one working on this because education is more important than &amp;quot;having nice time&amp;quot;. Even though I'm working alone we are progressing smoothly. Currently we have implemented the followings:&lt;br /&gt;
&lt;br /&gt;
*Loading resources&lt;br /&gt;
*Easy resource management&lt;br /&gt;
*Preview sound files&lt;br /&gt;
*Preview image files&lt;br /&gt;
*Lua and XML syntax highlighting&lt;br /&gt;
*On-the-fly Lua syntax checker&lt;br /&gt;
*New resource wizard - allows you to create new resource with a few clicks&lt;br /&gt;
*Switching between resources&lt;br /&gt;
*C#'s #region-like grouping code - useful when working in teams and to keep the code clean&lt;br /&gt;
*Start/stop server and client&lt;br /&gt;
*Join your local server with 1 click&lt;br /&gt;
*Switch between game and Script Editor with only one key on the keyboard&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Screenshots==&lt;br /&gt;
*'''Main window''' - overall look of the application. On the right you can see a list of MTA functions. You can choose what functions you want to be displayed by changing item in the combo box above it. Are you going to ask what this &amp;quot;silly table&amp;quot; at the bottom of the window is doing? I knew it... It's the syntax checker. As you script the syntax is checked by Lua engine and outputs any errors you've made in the script. It speed up progress because you don't have to go into game and restart the resource to check if you fixed the syntax error. I made a little error on line 1 to show you how it looks:&lt;br /&gt;
[[Image:MTASEmainwnd.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''New resource wizard''' - create a resource with 5 simple steps (3 steps are optional):&lt;br /&gt;
[[Image:MTASEnewreswizard.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Sound player''' - preview sounds by double-clicking sound file in the resource explorer:&lt;br /&gt;
[[Image:MTASEsoundplayer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Image viewer''' - preview images by hovering you cursor over nodes in resource explorer:&lt;br /&gt;
[[Image:MTASEimageviewer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Suggested functions''' - a &amp;quot;window&amp;quot; similar to the one in Visual Studio showing a list of functions. It also shows a tooltip telling you what the function does and its parameters. It also contains all exported functions from every resource. You can add a 3 new attributes to your exported function tag in meta.xml to let Script Editor display descriptive tooltip, like on the screenshot:&lt;br /&gt;
**'''retval:''' return type (eg. bool, marker, int, etc.)&lt;br /&gt;
**'''params:''' list of parameters&lt;br /&gt;
**'''description:''' short description of the function[/list]&lt;br /&gt;
[[Image:MTSEsuggestedfuncs.png]]&lt;br /&gt;
:(screenshot show an example of exported function that in meta.xml looks like the following:)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;export function=&amp;quot;getBankMarkers&amp;quot; retval=&amp;quot;table&amp;quot; params=&amp;quot;void&amp;quot; description=&amp;quot;Returns a table containing all bank markers.&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''MTA Server Configuration''' - a window where you can change server's settings. You won't have to open mtaserver.conf and change the server settings, startup resources, adding modules, etc.&lt;br /&gt;
[[Image:MTASEserverconfig.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Customize syntax highlighter''' - you can customize many syntax highlighter properties&lt;br /&gt;
[[Image:MTASEcustomizesyntax.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Exported functions''' - you can view all exported functions from every resource&lt;br /&gt;
[[Image:MTASEfuncs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
As you can see we want to simplify resource development and it seems to look pretty nice but we are still in development. There are some good key features that would attract you as a scripter. While we are still in development we wanted to ask you what you think about this tool and what would you like to see included in the release (do not ask when! we do not know when). Any suggestions? You're welcome to suggest some features and if possible we will do our best to implement it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* To run this application you need to have .NET 2.0 Framework installed.&lt;br /&gt;
* You should be able to run it on Windows XP and Vista. Never tested on Windows 7.&lt;br /&gt;
* You must have both MTA Client and Server installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
To download the tool go to our thread on MTA forum [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 HERE]. That thread is updated frequently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error/Warning messages at startup===&lt;br /&gt;
&lt;br /&gt;
===File name: 'irrKlang.NET2.0, Version=1.1.3.0, Culture=neutral, PublicKeyToken=a854741bd80517c7' ---&amp;gt; System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)===&lt;br /&gt;
This message appears most likely for Windows XP/Vista '''64bit''' users. It may occur on 32bit OS if that machine doesn't have .NET 2.0 SP1 installed.&lt;br /&gt;
&lt;br /&gt;
There is only 1 known way to solve the problem...: Make sure you have .NET 2.0 SP1 installed, if you don't have it you can download it from [http://www.microsoft.com/Downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&amp;amp;displaylang=en Microsoft Download Center].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Error parsing meta.xml===&lt;br /&gt;
The reason why this window comes up should be explained in the message. It's most likely that your meta.xml has the following XML declarations:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-16&amp;quot; ?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To solve the problem, simply open the file in WordPad or Notepad (Notepad++ may not solve the problem so use the Windows one), remove that line and save the changes.&lt;br /&gt;
&lt;br /&gt;
.NET 2.0 XML parser doesn't like not &amp;quot;well-formed&amp;quot; XML files, so you may get different messages with different meta.xml files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Not able to save file===&lt;br /&gt;
If you can't seem to be able to save a file that's probably because you created a new file and the file wasn't added to any resource. This is a bug and will be fixed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
We have an IRC channel on GTANet.com network which you can join, ask questions or even give suggestions. The channel name is #mtatools. You can also find us on [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 MTA forum]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Credits==&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p] - programmer &amp;amp; UI designer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=30686 Fenix1042] - programmer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=22437 Cazomino05] - xml files with mta functions and events&lt;br /&gt;
* MTA Developers - delivering the amazing GTA:SA multiplayer mod that has almost unlimited possibilities&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=21986</id>
		<title>MTASE</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MTASE&amp;diff=21986"/>
		<updated>2009-11-29T13:12:52Z</updated>

		<summary type="html">&lt;p&gt;50p: /* &amp;quot;Not able to save */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;float: right; border-collapse: collapse; width: 270px&amp;quot;&lt;br /&gt;
|[[Image:MTASElogo_wiki.png]]&lt;br /&gt;
|}&lt;br /&gt;
{{TOClimit|1}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Intoduction==&lt;br /&gt;
MTA Script Editor is a tool for Lua scripters. What we are aiming for is to speed up process of developing resources. We thought that process of creating new resources and testing them is, let's be honest... a pain in the ass. Management of the resources is a bit annoying sometimes. For instance, if you want to add a new script file to your resource you have to create it and add path to it into meta.xml, it happens that you forget about adding the file to meta.xml and you end up being surprised that your script didn't work at all. We wanted to do something that would speed this up so you could add a new file within a few seconds. If you use custom sounds, you can preview them within Script Editor just by double-clicking it in the resource explorer. We are aiming for something that reminds Visual Studio IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Things the tool offers==&lt;br /&gt;
We have been working on this tool for long but we had a long break due to lack of time and now I'm the only one working on this because education is more important than &amp;quot;having nice time&amp;quot;. Even though I'm working alone we are progressing smoothly. Currently we have implemented the followings:&lt;br /&gt;
&lt;br /&gt;
*Loading resources&lt;br /&gt;
*Easy resource management&lt;br /&gt;
*Preview sound files&lt;br /&gt;
*Preview image files&lt;br /&gt;
*Lua and XML syntax highlighting&lt;br /&gt;
*On-the-fly Lua syntax checker&lt;br /&gt;
*New resource wizard - allows you to create new resource with a few clicks&lt;br /&gt;
*Switching between resources&lt;br /&gt;
*C#'s #region-like grouping code - useful when working in teams and to keep the code clean&lt;br /&gt;
*Start/stop server and client&lt;br /&gt;
*Join your local server with 1 click&lt;br /&gt;
*Switch between game and Script Editor with only one key on the keyboard&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Screenshots==&lt;br /&gt;
*'''Main window''' - overall look of the application. On the right you can see a list of MTA functions. You can choose what functions you want to be displayed by changing item in the combo box above it. Are you going to ask what this &amp;quot;silly table&amp;quot; at the bottom of the window is doing? I knew it... It's the syntax checker. As you script the syntax is checked by Lua engine and outputs any errors you've made in the script. It speed up progress because you don't have to go into game and restart the resource to check if you fixed the syntax error. I made a little error on line 1 to show you how it looks:&lt;br /&gt;
[[Image:MTASEmainwnd.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''New resource wizard''' - create a resource with 5 simple steps (3 steps are optional):&lt;br /&gt;
[[Image:MTASEnewreswizard.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Sound player''' - preview sounds by double-clicking sound file in the resource explorer:&lt;br /&gt;
[[Image:MTASEsoundplayer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Image viewer''' - preview images by hovering you cursor over nodes in resource explorer:&lt;br /&gt;
[[Image:MTASEimageviewer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Suggested functions''' - a &amp;quot;window&amp;quot; similar to the one in Visual Studio showing a list of functions. It also shows a tooltip telling you what the function does and its parameters. It also contains all exported functions from every resource. You can add a 3 new attributes to your exported function tag in meta.xml to let Script Editor display descriptive tooltip, like on the screenshot:&lt;br /&gt;
**'''retval:''' return type (eg. bool, marker, int, etc.)&lt;br /&gt;
**'''params:''' list of parameters&lt;br /&gt;
**'''description:''' short description of the function[/list]&lt;br /&gt;
[[Image:MTSEsuggestedfuncs.png]]&lt;br /&gt;
:(screenshot show an example of exported function that in meta.xml looks like the following:)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;export function=&amp;quot;getBankMarkers&amp;quot; retval=&amp;quot;table&amp;quot; params=&amp;quot;void&amp;quot; description=&amp;quot;Returns a table containing all bank markers.&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''MTA Server Configuration''' - a window where you can change server's settings. You won't have to open mtaserver.conf and change the server settings, startup resources, adding modules, etc.&lt;br /&gt;
[[Image:MTASEserverconfig.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Customize syntax highlighter''' - you can customize many syntax highlighter properties&lt;br /&gt;
[[Image:MTASEcustomizesyntax.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*'''Exported functions''' - you can view all exported functions from every resource&lt;br /&gt;
[[Image:MTASEfuncs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
As you can see we want to simplify resource development and it seems to look pretty nice but we are still in development. There are some good key features that would attract you as a scripter. While we are still in development we wanted to ask you what you think about this tool and what would you like to see included in the release (do not ask when! we do not know when). Any suggestions? You're welcome to suggest some features and if possible we will do our best to implement it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* To run this application you need to have .NET 2.0 Framework installed.&lt;br /&gt;
* You should be able to run it on Windows XP and Vista. Never tested on Windows 7.&lt;br /&gt;
* You must have both MTA Client and Server installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
To download the tool go to our thread on MTA forum [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 HERE]. That thread is updated frequently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
===Error/Warning messages at startup===&lt;br /&gt;
&lt;br /&gt;
====File name: 'irrKlang.NET2.0, Version=1.1.3.0, Culture=neutral, PublicKeyToken=a854741bd80517c7' ---&amp;gt; System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)====&lt;br /&gt;
This message appears most likely for Windows XP/Vista '''64bit''' users. It may occur on 32bit OS if that machine doesn't have .NET 2.0 SP1 installed.&lt;br /&gt;
&lt;br /&gt;
There is only 1 known way to solve the problem...: Make sure you have .NET 2.0 SP1 installed, if you don't have it you can download it from [http://www.microsoft.com/Downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&amp;amp;displaylang=en Microsoft Download Center].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Error parsing meta.xml====&lt;br /&gt;
The reason why this window comes up should be explained in the message. It's most likely that your meta.xml has the following XML declarations:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-16&amp;quot; ?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To solve the problem, simply open the file in WordPad or Notepad (Notepad++ may not solve the problem so use the Windows one), remove that line and save the changes.&lt;br /&gt;
&lt;br /&gt;
.NET 2.0 XML parser doesn't like not &amp;quot;well-formed&amp;quot; XML files, so you may get different messages with different meta.xml files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Not able to save file===&lt;br /&gt;
If you can't seem to be able to save a file that's probably because you created a new file and the file wasn't added to any resource.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
We have an IRC channel on GTANet.com network which you can join, ask questions or even give suggestions. The channel name is #mtatools. You can also find us on [http://forum.multitheftauto.com/viewtopic.php?f=91&amp;amp;t=24834 MTA forum]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Credits==&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p] - programmer &amp;amp; UI designer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=30686 Fenix1042] - programmer&lt;br /&gt;
* [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=22437 Cazomino05] - xml files with mta functions and events&lt;br /&gt;
* MTA Developers - delivering the amazing GTA:SA multiplayer mod that has almost unlimited possibilities&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleTaxiLightOn&amp;diff=21776</id>
		<title>SetVehicleTaxiLightOn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleTaxiLightOn&amp;diff=21776"/>
		<updated>2009-10-19T17:26:25Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will set the taxi light on in a taxi (vehicle ID's 420 and 438)&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 setVehicleTaxiLightOn ( vehicle taxi, bool LightState )              &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''taxi:''' The vehicle element of the taxi that you wish to turn the light on.&lt;br /&gt;
*'''LightState:''' whether the light is on. ''True'' for on, ''False'' for off.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the state was successfully set, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sets the taxi light on when the player presses &amp;quot;o&amp;quot; in a taxi.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot; , getRootElement ( ) , &lt;br /&gt;
function ( )&lt;br /&gt;
  bindKey ( source , &amp;quot;o&amp;quot;, &amp;quot;down&amp;quot;, &lt;br /&gt;
    function ( thePlayer )&lt;br /&gt;
      if ( isPedInVehicle ( thePlayer ) ) then --is in vehicle or not?&lt;br /&gt;
        local vehicle = getPedOccupiedVehicle ( thePlayer ) --getting player's occupied vehicle&lt;br /&gt;
        if ( getVehicleController ( vehicle ) == thePlayer ) then --is driver or not?&lt;br /&gt;
          local id = getElementModel ( vehicle ) --getting vehicle's model&lt;br /&gt;
          if ( ( id == 420 ) or ( id == 438 ) ) then --is a taxi?&lt;br /&gt;
            setVehicleTaxiLightOn ( vehicle, not isVehicleTaxiLightOn ( vehicle ) ) --changing taxi light on/off&lt;br /&gt;
          end&lt;br /&gt;
        end	&lt;br /&gt;
      end&lt;br /&gt;
   end)&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{vehicle functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleHeadLightColor&amp;diff=21775</id>
		<title>SetVehicleHeadLightColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleHeadLightColor&amp;diff=21775"/>
		<updated>2009-10-19T17:25:37Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will set the headlight color of a vehicle. valid Red Green and Blue arguments range from 0-255&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 setVehicleHeadLightColor ( vehicle theVehicle, int red, int green, int blue)            &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' The [[vehicle]] that you wish to set the headlight color of.&lt;br /&gt;
*'''red:''' An integer indicating the amount of red for the vehicle's headlights&lt;br /&gt;
*'''green:''' An integer indicating the amount of green for the vehicle's headlights&lt;br /&gt;
*'''blue:''' An integer indicating the amount of blue for the vehicle's headlights&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if vehicle's headlight color was set, ''false'' if an invalid vehicle or invalid color ranges were specified for red,green or blue.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example changes car lights color with command ''/carlights red_color, green_color, blue_color''&lt;br /&gt;
&lt;br /&gt;
It shows error if player isn't in vehicle or color failed to change. It shows a message if color changed successful.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function changeCarLightsColor ( thePlayer, command, red, green, blue )&lt;br /&gt;
	local theVehicle = getPedOccupiedVehicle ( thePlayer )&lt;br /&gt;
	if ( not theVehicle ) then&lt;br /&gt;
		return outputChatBox( &amp;quot;You don't have vehicle!&amp;quot; )&lt;br /&gt;
	end&lt;br /&gt;
	red = tonumber ( red )&lt;br /&gt;
	green = tonumber ( green )&lt;br /&gt;
	blue = tonumber ( blue )&lt;br /&gt;
	-- check if the colour values for red, green and blue are valid&lt;br /&gt;
	if red and green and blue then&lt;br /&gt;
		local color = setVehicleHeadLightColor ( theVehicle, red, green, blue )&lt;br /&gt;
		if(not color) then&lt;br /&gt;
			outputChatBox( &amp;quot;Failed to change vehicle lights color&amp;quot; )&lt;br /&gt;
		else&lt;br /&gt;
			outputChatBox ( &amp;quot;Vehicle lights color changed sucessfully&amp;quot; )&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		outputChatBox( &amp;quot;Failed to change vehicle lights color&amp;quot; )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;carlights&amp;quot;, changeCarLightsColor )&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>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineRestoreModel&amp;diff=21774</id>
		<title>EngineRestoreModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineRestoreModel&amp;diff=21774"/>
		<updated>2009-10-19T17:04:54Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&amp;lt;!-- Change this to &amp;quot;Client function&amp;quot; or &amp;quot;Server function&amp;quot; appropriately--&amp;gt;&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 restores the visual DFF model of the given model ID. This restores the result of [[engineReplaceModel]].&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 engineRestoreModel ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&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;
*'''modelID:''' The model ID to restore the visuals of&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 model was successfully restored, ''false'' or ''nil'' if it failed for some reason.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Client-Side example for restoring model / vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ResetModel ( )&lt;br /&gt;
    engineRestoreModel ( 587 )  -- Object / Vehicle to restore to default GTA one.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent ( &amp;quot;restoreClientModel&amp;quot;, true )&lt;br /&gt;
addEventHandler ( &amp;quot;restoreClientModel&amp;quot;, getRootElement(), ResetModel )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&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;
Server-Side example for triggering model / vehicle restore function with &amp;quot;restore&amp;quot; command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestoreModel ( )&lt;br /&gt;
    triggerClientEvent ( &amp;quot;restoreClientModel&amp;quot;, getRootElement(), restoreClientModel )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;restore&amp;quot;, RestoreModel )&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;
&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;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineRestoreCOL&amp;diff=21773</id>
		<title>EngineRestoreCOL</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineRestoreCOL&amp;diff=21773"/>
		<updated>2009-10-19T17:04:03Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&amp;lt;!-- Change this to &amp;quot;Client function&amp;quot; or &amp;quot;Server function&amp;quot; appropriately--&amp;gt;&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 restores the original collision model of the given model ID. Reverses the effect of [[engineReplaceCOL]].&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 engineRestoreCOL ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&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;
*'''modelID:''' The ID of the model to restore the model of&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 this function succeeds, ''false'' or ''nil'' if it fails for some reason.&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;
Client-Side example for restoring object collision with default one.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestoreCollision ( )&lt;br /&gt;
    engineRestoreCOL ( 3356 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent ( &amp;quot;collisionRestore&amp;quot;, true )&lt;br /&gt;
addEventHandler ( &amp;quot;collisionRestore&amp;quot;, getRootElement(), RestoreCollision )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&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;
Server-side example function for triggering the restore.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestoreCols ( )&lt;br /&gt;
    triggerClientEvent ( &amp;quot;collisionRestore&amp;quot;, getRootElement(), collisionRestore )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;restorecol&amp;quot;, RestoreCols)&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;
&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;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsVehicleOnGround&amp;diff=21772</id>
		<title>IsVehicleOnGround</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsVehicleOnGround&amp;diff=21772"/>
		<updated>2009-10-19T17:02:15Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Checks to see if a vehicle has contact with the ground.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool isVehicleOnGround ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' The vehicle you wish to check.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if vehicle is on the ground, ''false'' if it is not.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
This example tells you when you've jumped out of a vehicle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkVState ( vehicle, seat, jacked )&lt;br /&gt;
	vehName = getVehicleName ( vehicle )&lt;br /&gt;
&lt;br /&gt;
	if isVehicleOnGround ( vehicle ) == false then&lt;br /&gt;
		outputChatBox ( &amp;quot;You jumped out of a &amp;quot;..vehName..&amp;quot;!&amp;quot;, source, 255, 0, 0  )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, getRootElement(), checkVState )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnTrailerDetach&amp;diff=21771</id>
		<title>OnTrailerDetach</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnTrailerDetach&amp;diff=21771"/>
		<updated>2009-10-19T17:01:16Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when a trailer is detached from a truck.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
vehicle theTruck&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''theTruck''': The truck vehicle that this trailer got detached from.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add the event's source in the section below --&amp;gt;&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the trailer [[vehicle]] that the truck got detached from.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
This example re-attaches a trailer when it detaches.&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function reattachTrailer(theTruck)&lt;br /&gt;
    attachTrailerToVehicle(theTruck, source) -- Reattach the truck and trailer&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onTrailerDetach&amp;quot;, getRootElement(), reattachTrailer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Vehicle events}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientGUIMouseUp&amp;diff=21770</id>
		<title>OnClientGUIMouseUp</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientGUIMouseUp&amp;diff=21770"/>
		<updated>2009-10-19T16:59:34Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This event is fired when the user releases his mouse button when on top of a GUI element.&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 button, int absoluteX, int absoluteY&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''button:''' the name of the mouse button that was released on a GUI element, can be ''left'', ''right'', or ''middle''.&lt;br /&gt;
*'''absoluteX:''' the X position of the mouse cursor, in pixels, measured from the left side of the screen.&lt;br /&gt;
*'''absoluteY:''' the Y position of the mouse cursor, in pixels, measured from the top of the screen.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the GUI element on top of which the mouse button was released.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example show how to add very basic ''click'n'drag'' feature for GUI elements (only for those which parent element is gui-root)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientGUIMouseDown&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( btn, x, y )&lt;br /&gt;
        if btn == &amp;quot;left&amp;quot; then&lt;br /&gt;
            clickedElement = source; -- store the clicked element in a global variable&lt;br /&gt;
            local elementPos = { guiGetPosition( source, false ) };&lt;br /&gt;
            offsetPos = { x - elementPos[ 1 ], y - elementPos[ 2 ] }; -- get the offset position&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientGUIMouseUp&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( btn, x, y )&lt;br /&gt;
        if btn == &amp;quot;left&amp;quot; then&lt;br /&gt;
            clickedElement = nil;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientCursorMove&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( _, _, x, y )&lt;br /&gt;
        if clickedElement then&lt;br /&gt;
            guiSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false );&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 events===&lt;br /&gt;
{{GUI_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientElementStreamOut&amp;diff=21769</id>
		<title>OnClientElementStreamOut</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientElementStreamOut&amp;diff=21769"/>
		<updated>2009-10-19T16:59:13Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered whenever a physical element is streamed out. This is triggered for all elements that are streamable, such as players, peds, vehicles, objects and markers when the local player is leaving the element. When this event is triggered, that element is no longer physical and is now virtualized by MTA.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] that streamed out&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example shows you how to tell player that a marker was streamed out and the distance between player and the marker.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientElementStreamOut&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( )&lt;br /&gt;
        if getElementType( source ) == &amp;quot;marker&amp;quot; then&lt;br /&gt;
            local myPosTab = { getElementPosition( getLocalPlayer( ) ) };&lt;br /&gt;
            local markerPosTab = { getElementPosition( source ) };&lt;br /&gt;
            local distance = getDistanceBetweenPoints3D( unpack( myPosTab ), unpack( markerPosTab ) );&lt;br /&gt;
            outputChatBox( &amp;quot;A marker has just streamed out. Distance to the marker: &amp;quot; .. tostring( distance ) ..&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;
===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>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientElementStreamIn&amp;diff=21768</id>
		<title>OnClientElementStreamIn</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientElementStreamIn&amp;diff=21768"/>
		<updated>2009-10-19T16:58:57Z</updated>

		<summary type="html">&lt;p&gt;50p: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered whenever a physical element is streamed in. This is triggered for all elements that are streamable, such as players, peds, vehicles, objects and markers. When this event is triggered, that element is guaranteed to be physically created as a GTA object.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] that streamed in&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example shows you how to tell player that a marker was streamed in and the distance between player and the marker.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientElementStreamIn&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( )&lt;br /&gt;
        if getElementType( source ) == &amp;quot;marker&amp;quot; then&lt;br /&gt;
            local myPosTab = { getElementPosition( getLocalPlayer( ) ) };&lt;br /&gt;
            local markerPosTab = { getElementPosition( source ) };&lt;br /&gt;
            local distance = getDistanceBetweenPoints3D( unpack( myPosTab ), unpack( markerPosTab ) );&lt;br /&gt;
            outputChatBox( &amp;quot;A marker has just streamed in. Distance to the marker: &amp;quot; .. tostring( distance ) ..&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;
==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>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=21739</id>
		<title>Resource Web Access</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource_Web_Access&amp;diff=21739"/>
		<updated>2009-10-15T20:56:56Z</updated>

		<summary type="html">&lt;p&gt;50p: /* SDK - added C# SDK */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Multi Theft Auto Server provides a web interface that resources can use in a variety of ways. This document's purpose is to explain what these ways are and how to go about using them.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
There are two key parts that make up this system. The first is a standard web server that allows web browsers to request pages and files you have in a resource. The second is a system for allowing web browsers to call functions you have exported from your resource.&lt;br /&gt;
&lt;br /&gt;
==Pages==&lt;br /&gt;
===Specifying a file in the meta===&lt;br /&gt;
You can specify in your resource's meta file that certain files are accessible through the web server. To do this, you add a line:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;filename.ext&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
You can then access this file from your web browser by visiting: http://host:port/resourcename/filename.ext&amp;lt;br/&amp;gt;&lt;br /&gt;
For example, on a locally hosted server using default http port with webmap started: http://127.0.0.1:22005/webmap/map.htm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Binary files===&lt;br /&gt;
Despite the misleading name, files specified using the html node can be of any type. If they are binary files (like images, zip files) then you need to specify this in the meta file, by adding ''raw=&amp;quot;true&amp;quot;'' to the ''html'' node. This means that the files are not preprocessed before being sent to the web browser.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html src=&amp;quot;image.gif&amp;quot; raw=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Parsed files===&lt;br /&gt;
If a file is not specified in the meta file as &amp;quot;raw&amp;quot;, then it is passed through a pre-processor before it is returned to the client. This pre-processor works much like PHP or ASP, but uses LUA. You can embed standard MTA scripts within HTML pages, controlling the output. Almost all standard MTA functions work, plus a number of special [[Template:HTTP functions|HTTP Functions]], such as [[httpWrite]], a function that outputs text to the buffer.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* httpWrite( getResourceName(getThisResource()) ) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a shorthand (in common with PHP and ASP) for this code, meaning that you can also write the above code as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        This resource is called &amp;lt;* = getResourceName(getThisResource()) *&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aside from HTTP functions, embedded Lua has access to the following environment variables that contain information about how the page was requested:&lt;br /&gt;
* table '''requestHeaders''': This is a table containing all the headers that were requested with the page. You can set returned headers using [[httpSetResponseHeader]]. &lt;br /&gt;
* table '''form''': This is a table containing all the form data submitted to the page using HTTP POST combined with any variables passed in the querystring with HTTP GET.&lt;br /&gt;
* table '''cookies''': This is a table of all the cookies. You can modify cookies using [[httpSetResponseCookie]].&lt;br /&gt;
* string '''hostname''': This is a string containing the IP address or hostname that requested the page.&lt;br /&gt;
* string '''url''': This is the URL of the page.&lt;br /&gt;
* account '''user''': This is the account of the current user.&lt;br /&gt;
&lt;br /&gt;
It's important to note that parsed files are run in a separate virtual machine from the rest of your resource's code. As such, if you want to call a function in your resource's main code, you need to export the function and use the [[call]] function from your parsed file.&lt;br /&gt;
&lt;br /&gt;
==Calls==&lt;br /&gt;
You can specify that certain exported functions in your resource are able to be called from the HTTP interface. All the SDKs (listed below) allow you to call these functions from a remote location. &lt;br /&gt;
&lt;br /&gt;
To specify an exported http-accessible function, add the following to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;export function='functionName' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can code your function just as you would any normal function, returning as many values as you want, including tables and resources and most importantly elements. You ''cannot'' however return other 'userdata' values such as [[xmlnode|xmlnodes]] or functions.&lt;br /&gt;
&lt;br /&gt;
===Calls from the HTTP web interface===&lt;br /&gt;
Using calls is probably easiest from the web interface and can be done almost seamlessly.&lt;br /&gt;
&lt;br /&gt;
First, add this to your meta.xml file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Secondly, add the following to the &amp;lt;head&amp;gt; section of the page you want to call from:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;* = call ( getResourceFromName(&amp;quot;ajax&amp;quot;), &amp;quot;start&amp;quot;, getResourceName(getThisResource()) ) *&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, you can create a javascript block in your page and call your functions almost as if they were local. The only difference is that the calls are aysnchronous - you should specify a callback function as the last argument for your call. This is called when the function returns.&lt;br /&gt;
&lt;br /&gt;
Here's a simple example.&lt;br /&gt;
&lt;br /&gt;
'''meta.xml'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
   &amp;lt;include resource=&amp;quot;ajax&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;script src='code.lua' /&amp;gt;&lt;br /&gt;
   &amp;lt;html src='page.htm' default='true' /&amp;gt;&lt;br /&gt;
   &amp;lt;export function='showChatMessage' http='true' /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''code.lua'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showChatMessage ( message )&lt;br /&gt;
    outputChatBox ( message )&lt;br /&gt;
    return 5;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''page.htm'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;* = call ( getResourceFromName(&amp;quot;ajax&amp;quot;), &amp;quot;start&amp;quot;, getResourceName(getThisResource()) ) *&amp;gt;&lt;br /&gt;
        &amp;lt;script type='text/javascript'&amp;gt;&lt;br /&gt;
            function say() {&lt;br /&gt;
                var message = document.getElementById('message')&lt;br /&gt;
                showChatMessage ( message.value, &lt;br /&gt;
                    function ( number ) {&lt;br /&gt;
                        // the function has been called and returned something&lt;br /&gt;
                        message.value = &amp;quot;The function returned &amp;quot; + number;&lt;br /&gt;
                    }&lt;br /&gt;
                );&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;input type='text' id='message' /&amp;gt;&amp;lt;input type='button' value='say' onclick='say();' /&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see (fairly complex) examples of how this can be done in the resources ''resourcebrowser'', ''resourcemanager'' and ''webadmin''.&lt;br /&gt;
&lt;br /&gt;
==Securing the web interface==&lt;br /&gt;
The [[ACL]] has a number of rights that can affect what files can be accessed.&lt;br /&gt;
* general.http: If disabled, none of the http files can be accessed (except by game clients)&lt;br /&gt;
* resource.'''ResourceName''': If disabled, none of the files in the resource can be accessed&lt;br /&gt;
* resource.'''ResourceName'''.file.'''FileName''': If disabled, the file named cannot be accessed&lt;br /&gt;
* resource.'''ResourceName'''.function.'''FunctionName''': If disabled, the function cannot be called&lt;br /&gt;
These work as with other ACL rights - you can disable them for normal users and just enable them for Admin users, or any other group of users you wish.&lt;br /&gt;
&lt;br /&gt;
==SDK==&lt;br /&gt;
There are a number of so-called 'SDKs' available that allow you to interface with the server from other programming languages. With these you could (in theory) write whole gamemodes. In practice this is probably a bad idea, but it is useful for statistics and administration. The PHP SDK is the most developed version. Feel free to modify or create your own SDKs - if you do please send us a copy.&lt;br /&gt;
&lt;br /&gt;
* [[Java SDK]]&lt;br /&gt;
* [[Javascript SDK]]&lt;br /&gt;
* [[Perl SDK]]&lt;br /&gt;
* [[PHP SDK]]&lt;br /&gt;
* [[CSharp SDK|C# SDK]]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[callRemote]] - Allows game servers to call functions on PHP pages (with the PHP SDK) and on other game servers.&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CSharp_SDK&amp;diff=21738</id>
		<title>CSharp SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CSharp_SDK&amp;diff=21738"/>
		<updated>2009-10-15T20:55:53Z</updated>

		<summary type="html">&lt;p&gt;50p: Created page with '__TOC__ Many languages can make HTTP POST requests with JSON, C# can do too. This is C# SDK for MTA. It allows you to call any HTTP exported functions from resources. The SDK its…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
Many languages can make HTTP POST requests with JSON, C# can do too. This is C# SDK for MTA. It allows you to call any HTTP exported functions from resources. The SDK itself is very basic and easy to use. It was mainly created to extend [[MTASE|MTA:Script Editor]] functionality. Feel free to modify it however you like but don't remove original author. If you want your changes to be published, please speak to [[50p]] on MTA forums [http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 HERE]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to==&lt;br /&gt;
First of all, you have to include your files in your project. Once you've done this, you are ready to use SDK.&lt;br /&gt;
&lt;br /&gt;
1. Add MTA_SDK.cs and MTA_LuaArgs.cs to your project file and import the SDK namespace in your file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;using MTA_SDK;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Create instance of MTA class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA server = new MTA();	//-- default params (for IP and port, respectively) are: &amp;quot;localhost&amp;quot; and 22005&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;//-- if you don't want to make a call to your local server then you can connect to remote server with the following parameters:&lt;br /&gt;
MTA server = new MTA( &amp;quot;IP&amp;quot;, port );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;//-- if you get errors about authorization then you should use the account you created on your server &lt;br /&gt;
//-- (the account that is allowed to visit HTTP sites of your server, preferably admin):&lt;br /&gt;
MTA server = new MTA( &amp;quot;IP&amp;quot;, port, &amp;quot;username&amp;quot;, &amp;quot;password&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Create instance of MTA_LuaArgs class to create list of arguments that is passed to the function call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA_LuaArgs luaArgs = new MTA_LuaArgs( );&lt;br /&gt;
luaArgs.AddValue( &amp;quot;hello&amp;quot; );&lt;br /&gt;
luaArgs.AddValue( &amp;quot;world&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;MTA_LuaArgs luaArgs = new MTA_LuaArgs( &amp;quot;hello&amp;quot;, &amp;quot;world&amp;quot; );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Call function exported from resource (in meta.xml: &amp;lt;export function=&amp;quot;functionName&amp;quot; http=&amp;quot;true&amp;quot; /&amp;gt;, REMEMBER! http attribute has to be true!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string returned = server.CallFunction( &amp;quot;sampleResource&amp;quot;, &amp;quot;functionName&amp;quot;, luaArgs );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And here is the sample Lua function (functionName) that we're trying to call:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function functionName( param1, param2 )&lt;br /&gt;
	outputChatBox( &amp;quot;Function called from SDK with args: &amp;quot; .. param1, param2 );&lt;br /&gt;
	return true;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
You can download C# MTA SDK here:&lt;br /&gt;
*[http://scripteditor.beta.mtasa.com/files/MTA_SDK_1.0.zip C# MTA SDK 1.0]&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
If you have any questions/suggestions you can contact author on MTA forum or IRC '''#mta''' and '''#mtatools''' channels hosted on GTANet.com server.&lt;br /&gt;
*[http://forum.multitheftauto.com/memberlist.php?mode=viewprofile&amp;amp;u=19953 50p]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedAnimationData&amp;diff=21705</id>
		<title>GetPedAnimationData</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedAnimationData&amp;diff=21705"/>
		<updated>2009-10-09T22:06:57Z</updated>

		<summary type="html">&lt;p&gt;50p: /* function needs checking */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Needs Checking|This function doesn't exist in 1.0.1 --[[User:50p|50p]] 22:06, 9 October 2009 (UTC)}}&lt;br /&gt;
This function is used to return the animation data of a [[player]] or [[ped]] that was set using [[setPedAnimation]].&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 getPedAnimationData ( ped thePed )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' the player or ped you want to get the animation data of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[table]] containing information about animation. These keys are present in the table:&lt;br /&gt;
*'''name:''' string - name of the animation&lt;br /&gt;
*'''block_name:''' string - name of animation block&lt;br /&gt;
*'''loop:''' boolean - is animation looping?&lt;br /&gt;
*'''update_position:''' boolean - updating position&lt;br /&gt;
*'''interruptible:''' boolean - is animation interruptible?&lt;br /&gt;
*'''time:''' float - duration of the animation&lt;br /&gt;
*'''start_time:''' float - starting point&lt;br /&gt;
*'''finished:''' boolean - has animation finished playing?&lt;br /&gt;
*'''speed:''' float - speed&lt;br /&gt;
*'''blend_speed:''' float - blending speed&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client ped functions}}&lt;br /&gt;
[[Category:Needs Example]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_Introduction&amp;diff=21703</id>
		<title>Scripting Introduction</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_Introduction&amp;diff=21703"/>
		<updated>2009-10-09T14:25:55Z</updated>

		<summary type="html">&lt;p&gt;50p: /* added link to MTA:SE wiki page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Resources are a key part of MTA. A resource is essentially a folder or zip file that contains a collection of files, plus a meta file that describes to the server how the resource should be loaded and what files it does contain. A resource can be seen as being partly equivalent to a program running in an operating system - it can be started and stopped, and multiple resources can run at once.&lt;br /&gt;
&lt;br /&gt;
Everything that has to do with scripting happens in resources, what a resource does defines if it is a gamemode, a map or anything else. MTA comes with resources that you can optionally use in your gamemodes, such as maplimits to keep playings within a playing area or deathpickups to create weapon pickups.&lt;br /&gt;
&lt;br /&gt;
'''Your first step to begin Lua scripting should be using an Lua editor. This makes scripting much easier. We recommend [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++] or [http://luaedit.luaforge.net/ LuaEdit]. There is also an unofficial [[MTASE|MTA Script Editor]] (in work-in-progress state) that you can test out.'''&lt;br /&gt;
&lt;br /&gt;
==Creating a working script==&lt;br /&gt;
We will first learn how to make a basic script that lets the player walk around in the city, step by step.&lt;br /&gt;
===Where are all the scripts?===&lt;br /&gt;
Let's take a look at the script's file structure. Go to your MTA Server folder, and follow the path below:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
You will see a lot of .zip files, which are the packaged sample scripts shipped with MTA DM. Each file is a &amp;quot;resource&amp;quot;, and they will all be unzipped and loaded by the server when it starts. To create your own resource, simply make a folder with your preferred name. We'll use &amp;quot;myserver&amp;quot; for this tutorial.&lt;br /&gt;
&lt;br /&gt;
Now you should be under this directory: &lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
===Identifying your resource===&lt;br /&gt;
In order to let the server know what's in the resource, a ''meta.xml'' file must be created to list the resource's content. It must be located in the resource's root directory, which is the &amp;quot;myserver&amp;quot; folder in our case. So create a text file and name it &amp;quot;meta.xml&amp;quot;, and open it with notepad.&lt;br /&gt;
&lt;br /&gt;
Enter the following codes in the ''meta.xml'' file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;YourName&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;My Server&amp;quot; description=&amp;quot;My first MTA DM server&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
In the ''&amp;lt;info /&amp;gt;'' tag, there's a &amp;quot;type&amp;quot; field which indicates that the resource is a ''gamemode'' instead of a regular include or a ''map'', which will be explained later. A gamemode is what you need to make a stand-alone server. &lt;br /&gt;
&lt;br /&gt;
The ''&amp;lt;script /&amp;gt;'' tag indicates the script files contained in the resource, which we will create next.&lt;br /&gt;
===Creating a simple script===&lt;br /&gt;
Note that in the ''&amp;lt;script /&amp;gt;'' tag above, the .lua file is not under another directory. Therefore we'll create the file in the same folder as meta.xml. Now you can copy and paste the following code into script.lua:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler()&lt;br /&gt;
	local x = 1959.55&lt;br /&gt;
	local y = -1714.46&lt;br /&gt;
	local z = 10&lt;br /&gt;
	spawnPlayer(source, x, y, z)&lt;br /&gt;
	fadeCamera(source, true)&lt;br /&gt;
	setCameraTarget(source, source)&lt;br /&gt;
	outputChatBox(&amp;quot;Welcome to My Server&amp;quot;, source)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The script will spawn you at the coordinate (x, y, z) specified above, when you join the game. Note that the ''fadeCamera'' function must be used or the screen will be black. Also, in releases after DP2, you need to set the camera target (otherwise all the player will see is blue sky).&lt;br /&gt;
&lt;br /&gt;
The '''source''' variable indicates who triggered the event. Since a player has joined when the code is triggered, you use this variable to look which has joined. So it'll spawn that player instead of everyone or a random person.&lt;br /&gt;
&lt;br /&gt;
If we have a closer look on [[addEventHandler]], you can see 3 things: 'onPlayerJoin', which indicates when it's triggered. getRootElement(), which shows by what/who it can be triggered. (getRootElement() is everything/everyone) And joinHandler, which indicates the function that has to be triggered after the event is triggered. Other details will be explained later in another example, now let's just run the server and try it out!&lt;br /&gt;
&lt;br /&gt;
===Running the script===&lt;br /&gt;
To get the server started, simply run the executable under the MTA DM directory. A list of server stats will be shown first; note the port number, which you'll need when joining the game. Then the server loads all the resources under the /resource/ directory, and then &amp;quot;ready to accept connections!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Before you connect to the server, you must run the gamemode. Type &amp;quot;gamemode myserver&amp;quot; and press Enter. The server will start the gamemode you just created, and will also show any errors and warnings from this point on. Now you can start the MTA DM client, and &amp;quot;Quick Connect&amp;quot; using the IP address of your server and the port number you saw earlier. If all goes well, after a few seconds your character will be walking on the streets of Los Santos.&lt;br /&gt;
&lt;br /&gt;
Next we'll add a command to your script that players can use to spawn a vehicle beside their position. You may skip it and check out more advanced scripting with the [[Map manager|Map Manager]], which continues this tutorial. Another branch from this tutorial is [[Introduction to Scripting GUI]], you may follow it to see how Graphical User Interface in MTA:DM is drawn and scripted.&lt;br /&gt;
&lt;br /&gt;
==Creating a simple command==&lt;br /&gt;
Let's go back to the content of the ''script.lua'' file. As mentioned above, we want to provide a command to create a vehicle beside your current position in the game. Firstly we need to create a function we want to call and a command handler that creates the command the player will be able to enter in the console.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- create a vehicle and stuff&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- create a command handler&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''Note: Function names are clickable in code examples on the wiki and linked to the functions' documentation.''&lt;br /&gt;
&lt;br /&gt;
====About command handlers====&lt;br /&gt;
The first argument of [[addCommandHandler]] is the name of the command the player will be able to enter, the second argument is the function this will call, in this case ''createVehicleForPlayer''.&lt;br /&gt;
&lt;br /&gt;
If you have already experience in scripting, you will know that you call a function like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer is the player element of the player who entered the command&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- get the position and put it in the x,y,z variables&lt;br /&gt;
	-- (local means, the variables only exist in the current scope, in this case, the function)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- get the position of the player&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- get the position of the player&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- get the position of the player&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- check if the return value was ''false''&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- if so, output a message to the chatbox, but only to this player.&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&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;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&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;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&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;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntStart&amp;diff=21690</id>
		<title>OnClientPlayerStuntStart</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntStart&amp;diff=21690"/>
		<updated>2009-10-05T19:21:17Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered whenever the local player starts doing a vehicle stunt.&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 stuntType&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''stuntType''': the type of stunt the player is starting to perform. Valid types are:&lt;br /&gt;
{{StuntTypes}}&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the local [[player]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This is a simple stunt script which tells player what stunt he/she started and finished, time the stunt taken to perform and distance travelled while stunting.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType )&lt;br /&gt;
        outputChatBox( &amp;quot;You started stunt: &amp;quot; .. stuntType );&lt;br /&gt;
    end&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType, stuntTime, distance )&lt;br /&gt;
        outputChatBox( &amp;quot;You finished stunt: &amp;quot; .. stuntType ..&amp;quot;, Time: &amp;quot; .. tostring( stuntTime ).. &amp;quot;, Distance: &amp;quot; .. tostring( distance ) );&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 player events===&lt;br /&gt;
{{Client_player_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntFinish&amp;diff=21689</id>
		<title>OnClientPlayerStuntFinish</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntFinish&amp;diff=21689"/>
		<updated>2009-10-05T19:20:57Z</updated>

		<summary type="html">&lt;p&gt;50p: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered whenever the local player finishes a vehicle stunt.&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 stuntType, int stuntTime, float stuntDistance&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''stuntType''': the type of stunt the player just performed. Valid types are:&lt;br /&gt;
{{StuntTypes}}&lt;br /&gt;
*'''stuntTime''': the number of miliseconds the stunt lasted.&lt;br /&gt;
*'''stuntDistance''': the distance traveled while doing the stunt.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the local [[player]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This is a simple stunt script which tells player what stunt he/she started and finished, time the stunt taken to perform and distance travelled while stunting.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType )&lt;br /&gt;
        outputChatBox( &amp;quot;You started stunt: &amp;quot; .. stuntType );&lt;br /&gt;
    end&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType, stuntTime, distance )&lt;br /&gt;
        outputChatBox( &amp;quot;You finished stunt: &amp;quot; .. stuntType ..&amp;quot;, Time: &amp;quot; .. tostring( stuntTime ) .. &amp;quot;, Distance: &amp;quot; .. tostring( distance ) );&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 player events===&lt;br /&gt;
{{Client_player_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntStart&amp;diff=21688</id>
		<title>OnClientPlayerStuntStart</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntStart&amp;diff=21688"/>
		<updated>2009-10-05T19:20:18Z</updated>

		<summary type="html">&lt;p&gt;50p: /* added example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered whenever the local player starts doing a vehicle stunt.&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 stuntType&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''stuntType''': the type of stunt the player is starting to perform. Valid types are:&lt;br /&gt;
{{StuntTypes}}&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the local [[player]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This is a simple stunt script which tells player what stunt he/she started and finished, time the stunt taken to perform and distance travelled while stunting.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType )&lt;br /&gt;
        outputChatBox( &amp;quot;You started stunt: &amp;quot; .. stuntType );&lt;br /&gt;
    end&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType, stuntTime, distance )&lt;br /&gt;
        outputChatBox( &amp;quot;You finished stunt: &amp;quot; .. stuntType ..&amp;quot;, Time: &amp;quot; .. stuntTime .. &amp;quot;, Distance: &amp;quot; .. tostring( distance ) );&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 player events===&lt;br /&gt;
{{Client_player_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntFinish&amp;diff=21687</id>
		<title>OnClientPlayerStuntFinish</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPlayerStuntFinish&amp;diff=21687"/>
		<updated>2009-10-05T19:19:57Z</updated>

		<summary type="html">&lt;p&gt;50p: /* added example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered whenever the local player finishes a vehicle stunt.&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 stuntType, int stuntTime, float stuntDistance&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''stuntType''': the type of stunt the player just performed. Valid types are:&lt;br /&gt;
{{StuntTypes}}&lt;br /&gt;
*'''stuntTime''': the number of miliseconds the stunt lasted.&lt;br /&gt;
*'''stuntDistance''': the distance traveled while doing the stunt.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the local [[player]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This is a simple stunt script which tells player what stunt he/she started and finished, time the stunt taken to perform and distance travelled while stunting.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType )&lt;br /&gt;
        outputChatBox( &amp;quot;You started stunt: &amp;quot; .. stuntType );&lt;br /&gt;
    end&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerStuntFinish&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stuntType, stuntTime, distance )&lt;br /&gt;
        outputChatBox( &amp;quot;You finished stunt: &amp;quot; .. stuntType ..&amp;quot;, Time: &amp;quot; .. stuntTime .. &amp;quot;, Distance: &amp;quot; .. tostring( distance ) );&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 player events===&lt;br /&gt;
{{Client_player_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientPedChoke&amp;diff=21686</id>
		<title>OnClientPedChoke</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientPedChoke&amp;diff=21686"/>
		<updated>2009-10-05T18:55:23Z</updated>

		<summary type="html">&lt;p&gt;50p: /* added example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This event is fired when a ped chokes due to the effect of a weapon such as tear gas grenades, fire extinguishers and spray cans.&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int weaponID, ped responsiblePed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''weapon:''' an [[int]] representing the ID of the weapon which caused the choking.&lt;br /&gt;
*'''responsiblePed:''' the ped responsible for causing the choking, possiblly nil.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The source of this event is the ped who is choking.&lt;br /&gt;
&lt;br /&gt;
==Cancel effect==&lt;br /&gt;
If this event is [[Event system#Canceling|canceled]], the ped will not be choked.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section class=&amp;quot;client&amp;quot; name=&amp;quot;Client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example disables choking effects from the tear gas grenades.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientPedChoke&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( )&lt;br /&gt;
        cancelEvent( );&lt;br /&gt;
    end&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client ped events===&lt;br /&gt;
{{Client_ped_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientResourceStop&amp;diff=21685</id>
		<title>OnClientResourceStop</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientResourceStop&amp;diff=21685"/>
		<updated>2009-10-05T18:53:47Z</updated>

		<summary type="html">&lt;p&gt;50p: /* added example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered when a [[resource]] is stopped.&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
resource stoppedResource&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''stoppedResource''': the [[resource]] that was stopped.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the client [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs name of resource that was started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientResourceStart&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( stoppedRes )&lt;br /&gt;
        outputChatBox( &amp;quot;Resource stopped: &amp;quot; .. getResourceName( stoppedRes ) );&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 resource events===&lt;br /&gt;
{{Client_resource_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientResourceStart&amp;diff=21684</id>
		<title>OnClientResourceStart</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientResourceStart&amp;diff=21684"/>
		<updated>2009-10-05T18:52:35Z</updated>

		<summary type="html">&lt;p&gt;50p: /* added example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered when a [[resource]] is started.  Please note that this is '''not''' triggered the same side as the serverside variant [[onResourceStart]].  The event is triggered when any ''clientside resources'' are started.  This means it is triggered when a clientside script is initiated after a download, which includes downloading after join.&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
resource startedResource&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''startedResource''': the [[resource]] that was started.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the started resource's [[root element]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs name of resource that was started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientResourceStart&amp;quot;, getRootElement( ),&lt;br /&gt;
    function ( startedRes )&lt;br /&gt;
        outputChatBox( &amp;quot;Resource started: &amp;quot; .. getResourceName( startedRes ) );&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 resource events===&lt;br /&gt;
{{Client_resource_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>50p</name></author>
	</entry>
</feed>