<?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=FabioGNR</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=FabioGNR"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/FabioGNR"/>
	<updated>2026-04-10T17:04:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientKey&amp;diff=44764</id>
		<title>OnClientKey</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientKey&amp;diff=44764"/>
		<updated>2015-03-01T19:16:28Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: Added info about cancelling 'escape' key.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event triggers whenever the user presses a button on their keyboard.&lt;br /&gt;
This event can also be used to see if the client scrolls his mousewheel.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;string button, bool pressOrRelease&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* '''button''':  This refers the button pressed. see [[Key names]] for list of keys string&lt;br /&gt;
* '''pressOrRelease''': This refers to whether they were pressing or releasing the key, true when pressing, false when releasing.&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;
==Cancel effect==&lt;br /&gt;
{{New items|5620|1.4|&lt;br /&gt;
If this event is [[Event system#Canceling|canceled]], then all GTA and MTA binds, bound to the canceled key, won't be triggered.&lt;br /&gt;
'''Note:''' the escape key can only be cancelled once. If a user presses the escape key twice in a row the main menu will still open.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example will say in chatbox every time the user presses down a a key.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerPressedKey(button, press)&lt;br /&gt;
    if (press) then -- Only output when they press it down&lt;br /&gt;
        outputChatBox(&amp;quot;You pressed the &amp;quot;..button..&amp;quot; key!&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientKey&amp;quot;, root, playerPressedKey)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example outputs if the client moves his mousewheel.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientKey&amp;quot;, root, function(button,press) &lt;br /&gt;
    -- Since mouse_wheel_up and mouse_wheel_down cant return a release, we dont have to check the press.&lt;br /&gt;
    if button == &amp;quot;mouse_wheel_up&amp;quot; or button == &amp;quot;mouse_wheel_down&amp;quot; then&lt;br /&gt;
        outputDebugString( button .. &amp;quot; moved.&amp;quot; )&lt;br /&gt;
        return true&lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end )&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>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetAllElementData&amp;diff=41542</id>
		<title>GetAllElementData</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetAllElementData&amp;diff=41542"/>
		<updated>2014-08-20T16:00:50Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: fixed example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
&lt;br /&gt;
Returns a table of all element data of an element.&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 getAllElementData ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP|This function is also a static function underneath the Element class.|[[element]]:getAllData||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' the element you want to get the element data of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If successful, returns a table with as keys the names of the element data and as values the corresponding element data values. Returns ''false'' in case of failure.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example script creates a new console command that displays all element data that is currently set on the player who enters the command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getMyData ( thePlayer, command )&lt;br /&gt;
    local data = getAllElementData ( thePlayer )     -- get all the element data of the player who entered the command&lt;br /&gt;
    for k, v in pairs ( data ) do                    -- loop through the table that was returned&lt;br /&gt;
        outputConsole ( k .. &amp;quot;: &amp;quot; .. tostring ( v ) )             -- print the name (k) and value (v) of each element data, we need to make the value a string, since it can be of any data type&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;elemdata&amp;quot;, getMyData )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=41403</id>
		<title>AddEventHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddEventHandler&amp;diff=41403"/>
		<updated>2014-08-16T15:29:24Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: fixed 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 event name, as this can lead to confusion if multiple handler functions are used.}}&lt;br /&gt;
This function will add an [[event]] handler. An event handler is a function that will be called when the event it's attached to is triggered. See [[event system]] for more information on how the event system works.&lt;br /&gt;
&lt;br /&gt;
Event handlers are functions that are called when a particular event happens. Each event specifies a specific set of variables that are passed to the event handler and can be read by your function. The following global variables are available for use in handler functions:&lt;br /&gt;
*'''source''': the element that triggered the event&lt;br /&gt;
*'''this''': the element that the event handler is attached to&lt;br /&gt;
&amp;lt;!-- no worky&lt;br /&gt;
*'''sourceResource''': the resource that triggered the event&lt;br /&gt;
*'''sourceResourceRoot''': the root element of the resource that triggered the event&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
*'''client''': the client that triggered the event using [[triggerServerEvent]]. Not set if the event was not triggered from a client.&lt;br /&gt;
{{New_feature|3|1.0|&lt;br /&gt;
*'''eventName''': the name of the event which triggered the handler function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
It is important to remember that events pass up and down the [[element tree]]. An event triggered on the root element is triggered on every element in the tree. An event triggered on any other element is triggered on its ancestors (its parent element and its parent's parent etc) and its children, grandchildren and great-grandchildren. You can use the ''getPropagated'' argument to specify if you wish your handler to receive events that have propagated up or down the tree.&lt;br /&gt;
&lt;br /&gt;
The order in which event handlers are triggered is undefined, you should not rely on one event handler being executed before another.&lt;br /&gt;
{{Note|See [[Script security]] for tips on preventing cheaters when using events and element data}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [ bool getPropagated = true, string priority = &amp;quot;normal&amp;quot; ] )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''eventName:''' The name of the [[event]] you want to attach the handler function to.&lt;br /&gt;
*'''attachedTo:''' The [[element]] you wish to attach the handler to. The handler will only be called when the event it is attached to is triggered for this element, or one of its children. Often, this can be the root element (meaning the handler will be called when the event is triggered for ''any'' element).&lt;br /&gt;
*'''handlerFunction:''' The handler function you wish to call when the event is triggered. This function will be passed all of the event's parameters as arguments, but it isn't required that it takes all of them.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''getPropagated:''' A boolean representing whether the handler will be triggered if the event was propagated down or up the [[element tree]] (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to ''false'' will only be triggered if ''source == this'').&lt;br /&gt;
{{New_feature|3.0131|1.3.1|&lt;br /&gt;
*'''priority :''' A string representing the trigger order priority relative to other event handlers of the same name. Possible values are:&lt;br /&gt;
**'''&amp;quot;high&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;normal&amp;quot;'''&lt;br /&gt;
**'''&amp;quot;low&amp;quot;'''&lt;br /&gt;
''It is also possible to add finer priority control by appending a positive or negative number to the priority string. For example (in priority order for reference): &amp;quot;high+4&amp;quot; &amp;quot;high&amp;quot; &amp;quot;high-1&amp;quot; &amp;quot;normal-6&amp;quot; &amp;quot;normal-7&amp;quot; &amp;quot;low+1&amp;quot; &amp;quot;low&amp;quot; &amp;quot;low-1&amp;quot;''&lt;br /&gt;
'''Important note:''' Anything bound to a specific element will be run before other handlers that are bound to something higher in the element tree (like root) This means that &amp;quot;high+10&amp;quot; bound to root won't trigger before &amp;quot;normal&amp;quot; bound directly to an element.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the event handler was attached successfully. Returns ''false'' if the specified event could not be found or any parameters were invalid.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This serverside example sends a message to everyone in the server when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- get the root element&lt;br /&gt;
rootElement = getRootElement()&lt;br /&gt;
-- define our handler function&lt;br /&gt;
function onPlayerSpawnHandler ( )&lt;br /&gt;
	-- get the player's name, source is the player because he was spawned&lt;br /&gt;
	local playerName = getPlayerName( source )&lt;br /&gt;
	-- output in the chat box that they've spawned&lt;br /&gt;
	outputChatBox ( playerName .. &amp;quot; has spawned!&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerSpawn&amp;quot;, rootElement, onPlayerSpawnHandler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.0-9.03795|Added priority argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event_functions}}&lt;br /&gt;
[[ru:addEventHandler]]&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=BitExtract&amp;diff=37036</id>
		<title>BitExtract</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=BitExtract&amp;diff=37036"/>
		<updated>2013-09-05T18:00:21Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: added small example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
{{Needs_Example}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0132|1.3.2|5340|&lt;br /&gt;
This function returns the unsigned number formed by the bits field to field + width - 1 (range: 0-31).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
uint bitExtract ( uint var, int field, [int width = 1] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''var:''' The value&lt;br /&gt;
*'''field:''' The field number&lt;br /&gt;
*'''width:''' Number of bits to extract&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the extracted value/bit sequence.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getColorAlpha(color)&lt;br /&gt;
   return bitExtract(color,24,8) -- return bits 24-32 ( the alpha, http://en.wikipedia.org/wiki/RGBA_color_space ) &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Bit_functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=36933</id>
		<title>Requested Functions and Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=36933"/>
		<updated>2013-08-20T17:40:40Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Server-side */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Server-side==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Event like onServerTick wich is run very often. Like the clientside onClientRender. This could be useful for constat checking wich must be done under 50ms (lower than timers can handle).&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
onVehicleCreated or an equivalent... shouldn't be too hard? -Robhol (14:15 Jul 6, 08)&lt;br /&gt;
:If we did it, it'd be onElementCreated - what do you want this for? [[User:EAi|eAi]] 08:58, 7 July 2008 (CDT)&lt;br /&gt;
::onElementCreated is a good idea - it could be used for lots of things. Also, how about onVehicleDrown or whatever? that is, when a vehicle hits deep water. Checking for collisions and stuff is very awkward, and client-side only, and has to be checked constantly.. -Robhol (17:31 Jul 9 08)&lt;br /&gt;
:::I second that. It would be useful if you use like me element data like the fuel amount or other stuff. And an event like this would help me to setup those element data, when a car spawns. Otherwise I would either have to edit every car spawn script I use or do a post-setup when someone is entering the car.. [[User:MaddDogg14]] (04:34 Apr 4, 10 (CEST))&lt;br /&gt;
::::i definetly agree, onElementCreated would be VERY useful for utility/librares scripts, but i think this should be limited by ACL, because &amp;quot;evil&amp;quot; scripts could abuse this othervise -Karlis (9:10 Apr 5, 10)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I ask for a function that detects if a ped is on floor, eg. '''isPedOnFloor(ped thePed)''', thanks. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 11:29, 15 June 2008 (CDT)&lt;br /&gt;
: [[isPedOnGround]]? [[User:Awwu|Awwu]] 12:58, 15 June 2008 (CDT)&lt;br /&gt;
::I need to know if the player has its back touching the ground, not if it's simply &amp;quot;on ground&amp;quot;. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 14:16, 16 June 2008 (CDT)&lt;br /&gt;
:::Check what task the player has, they should have TASK_COMPLEX_FALL_AND_GET_UP or TASK_COMPLEX_FALL_AND_STAY_DOWN... [[User:EAi|eAi]] 19:12, 16 June 2008 (CDT)&lt;br /&gt;
::::Thanks. What task does player have after being hitten by a melee attack that cause it to fall down? Would &amp;quot;TASK_SIMPLE_BE_KICKED_ON_GROUND&amp;quot; and &amp;quot;TASK_SIMPLE_GET_UP&amp;quot; work? --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 09:35, 17 June 2008 (CDT)&lt;br /&gt;
:::::Try it, I'm not entirely sure. You should be able to produce some code to show the player's current tasks very easily... [[User:EAi|eAi]] 19:20, 17 June 2008 (CDT)&lt;br /&gt;
::::::My goal is to edit the standard damage of the attacks, in this case i have to know when player is on ground to cause higher damage. However it doesn't seem to work, when i hit the player it simply gets up without animation with no damage. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 19:10, 19 June 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It may looks strange and useless (waste of time?) but I think that it could be a awesome feature. Having a web browser.&lt;br /&gt;
Like: http://www.youtube.com/watch?v=wT1UR6qEgdg&lt;br /&gt;
http://princeofcode.com/awesomium.php&lt;br /&gt;
:definetly useles and waste of time, suporting xfire enought. -karlis&lt;br /&gt;
::Really Karlis, who asked you bro. It could be very useful, actually. For example, creating dynamic billboards. Instead of changing the TXD, they could set up a browser object over the billboard. That way they can also set up a timer to change the image, etc. [[User:JacobS|JacobS]] 20:08, 1 August 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
There could be something like createBrowser( float x, float y, float z, [float rx, float ry, float rz, float width, float high, string url, bool locked] ) &lt;br /&gt;
locked parameter: false = navigation bar present, true = no navigation bar&lt;br /&gt;
toggleBrowserFullsceenMode(browser theBrowser, bool tog, [bool smooth])&lt;br /&gt;
smooth parameter: If set to true the browser will smoothly move from his ingame position to the fullscreen position&lt;br /&gt;
toggleBrowserBackground(browser theBrowser, bool tog)&lt;br /&gt;
Set the browser background transparent.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Security: Disable file downloads, disable popups (disable flash, javascript and any other protocols than http and https [no mailto and stuff...]?)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Should be a Client and server function. --[[User:Masterofquebec|Masterofquebec]] 00:10, 15 October 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Support of tooltips from CEGUI would be cool. I saw a property for that, but it didn't work for me. [[User:MaddDogg14]] (04:36 Apr 4, 10 (CEST))&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I request a function that gets all clothes from a ped, just like getPedClothes but for all bodyparts. With this function it would be more ease to save clothes to database.&lt;br /&gt;
:That's so easy to do yourself that it's barely worth adding. Just loop all the indexes 0-17 and save them to a table. [[User:Awwu|Awwu]] 19:26, 17 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[setProjectileTarget]] for setting a projectile to target a specific entity. I am trying to create a Battlefield Bad Company type of gamemode and in that game, you can plant a 'tracer'. Any rocket fired (if the tracer is on screen) will seek the tracer. [[User:LeetWoovie|LeetWoovie]] 05:01, 19 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
(marcol07, June the 25th, 2010) I would like to have some function to create light source as element or sth like createFire, for example createLight(x,y,z,xrot,yrot,zrot,f,r,g,b) where &amp;quot;f&amp;quot; is an angle of lightning. or it is possible with some model or function? It would be good to create for example fog lamps or classic street lamps&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
moveElement available for markers, objects, pedestrians and players or maybe more if you can do. [[User:Socialz|Socialz]] 13:10, 1 January 2012 (CET)&lt;br /&gt;
&lt;br /&gt;
==Client-Side==&lt;br /&gt;
&lt;br /&gt;
Event &amp;quot;onClientVehicleFire&amp;quot;, which would be triggered when a vehicle shoots.&lt;br /&gt;
:See [[OnVehicleWeaponFire]] --[[User:X86dev|X86dev]] 12:11, 19 April 2013 (UTC)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Adding possibility to toggle radio hud label by '''showHudComponent''' -karlis  &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Pickup events clientside please, onClientPickupHit onClientPickupUse.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Would it be possible to add a color arg to guiGridListSetItemText()? Im trying to get each item colored differently in one list. Thanks, ABEL&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I need a function which could get current target of hydra or a HS rocket launcher, like when someone press space and targets a element, to get what element is it for calculating distance from it. '''getPlayerOccupiedVehicleTarget''' or '''getPlayerHSTarget'''. &lt;br /&gt;
Thanks in advance -Nidza a.k.a. CodeMaster 2:26 PM 19th June 2008.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It'd be useful to have something to disable elements of the default hud (weapon display, health display, armor, radar, etcetera) so that you can create your own HUDs. Something like '''setHudElement(element name, toggle)'''.&lt;br /&gt;
&lt;br /&gt;
[[User:Lord Xalphox|Lord Xalphox]] 19:32, 22 March 2009 (CET)&lt;br /&gt;
:[[showPlayerHudComponent]]? [[User:Awwu|Awwu]] 19:43, 22 March 2009 (CET)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I'd like to have a function that sets the chatbox input line text. Then I could script my own chat history function (that inserts the last sent text into the input line again by pressing arrow up) (which samp has since 0.2 btw) since nobody builds it into the client. [[User:NeonBlack|NeonBlack]] 12:03, 4 July 2009 (CEST) PS.: samp also supports cut, copy and paste :P&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
A function setElementMatrix, doing the exact opposite of getElementMatrix would be much appreciated. --[[User:Kayl|Kayl]] 15:21, 13 November 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Functions like setTrainPosition(train,track,pos) and track,pos getTrainPosition(train) would be great in order to allow more script side control of trains.&lt;br /&gt;
The track argument would be an index of the track number (currently there are around 4 tracks handled, including 1 incompletely defined).&lt;br /&gt;
The position would be a float between 0 and 1 (or however you guys handle it) telling where on the track the train currently is.&lt;br /&gt;
It would be great if those functions could be available client and server side. --[[User:Kayl|Kayl]] 12:58, 23 November 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
need this function client and server side '''movePlayerHudComponent(string component, float x, float y)''' --[[User:SuatEyrice|SuatEyrice]] 00:18, 26 February 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''(marcol07, June the 27th, 2010)''' I would be so happy to have fuction to set Analog control of player sth like '''getAnalogControlState(string controlName)''' but inverted to '''setAnalogControlState(string controlName, float state)'''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
OnPedDamage (serverside) event. There is OnClientPedDamage, but it's clientside. [[User:damage22|damage22]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
'''setRadioVolume(element thePlayer, int volume)''', to create GUI volume control, turn off the radio without changing the station, etc. [[User:JacobS|JacobS]] 14:47, 29 July 2010 (UTC)&lt;br /&gt;
----&lt;br /&gt;
'''setVehicleHydraulics(element theVehicle, bool state)''', to force hydraulics to be up (true) or down (false)&lt;br /&gt;
----&lt;br /&gt;
'''createFire(x, y, z, theSize, dimension)''', just like [[createFire]], only with the option to enter a dimension for the fire to appear in&lt;br /&gt;
----&lt;br /&gt;
'''setGunshotsEnabled(bool enabled)''', '''getGunshotsEnabled()''' and '''createGunshot(x,y,z,radius)''' - to enable/disable the game's gunshot ambience, and to create gunshots at specific locations with radii that it is audible in [[User:JacobS.|JacobS.]] 19:28, 11 September 2010 (MDT)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
onClick  should pass the name of the clicked SUBobject too (eg: vehicle parts, bone names etc.)--[[User:Lcaseidefensis|Lcaseidefensis]] 16:48, 21 May 2012 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
something to open/close doors like in singleplayer (teleports are a bit unrealistic)&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawImage&amp;diff=36818</id>
		<title>DxDrawImage</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawImage&amp;diff=36818"/>
		<updated>2013-08-02T12:08:10Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
&lt;br /&gt;
Draws an image on the screen for a single frame. In order for the image to stay visible continuously, you need to call this function with the same parameters on each frame update (see [[onClientRender]]).&amp;lt;br/&amp;gt;&lt;br /&gt;
Image files should ideally have dimensions that are a power of two, to prevent possible blurring.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Power of two: 2px, 4px, 8px, 16px, 32px, 64px, 128px, 256px, 512px, 1024px...&amp;lt;/b&amp;gt;&lt;br /&gt;
{{Note|To help prevent edge artifacts when drawing textures, set '''textureEdge''' to '''&amp;quot;clamp&amp;quot;''' when calling [[dxCreateTexture]]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool dxDrawImage ( float posX, float posY, float width, float height, mixed image [, float rotation = 0, float rotationCenterOffsetX = 0, &lt;br /&gt;
float rotationCenterOffsetY = 0, int color = tocolor(255,255,255), bool postGUI = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''posX:''' the absolute X coordinate of the top left corner of the image&lt;br /&gt;
*'''posY:''' the absolute Y coordinate of the top left corner of the image&lt;br /&gt;
*'''width:''' the absolute width of the image&lt;br /&gt;
*'''height:''' the absolute height of the image&lt;br /&gt;
*'''image:''' Either a [[material]] element or a [[filepath]] of the image which is going to be drawn. (.dds images are also supported). Image files should ideally have dimensions that are a power of two, to prevent possible blurring.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''rotation:''' the rotation, in degrees for the image.&lt;br /&gt;
*'''rotationCenterOffsetX:''' the absolute X offset from the image center for which to rotate the image from.&lt;br /&gt;
*'''rotationCenterOffsetY:''' the absolute Y offset from the image center for which to rotate the image from.&lt;br /&gt;
*'''color:''' Tints the image with a value produced by [[tocolor]] or hexadecimal number in format: 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
*'''postgui :''' A bool representing whether the image should be drawn on top of or behind any ingame GUI (rendered by CEGUI).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;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 pendulum swinging from the top of the screen, made using dxDrawImage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local screenWidth,screenHeight = guiGetScreenSize()  -- Get screen resolution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function renderDisplay ( )&lt;br /&gt;
	local seconds = getTickCount() / 1000&lt;br /&gt;
	local angle = math.sin(seconds) * 80&lt;br /&gt;
	-- This will draw the graphic file 'arrow.png' at the top middle of the screen&lt;br /&gt;
	-- using the size of 100 pixels wide, and 240 pixels high.&lt;br /&gt;
	-- The center of rotation is at the top of the image.&lt;br /&gt;
	dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, 'arrow.png', angle, 0, -120 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function HandleTheRendering ( )&lt;br /&gt;
	addEventHandler(&amp;quot;onClientRender&amp;quot;, getRootElement(), renderDisplay)  -- Keep everything visible with onClientRender.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;,resourceRoot, HandleTheRendering)&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;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Damage_Types&amp;diff=34444</id>
		<title>Damage Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Damage_Types&amp;diff=34444"/>
		<updated>2013-01-11T16:57:56Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: fixed table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following death reasons are used by event like onPlayerWasted for the killerWeapon argument to describe the reason, why a ped died.&amp;lt;br&amp;gt;&lt;br /&gt;
When a player was shot by a weapon, the respective weapon ID is the death reason ID. The weapon IDs can be found [[Weapons|here]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
:{|class=&amp;quot;wikitable sortable&amp;quot; style=&amp;quot;width: auto; table-layout: fixed;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!ID&lt;br /&gt;
! class=&amp;quot;unsortable&amp;quot; |Death reason&lt;br /&gt;
! class=&amp;quot;unsortable&amp;quot; |Additional info&lt;br /&gt;
|-&lt;br /&gt;
!19&lt;br /&gt;
|Rocket&lt;br /&gt;
|Actual death reason / weapon ID when dying from a rocket launcher&lt;br /&gt;
|-&lt;br /&gt;
!37&lt;br /&gt;
|Burnt&lt;br /&gt;
|This is used by a death by fire, even when the fire is created by a rocket explosion or a molotov&lt;br /&gt;
|-&lt;br /&gt;
!49&lt;br /&gt;
|Rammed&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!50&lt;br /&gt;
|Ranover&lt;br /&gt;
|This is also called when dying because of helicopter blades&lt;br /&gt;
|-&lt;br /&gt;
!51&lt;br /&gt;
|Explosion&lt;br /&gt;
|This may sometimes also be used at an indirect death through an exploding rocket&lt;br /&gt;
|-&lt;br /&gt;
!52&lt;br /&gt;
|Driveby&lt;br /&gt;
|This is NOT used for a driveby kill with e.g. the 'realdriveby' resource&lt;br /&gt;
|-&lt;br /&gt;
!53&lt;br /&gt;
|Drowned&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!54&lt;br /&gt;
|Fall&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!55&lt;br /&gt;
|Unknown&lt;br /&gt;
|No known information about this death reason&lt;br /&gt;
|-&lt;br /&gt;
!56&lt;br /&gt;
|Melee&lt;br /&gt;
|Seems to be never called (?); for an actual melee death, the fist weapon ID (0) is used (see [[Weapons|here]])&lt;br /&gt;
|-&lt;br /&gt;
!57&lt;br /&gt;
|Weapon&lt;br /&gt;
|Seems to be never called (?)&lt;br /&gt;
|-&lt;br /&gt;
!59&lt;br /&gt;
|Tank Grenade&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
!63&lt;br /&gt;
|Blown&lt;br /&gt;
|Actual death reason when dying in a vehicle explosion&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Death Reasons in lua table&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local deathReasons = {&lt;br /&gt;
	[19] = &amp;quot;Rocket&amp;quot;,&lt;br /&gt;
	[37] = &amp;quot;Burnt&amp;quot;,&lt;br /&gt;
	[49] = &amp;quot;Rammed&amp;quot;,&lt;br /&gt;
	[50] = &amp;quot;Ranover/Helicopter Blades&amp;quot;,&lt;br /&gt;
	[51] = &amp;quot;Explosion&amp;quot;,&lt;br /&gt;
	[52] = &amp;quot;Driveby&amp;quot;,&lt;br /&gt;
	[53] = &amp;quot;Drowned&amp;quot;,&lt;br /&gt;
	[54] = &amp;quot;Fall&amp;quot;,&lt;br /&gt;
	[55] = &amp;quot;Unkown&amp;quot;,&lt;br /&gt;
	[56] = &amp;quot;Meele&amp;quot;,&lt;br /&gt;
	[57] = &amp;quot;Weapon&amp;quot;,&lt;br /&gt;
	[59] = &amp;quot;Tank Grenade&amp;quot;,&lt;br /&gt;
	[63] = &amp;quot;Blown&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[ru:Death Reasons]]&lt;br /&gt;
[[de:Todesgründe]]&lt;br /&gt;
&lt;br /&gt;
[[Category:ID Lists]]&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RestoreAllWorldModels&amp;diff=34115</id>
		<title>RestoreAllWorldModels</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RestoreAllWorldModels&amp;diff=34115"/>
		<updated>2012-11-10T20:21:58Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function|New items}}&lt;br /&gt;
This function allows restoring of all world objects,which were removed with [[RemoveWorldModel]].&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 restoreAllWorldModels()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if the world objects were restored, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.2.0-9.03618|1.2.0-9.03618|}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example restore all world objects.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;restoreallworldobjects&amp;quot;,&lt;br /&gt;
  function()&lt;br /&gt;
    restoreAllWorldModels()&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_world_functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DownloadFile&amp;diff=33546</id>
		<title>DownloadFile</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DownloadFile&amp;diff=33546"/>
		<updated>2012-09-22T23:34:10Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New items|3.0151|1.4|&lt;br /&gt;
This function downloads a file from the HTTP server. This can only be used on files on the HTTP server associated with the MTA server and will only download files from within the folder of the resource that is calling it. The '''file''' should also be included in meta.xml with the '''download''' attribute set to &amp;quot;false&amp;quot;, see [[meta.xml]] for more details. If the file has been previously downloaded and the CRC matches, the file will not be downloaded again but [[onClientFileDownloadComplete]] will still run.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool downloadFile ( string fileName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''fileName''': A string referencing the name of the file to download&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if file download has been queued, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This client side event downloads a file when the current resource has started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- the function is called on resource start&lt;br /&gt;
function onThisResourceStart ( )&lt;br /&gt;
    downloadFile ( &amp;quot;test.txt&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientResourceStart&amp;quot;, resourceRoot, onThisResourceStart )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_utility_functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Control_names&amp;diff=33088</id>
		<title>Control names</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Control_names&amp;diff=33088"/>
		<updated>2012-09-02T15:23:38Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* GTA control list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists all the control names. These can be used as key arguments by the console commands ''bind'' and ''unbind'' as well as the script functions [[bindKey]], [[unbindKey]] etc.&lt;br /&gt;
&lt;br /&gt;
==GTA control list==&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:3px solid green;margin-bottom:3px;&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;float:right;padding-right:5px;font-weight:bold;&amp;quot;&amp;gt;ON FOOT&amp;lt;/div&amp;gt;&lt;br /&gt;
* '''fire''' Fire a player's weapon&lt;br /&gt;
* '''next_weapon''' Switch to the next weapon&lt;br /&gt;
* '''previous_weapon''' Switch to the previous weapon&lt;br /&gt;
* '''forwards''' Move forwards&lt;br /&gt;
* '''backwards''' Move backwards&lt;br /&gt;
* '''left''' Move left&lt;br /&gt;
* '''right''' Move right&lt;br /&gt;
* '''zoom_in''' Zoom targeted weapon in (sniper/rocket launcher/camera etc)&lt;br /&gt;
* '''zoom_out''' Zoom targeted weapon out&lt;br /&gt;
* '''change_camera''' Change camera mode&lt;br /&gt;
* '''jump''' Make the player jump&lt;br /&gt;
* '''sprint''' Make the player sprint&lt;br /&gt;
* '''look_behind''' Make the player look behind (and allow the player to see behind them)&lt;br /&gt;
* '''crouch''' Make the player crouch/duck&lt;br /&gt;
* '''action''' Show the stats menu&lt;br /&gt;
* '''walk''' Make the player move slowly/quietly&lt;br /&gt;
* '''aim_weapon''' Aim the player's current weapon (if possible)&lt;br /&gt;
* '''conversation_yes''' Answer yes to a question&lt;br /&gt;
* '''conversation_no''' Answer no to a question&lt;br /&gt;
* '''group_control_forwards''' Make the group you are controlling move forwards&lt;br /&gt;
* '''group_control_back''' Make the group you are controlling move backwards&lt;br /&gt;
* '''enter_exit''' Make the player enter a vehicle. Also used for alternative fighting styles.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:3px solid red;margin-bottom:3px;&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;float:right;padding-right:5px;font-weight:bold;&amp;quot;&amp;gt;IN VEHICLE&amp;lt;/div&amp;gt;&lt;br /&gt;
* '''vehicle_fire''' Fire the player's vehicle's primary weapon (e.g. hunter's missiles) or shoot with driveby&lt;br /&gt;
* '''vehicle_secondary_fire''' Fire the player's vehicle's secondary weapon (e.g. hunter's minigun)&lt;br /&gt;
* '''vehicle_left''' Make the player's vehicle turn left&lt;br /&gt;
* '''vehicle_right''' Make the player's vehicle turn right&lt;br /&gt;
* '''steer_forward''' Make the player's vehicle turn down (lean forwards for helicopters/planes)&lt;br /&gt;
* '''steer_back''' Make the player's vehicle turn up (lean backwards for helicopters/planes)&lt;br /&gt;
* '''accelerate''' Make the player's vehicle accelerate&lt;br /&gt;
* '''brake_reverse''' Make the player's vehicle brake (slow down) and if stationary reverse&lt;br /&gt;
* '''radio_next''' Change to the next radio station&lt;br /&gt;
* '''radio_previous''' Change to the previous radio station&lt;br /&gt;
* '''radio_user_track_skip''' Skip the current track being played on the custom radio station&lt;br /&gt;
* '''horn''' Play the horn of the player's vehicle (if the vehicle has a horn) and can trigger the siren on emergency vehicles&lt;br /&gt;
* '''sub_mission''' Start a submission if one is avaliable (e.g. taxi missions)&lt;br /&gt;
* '''handbrake''' Apply the handbrake on the player's vehicle&lt;br /&gt;
* '''vehicle_look_left''' Look to the left&lt;br /&gt;
* '''vehicle_look_right''' Look to the right&lt;br /&gt;
* '''vehicle_look_behind''' Look behind&lt;br /&gt;
* '''vehicle_mouse_look''' &lt;br /&gt;
* '''special_control_left''' Move the some special vehicle component left (e.g. tank's turret)&lt;br /&gt;
* '''special_control_right''' Move the some special vehicle component right (e.g. tank's turret)&lt;br /&gt;
* '''special_control_down''' Move the some special vehicle component down (e.g. tank's turret)&lt;br /&gt;
* '''special_control_up''' Move the some special vehicle component up (e.g. tank's turret)&lt;br /&gt;
* '''enter_exit''' Make the player exit a vehicle&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==MTA hard-coded commands==&lt;br /&gt;
The following are names of hard-coded MTA commands which do not use bindKey, but can act as bindKey by using them in an [[addCommandHandler]]. Other than that, this control list will '''only''' work with the functions [[toggleControl]] and [[toggleAllControls]]. Please note that [[toggleControl]] can't disable screenshot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:3px solid blue;margin-bottom:3px;&amp;quot;&amp;gt;&amp;lt;div&lt;br /&gt;
style=&amp;quot;float:right;padding-right:5px;font-weight:bold;&amp;quot;&amp;gt;MTA COMMANDS&amp;lt;/div&amp;gt;&lt;br /&gt;
* '''enter_passenger''' Enter's the closest vehicle as passenger&lt;br /&gt;
* '''playerlist''' Toggles the player-list showing&lt;br /&gt;
* '''screenshot''' Takes a screenshot&lt;br /&gt;
* '''chatbox''' Opens the chatbox for input&lt;br /&gt;
* '''radar''' Toggles the radar-map showing&lt;br /&gt;
* '''radar_zoom_in''' Zooms in on the radar-map&lt;br /&gt;
* '''radar_zoom_out''' Zooms out on the radar-map&lt;br /&gt;
* '''radar_move_north''' Moves north on the radar-map&lt;br /&gt;
* '''radar_move_south''' Moves south on the radar-map&lt;br /&gt;
* '''radar_move_east''' Moves east on the radar-map&lt;br /&gt;
* '''radar_move_west''' Moves west on the radar-map&lt;br /&gt;
* '''radar_attach''' Attaches the view to the local-player on the radar-map&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ToggleControl&amp;diff=32397</id>
		<title>ToggleControl</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ToggleControl&amp;diff=32397"/>
		<updated>2012-08-19T17:05:12Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{Needs Checking|By enabling a control all bindings belonging to it seem to be deleted. (tested clientside) --[[User:NeonBlack|NeonBlack]] 16:48, 28 August 2009 (UTC)}}&lt;br /&gt;
Enables or disables the use of a GTA control for a specific player.&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;bool toggleControl ( player thePlayer, string control, bool enabled ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player you wish to toggle the control ability of.&lt;br /&gt;
*'''control:''' The control that you want to toggle the ability of. See [[control names]] for a list of possible controls.&lt;br /&gt;
*'''enable:''' A boolean value representing whether or not the key will be usable or not.&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;bool toggleControl ( string control, bool enabled ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''control:''' The control that you want to toggle the ability of. See [[control names]] for a list of possible controls.&lt;br /&gt;
*'''enable:''' A boolean value representing whether or not the key will be usable or not.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
This function ''true'' if the control was set successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This function will disable the use of the vehicle secondary-fire key for anyone in a Hydra, consequently removing the ability to fire rockets.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFireForHydra ( theVehicle, seat, jacked )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra&lt;br /&gt;
        toggleControl ( source, &amp;quot;vehicle_secondary_fire&amp;quot;, false ) -- disable their fire key&lt;br /&gt;
    else -- if they entered another vehicle&lt;br /&gt;
        toggleControl ( source, &amp;quot;vehicle_secondary_fire&amp;quot;, true ) -- enable their fire key&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, getRootElement(), disableFireForHydra )&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;Example 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This function will disable the use of the vehicle secondary-fire key for anyone in a Hydra, consequently removing the ability to fire rockets.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFireForHydra ( theVehicle, seat )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra&lt;br /&gt;
        toggleControl ( &amp;quot;vehicle_secondary_fire&amp;quot;, false ) -- disable their fire key&lt;br /&gt;
    else -- if they entered another vehicle&lt;br /&gt;
        toggleControl ( &amp;quot;vehicle_secondary_fire&amp;quot;, true ) -- enable their fire key&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPlayerVehicleEnter&amp;quot;, getLocalPlayer(), disableFireForHydra )&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;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ToggleControl&amp;diff=32396</id>
		<title>ToggleControl</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ToggleControl&amp;diff=32396"/>
		<updated>2012-08-19T17:05:01Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{Needs Checking|By enabling a control all bindings belonging to it seem to be deleted. (tested clientside) --[[User:NeonBlack|NeonBlack]] 16:48, 28 August 2009 (UTC)}}&lt;br /&gt;
Enables or disables the use of a GTA control for a specific player.&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;bool toggleControl ( player thePlayer, string control, bool enabled ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player you wish to toggle the control ability of.&lt;br /&gt;
*'''control:''' The control that you want to toggle the ability of. See [[control names]] for a list of possible controls.&lt;br /&gt;
*'''enable:''' A boolean value representing whether or not the key will be usable or not.&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;bool toggleControl ( string control, bool enabled ) &amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''control:''' The control that you want to toggle the ability of. See [[control names]] for a list of possible controls.&lt;br /&gt;
*'''enable:''' A boolean value representing whether or not the key will be usable or not.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
This function ''true'' if the control was set successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==  &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This function will disable the use of the vehicle secondary-fire key for anyone in a Hydra, consequently removing the ability to fire rockets.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFireForHydra ( theVehicle, seat, jacked )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra&lt;br /&gt;
        toggleControl ( source, &amp;quot;vehicle_secondary_fire&amp;quot;, false ) -- disable their fire key&lt;br /&gt;
    else -- if they entered another vehicle&lt;br /&gt;
        toggleControl ( source, &amp;quot;vehicle_secondary_fire&amp;quot;, true ) -- enable their fire key&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, getRootElement(), disableFireForHydra )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''Note: The same can be achieved by using [[setVehicleGunsEnabled]]''.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This function will disable the use of the vehicle secondary-fire key for anyone in a Hydra, consequently removing the ability to fire rockets.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFireForHydra ( theVehicle, seat )&lt;br /&gt;
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra&lt;br /&gt;
        toggleControl ( &amp;quot;vehicle_secondary_fire&amp;quot;, false ) -- disable their fire key&lt;br /&gt;
    else -- if they entered another vehicle&lt;br /&gt;
        toggleControl ( &amp;quot;vehicle_secondary_fire&amp;quot;, true ) -- enable their fire key&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPlayerVehicleEnter&amp;quot;, getLocalPlayer(), disableFireForHydra )&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;
{{Input functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30850</id>
		<title>OnClientProjectileCreation</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30850"/>
		<updated>2012-05-17T22:45:36Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */ fixed some grammar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered when a [[projectile]] is created.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element creator&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[projectile]] that was created.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This will output a chatbox message when someone creates a projectile.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function projectileCreation()&lt;br /&gt;
	outputChatBox(&amp;quot;A projectile was created!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), projectileCreation)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will punish a player for throwing a teargas grenade. When he throws it he keeps getting warped to the location where the teargas got created, and also the teargas keeps getting warped to it. This will result in  +/-60hp loss for the creator.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function punishSatchelUsersz ( creator )&lt;br /&gt;
local zeType = getProjectileType( source )&lt;br /&gt;
if zeType == 17 then&lt;br /&gt;
local zePlayerName = getPlayerName ( creator )&lt;br /&gt;
outputChatBox ( zePlayerName..&amp;quot; is a noob teargas user! But he got punished for it don't worry.&amp;quot; )&lt;br /&gt;
local x, y, z = getElementPosition ( source ) --Getting the position from the projectile creator&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, source, x, y, z-0.5 )&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, creator, x, y, z-0.5 )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), punishSatchelUsersz )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will disable people from creating flares. ( Dropped by Hydras )&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFlares ( )&lt;br /&gt;
local projType = getProjectileType( source ) --  get the projectile type&lt;br /&gt;
&lt;br /&gt;
    if projType == 58 then -- if the projectile is a flare&lt;br /&gt;
	&lt;br /&gt;
	destroyElement(source) -- notice cancelEvent() does not work, so this destroys the projectile element after it was created.&lt;br /&gt;
		&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), disableFlares ) -- when a projectile gets created call disableFlares.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client projectile events===&lt;br /&gt;
{{Client_projectile_events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30849</id>
		<title>OnClientProjectileCreation</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30849"/>
		<updated>2012-05-17T22:18:13Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered when a [[projectile]] is created.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element creator&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[projectile]] that was created.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This will output a chatbox message when someone creates a projectile.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function projectileCreation()&lt;br /&gt;
	outputChatBox(&amp;quot;A projectile was created!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), projectileCreation)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will punish a player for throwing a teargas grenade. When he throws it he keeps getting warped to the location where the teargas got created, and also the teargas keeps getting warped to it. This will result in  +/-60hp loss for the creator.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function punishSatchelUsersz ( creator )&lt;br /&gt;
local zeType = getProjectileType( source )&lt;br /&gt;
if zeType == 17 then&lt;br /&gt;
local zePlayerName = getPlayerName ( creator )&lt;br /&gt;
outputChatBox ( zePlayerName..&amp;quot; is a noob teargas user! But he got punished for it don't worry.&amp;quot; )&lt;br /&gt;
local x, y, z = getElementPosition ( source ) --Getting the position from the projectile creator&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, source, x, y, z-0.5 )&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, creator, x, y, z-0.5 )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), punishSatchelUsersz )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will disable people from creating flares. ( Dropped by hydra's )&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFlares ( )&lt;br /&gt;
local projType = getProjectileType( source ) --  get the projectile type&lt;br /&gt;
&lt;br /&gt;
    if projType == 58 then -- if the projectile is a flare&lt;br /&gt;
	&lt;br /&gt;
	destroyElement(source) -- notice cancelEvent() does not work, so this destroys the projectile element after it was created.&lt;br /&gt;
		&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), disableFlares ) -- when a projectile gets created call disableFlares.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client projectile events===&lt;br /&gt;
{{Client_projectile_events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30848</id>
		<title>OnClientProjectileCreation</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30848"/>
		<updated>2012-05-17T22:15:12Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered when a [[projectile]] is created.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element creator&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[projectile]] that was created.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This will output a chatbox message when someone creates a projectile.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function projectileCreation()&lt;br /&gt;
	outputChatBox(&amp;quot;A projectile was created!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), projectileCreation)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will punish a player for throwing a teargas grenade. When he throws it he keeps getting warped to the location where the teargas got created, and also the teargas keeps getting warped to it. This will result in  +/-60hp loss for the creator.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function punishSatchelUsersz ( creator )&lt;br /&gt;
local zeType = getProjectileType( source )&lt;br /&gt;
if zeType == 17 then&lt;br /&gt;
local zePlayerName = getPlayerName ( creator )&lt;br /&gt;
outputChatBox ( zePlayerName..&amp;quot; is a noob teargas user! But he got punished for it don't worry.&amp;quot; )&lt;br /&gt;
local x, y, z = getElementPosition ( source ) --Getting the position from the projectile creator&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, source, x, y, z-0.5 )&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, creator, x, y, z-0.5 )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), punishSatchelUsersz )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will disable people from creating flares. ( Dropped by hydra's )&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFlares ( creator )&lt;br /&gt;
local projType = getProjectileType( source ) --  get the projectile type&lt;br /&gt;
	if projType == 58 then -- if the projectile is a flare&lt;br /&gt;
	&lt;br /&gt;
		destroyElement(source) -- notice cancelEvent() does not work, so this destroys the projectile element after it was created.&lt;br /&gt;
		&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), disableFlares ) -- when a projectile gets created call disableFlares.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client projectile events===&lt;br /&gt;
{{Client_projectile_events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30847</id>
		<title>OnClientProjectileCreation</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientProjectileCreation&amp;diff=30847"/>
		<updated>2012-05-17T22:15:01Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client event}}&lt;br /&gt;
This event is triggered when a [[projectile]] is created.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element creator&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[projectile]] that was created.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This will output a chatbox message when someone creates a projectile.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function projectileCreation()&lt;br /&gt;
	outputChatBox(&amp;quot;A projectile was created!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), projectileCreation)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will punish a player for throwing a teargas grenade. When he throws it he keeps getting warped to the location where the teargas got created, and also the teargas keeps getting warped to it. This will result in  +/-60hp loss for the creator.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function punishSatchelUsersz ( creator )&lt;br /&gt;
local zeType = getProjectileType( source )&lt;br /&gt;
if zeType == 17 then&lt;br /&gt;
local zePlayerName = getPlayerName ( creator )&lt;br /&gt;
outputChatBox ( zePlayerName..&amp;quot; is a noob teargas user! But he got punished for it don't worry.&amp;quot; )&lt;br /&gt;
local x, y, z = getElementPosition ( source ) --Getting the position from the projectile creator&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, source, x, y, z-0.5 )&lt;br /&gt;
setTimer ( setElementPosition, 50, 250, creator, x, y, z-0.5 )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), punishSatchelUsersz )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will disable people from creating flares. ( Dropped by hydra's )&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function disableFlares ( creator )&lt;br /&gt;
local projType = getProjectileType( source ) --  get the projectile type&lt;br /&gt;
	if projType == 58 then -- if the projectile is a flare&lt;br /&gt;
	&lt;br /&gt;
		destroyElement(source) -- notice cancelEvent() does not work, so this destroys the projectile element after it was created.&lt;br /&gt;
		&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onClientProjectileCreation&amp;quot;, getRootElement(), disableFlares ) -- when a projectile gets created call disableFlares.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client projectile events===&lt;br /&gt;
{{Client_projectile_events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Projectiles&amp;diff=30846</id>
		<title>Template:Projectiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Projectiles&amp;diff=30846"/>
		<updated>2012-05-17T21:53:20Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: Adding flare from hydra&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: auto; text-align: center; table-layout: fixed;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!ID&lt;br /&gt;
!Name/Description&lt;br /&gt;
|-&lt;br /&gt;
|'''16'''&lt;br /&gt;
|Grenade&lt;br /&gt;
|-&lt;br /&gt;
|'''17'''&lt;br /&gt;
|Tear Gas Grenade&lt;br /&gt;
|-&lt;br /&gt;
|'''18'''&lt;br /&gt;
|Molotov&lt;br /&gt;
|-&lt;br /&gt;
|'''19'''&lt;br /&gt;
|Rocket (simple)&lt;br /&gt;
|-&lt;br /&gt;
|'''20'''&lt;br /&gt;
|Rocket (heat seeking)&lt;br /&gt;
|-&lt;br /&gt;
|'''21'''&lt;br /&gt;
|Air Bomb&lt;br /&gt;
|-&lt;br /&gt;
|'''39'''&lt;br /&gt;
|Satchel Charge&lt;br /&gt;
|-&lt;br /&gt;
|'''58'''&lt;br /&gt;
|Flare from hydra&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OutputChatBox&amp;diff=30617</id>
		<title>OutputChatBox</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OutputChatBox&amp;diff=30617"/>
		<updated>2012-05-13T00:56:59Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
{{Note_box|Avoid outputting text to the chatbox that isn't actually chat, as this can be annoying for players. Output information and status messages to the HUD.}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This outputs the specified text string to the chatbox. It can be specified as a message to certain player(s) or all players.&lt;br /&gt;
&lt;br /&gt;
It can optionally allow you to embed color changes into the string by setting the colorCoded boolean to true. This allows: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox ( &amp;quot;#FF0000Hello #00FF00World&amp;quot;, getRootElement(), 255, 255, 255, true )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This will display as: '''&amp;lt;span style='color:red;'&amp;gt;Hello&amp;lt;/span&amp;gt; &amp;lt;span style='color:green'&amp;gt;World&amp;lt;/span&amp;gt; '''&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;bool outputChatBox ( string text [, element visibleTo=getRootElement(), int r=255, int g=255, int b=255, bool colorCoded=false ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''text:''' The text string that you wish to send to the chat window. If more than 128 characters it will not be showed in chat.&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''visibleTo:''' This specifies who the chat is visible to. Any players in this element will see the chat message. See [[visibility]].&lt;br /&gt;
*'''r:''' The amount of red in the color of the text. Default value is 255.&lt;br /&gt;
*'''g:''' The amount of green in the color of the text. Default value is 255.&lt;br /&gt;
*'''b:''' The amount of blue in the color of the text. Default value is 255.&lt;br /&gt;
*'''colorCoded:''' A boolean value determining whether or not '#RRGGBB' tags should be used.&lt;br /&gt;
Note: '''visibleTo''' can also be a Team object, in this case, the text will be visible to all the players of that team. Also the #RRGGBB format must contain capital letters a-f is not acceptable but A-F is.&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;bool outputChatBox ( string text [, int r=255, int g=255, int b=255, bool colorCoded=false ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''text:''' The text string that you wish to send to the chat window. If more than 128 characters it will not be showed in chat.&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''r:''' The amount of red in the color of the text. Default value is 255.&lt;br /&gt;
*'''g:''' The amount of green in the color of the text. Default value is 255.&lt;br /&gt;
*'''b:''' The amount of blue in the color of the text. Default value is 255.&lt;br /&gt;
*'''colorCoded:''' A boolean value determining whether or not '#RRGGBB' tags should be used.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if the message was displayed successfully. Returns ''false'' if invalid arguments are 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;
'''Example 1:''' This example displays a chat message to all users.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
x = 5&lt;br /&gt;
y = 10  &lt;br /&gt;
-- Displays the message&lt;br /&gt;
outputChatBox ( &amp;quot;I have &amp;quot; .. x .. &amp;quot; apples and &amp;quot; .. y .. &amp;quot; oranges.&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example outputs a simple colour coded message, &amp;quot;Red White&amp;quot;, where the 'White' is in white colour, and 'Red' is in a red colour.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
 outputChatBox ( &amp;quot;Red #FFFFFFWhite&amp;quot;, getRootElement(), 255, 0, 0, true )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 3:''' This example allows for coloured chat, according to a player's nametag.  This makes use of colour coded outputs.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function colouredChat ( message, theType )&lt;br /&gt;
	if theType == 0 then --if its normal chat (not /me or teamchat) then&lt;br /&gt;
		cancelEvent() --prevent MTA from outputting chat&lt;br /&gt;
		message = string.gsub(message, &amp;quot;#%x%x%x%x%x%x&amp;quot;, &amp;quot;&amp;quot;) --remove any hex tags in a player's chat to prevent custom colours by using lua's string.gsub&lt;br /&gt;
		local r,g,b = getPlayerNametagColor ( source ) --get the player's nametag colour&lt;br /&gt;
		local chatterName = getPlayerName ( source ) --get his name&lt;br /&gt;
		--output a message with the name as his nametag colour, and the rest in white.&lt;br /&gt;
		outputChatBox ( chatterName..&amp;quot;:#FFFFFF &amp;quot;..message, getRootElement(), r, g, b, true )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 4:''' This example displays a chat message to a single user called ''someguy''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Find the player element for the player called 'someguy'&lt;br /&gt;
myPlayer = getPlayerFromName ( &amp;quot;someguy&amp;quot; )&lt;br /&gt;
-- If a player was found called 'someguy' then...&lt;br /&gt;
if ( myPlayer ~= false ) then&lt;br /&gt;
    x = 5&lt;br /&gt;
    y = 10&lt;br /&gt;
    -- Display the message&lt;br /&gt;
    outputChatBox ( &amp;quot;I have &amp;quot; .. x .. &amp;quot; apples and &amp;quot; .. y .. &amp;quot; oranges.&amp;quot;, myPlayer )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 5:''' These two functions can speed up typing, and display a message when a player Joins.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local msg_red,msg_green,msg_blue = 255,255,0&lt;br /&gt;
&lt;br /&gt;
function servertalkprivate(message, sendto)&lt;br /&gt;
        --Talk to one client only&lt;br /&gt;
	outputChatBox(tostring(message), sendto, msg_red, msg_green, msg_blue, true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function servertalk(message)&lt;br /&gt;
        --Talk to everyone&lt;br /&gt;
	servertalkprivate(message, getRootElement())&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onJoin()&lt;br /&gt;
	servertalkprivate(&amp;quot;Welcome to My Server&amp;quot;, source)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;,getRootElement(),onJoin)&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;br /&gt;
[[ru:outputChatBox]]&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=30616</id>
		<title>AddCommandHandler</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddCommandHandler&amp;diff=30616"/>
		<updated>2012-05-13T00:43:50Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Syntax */&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;
&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. Make sure to add the command to your ACL under the proper group for it to be usefull (i.e &amp;lt;right name=&amp;quot;command.killEveryone&amp;quot; access=&amp;quot;true&amp;quot;&amp;gt;&amp;lt;/right&amp;gt;). 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;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool 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 '''Server Example 2''' 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 '''Server Example 2''' 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;
==Examples== &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;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;hide&amp;quot;&amp;gt;&lt;br /&gt;
'''Example 2:''' 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;
		local arg = {...}&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;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;hide&amp;quot;&amp;gt;&lt;br /&gt;
'''Example 3:''' 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;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
'''Example 1:''' This example warps the local player to a random nearby location (useful for when a player gets stuck somewhere).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function escapeMe ()&lt;br /&gt;
	local x, y, z = getElementPosition ( localPlayer ) --Get player's position&lt;br /&gt;
	setElementPosition ( localPlayer, x+(math.random(-10,10)), y+(math.random(-10,10)), z+(math.random(1,15)) ) --Move a player randomly to a nearby location. X is current x + a number between -10, 10 and so on.&lt;br /&gt;
end    &lt;br /&gt;
addCommandHandler ( &amp;quot;escape&amp;quot;, escapeMe ) --When player types &amp;quot;/escape&amp;quot; in chatbox or &amp;quot;escape&amp;quot; in console&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>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiGridListInsertRowAfter&amp;diff=30525</id>
		<title>GuiGridListInsertRowAfter</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiGridListInsertRowAfter&amp;diff=30525"/>
		<updated>2012-05-07T15:44:37Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Required Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This allows you to insert a new row after a specified row. Good for inserting new rows in the middle of existing rows.&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;
int guiGridListInsertRowAfter ( element gridList, int rowIndex )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''gridList:''' The grid list you want to add a row to&lt;br /&gt;
*'''rowIndex:''' Row ID of the row you want to insert the '''new row''' after.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the row was successfully added, ''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;
-- Add example..&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;
{{GUI functions}}&lt;br /&gt;
[[Category:Needs Example]]&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiGridListInsertRowAfter&amp;diff=30524</id>
		<title>GuiGridListInsertRowAfter</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiGridListInsertRowAfter&amp;diff=30524"/>
		<updated>2012-05-07T15:43:51Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Required Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This allows you to insert a new row after a specified row. Good for inserting new rows in the middle of existing rows.&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;
int guiGridListInsertRowAfter ( element gridList, int rowIndex )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''gridList:''' The grid list you want to add a row to&lt;br /&gt;
*'''rowIndex:''' Row ID of the row you want to insert the [b] new [/b] row after.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the row was successfully added, ''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;
-- Add example..&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;
{{GUI functions}}&lt;br /&gt;
[[Category:Needs Example]]&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiLabelSetHorizontalAlign&amp;diff=30163</id>
		<title>GuiLabelSetHorizontalAlign</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiLabelSetHorizontalAlign&amp;diff=30163"/>
		<updated>2012-04-28T16:07:53Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Required Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function sets the horizontal alignment of a text label.&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 guiLabelSetHorizontalAlign ( element theLabel, string align, [ bool wordwrap = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theLabel:''' The text label to set the horizontal alignment on.&lt;br /&gt;
*'''align:''' The alignment type. Valid type strings are:&lt;br /&gt;
**&amp;quot;left&amp;quot;&lt;br /&gt;
**&amp;quot;center&amp;quot;&lt;br /&gt;
**&amp;quot;right&amp;quot;&lt;br /&gt;
*'''wordwrap:''' Wordwrap: http://en.wikipedia.org/wiki/Word_wrap for more information.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' on success, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI functions}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=30060</id>
		<title>Requested Functions and Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=30060"/>
		<updated>2012-04-24T17:56:30Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Server-side */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Server-side==&lt;br /&gt;
&lt;br /&gt;
Element type: GUI, for getElemensByType(&amp;quot;GUI&amp;quot;)&lt;br /&gt;
----------&lt;br /&gt;
Event like onServerTick wich is run very often. Like the clientside onClientRender. This could be useful for constat checking wich must be done under 50ms (lower than timers can handle).&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
onVehicleCreated or an equivalent... shouldn't be too hard? -Robhol (14:15 Jul 6, 08)&lt;br /&gt;
:If we did it, it'd be onElementCreated - what do you want this for? [[User:EAi|eAi]] 08:58, 7 July 2008 (CDT)&lt;br /&gt;
::onElementCreated is a good idea - it could be used for lots of things. Also, how about onVehicleDrown or whatever? that is, when a vehicle hits deep water. Checking for collisions and stuff is very awkward, and client-side only, and has to be checked constantly.. -Robhol (17:31 Jul 9 08)&lt;br /&gt;
:::I second that. It would be useful if you use like me element data like the fuel amount or other stuff. And an event like this would help me to setup those element data, when a car spawns. Otherwise I would either have to edit every car spawn script I use or do a post-setup when someone is entering the car.. [[User:MaddDogg14]] (04:34 Apr 4, 10 (CEST))&lt;br /&gt;
::::i definetly agree, onElementCreated would be VERY useful for utility/librares scripts, but i think this should be limited by ACL, because &amp;quot;evil&amp;quot; scripts could abuse this othervise -Karlis (9:10 Apr 5, 10)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I ask for a function that detects if a ped is on floor, eg. '''isPedOnFloor(ped thePed)''', thanks. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 11:29, 15 June 2008 (CDT)&lt;br /&gt;
: [[isPedOnGround]]? [[User:Awwu|Awwu]] 12:58, 15 June 2008 (CDT)&lt;br /&gt;
::I need to know if the player has its back touching the ground, not if it's simply &amp;quot;on ground&amp;quot;. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 14:16, 16 June 2008 (CDT)&lt;br /&gt;
:::Check what task the player has, they should have TASK_COMPLEX_FALL_AND_GET_UP or TASK_COMPLEX_FALL_AND_STAY_DOWN... [[User:EAi|eAi]] 19:12, 16 June 2008 (CDT)&lt;br /&gt;
::::Thanks. What task does player have after being hitten by a melee attack that cause it to fall down? Would &amp;quot;TASK_SIMPLE_BE_KICKED_ON_GROUND&amp;quot; and &amp;quot;TASK_SIMPLE_GET_UP&amp;quot; work? --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 09:35, 17 June 2008 (CDT)&lt;br /&gt;
:::::Try it, I'm not entirely sure. You should be able to produce some code to show the player's current tasks very easily... [[User:EAi|eAi]] 19:20, 17 June 2008 (CDT)&lt;br /&gt;
::::::My goal is to edit the standard damage of the attacks, in this case i have to know when player is on ground to cause higher damage. However it doesn't seem to work, when i hit the player it simply gets up without animation with no damage. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 19:10, 19 June 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It may looks strange and useless (waste of time?) but I think that it could be a awesome feature. Having a web browser.&lt;br /&gt;
Like: http://www.youtube.com/watch?v=wT1UR6qEgdg&lt;br /&gt;
http://princeofcode.com/awesomium.php&lt;br /&gt;
:definetly useles and waste of time, suporting xfire enought. -karlis&lt;br /&gt;
::Really Karlis, who asked you bro. It could be very useful, actually. For example, creating dynamic billboards. Instead of changing the TXD, they could set up a browser object over the billboard. That way they can also set up a timer to change the image, etc. [[User:JacobS|JacobS]] 20:08, 1 August 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
There could be something like createBrowser( float x, float y, float z, [float rx, float ry, float rz, float width, float high, string url, bool locked] ) &lt;br /&gt;
locked parameter: false = navigation bar present, true = no navigation bar&lt;br /&gt;
toggleBrowserFullsceenMode(browser theBrowser, bool tog, [bool smooth])&lt;br /&gt;
smooth parameter: If set to true the browser will smoothly move from his ingame position to the fullscreen position&lt;br /&gt;
toggleBrowserBackground(browser theBrowser, bool tog)&lt;br /&gt;
Set the browser background transparent.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Security: Disable file downloads, disable popups (disable flash, javascript and any other protocols than http and https [no mailto and stuff...]?)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Should be a Client and server function. --[[User:Masterofquebec|Masterofquebec]] 00:10, 15 October 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Support of tooltips from CEGUI would be cool. I saw a property for that, but it didn't work for me. [[User:MaddDogg14]] (04:36 Apr 4, 10 (CEST))&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I request a function that gets all clothes from a ped, just like getPedClothes but for all bodyparts. With this function it would be more ease to save clothes to database.&lt;br /&gt;
:That's so easy to do yourself that it's barely worth adding. Just loop all the indexes 0-17 and save them to a table. [[User:Awwu|Awwu]] 19:26, 17 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[setProjectileTarget]] for setting a projectile to target a specific entity. I am trying to create a Battlefield Bad Company type of gamemode and in that game, you can plant a 'tracer'. Any rocket fired (if the tracer is on screen) will seek the tracer. [[User:LeetWoovie|LeetWoovie]] 05:01, 19 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
(marcol07, June the 25th, 2010) I would like to have some function to create light source as element or sth like createFire, for example createLight(x,y,z,xrot,yrot,zrot,f,r,g,b) where &amp;quot;f&amp;quot; is an angle of lightning. or it is possible with some model or function? It would be good to create for example fog lamps or classic street lamps&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
moveElement available for markers, objects, pedestrians and players or maybe more if you can do. [[User:Socialz|Socialz]] 13:10, 1 January 2012 (CET)&lt;br /&gt;
&lt;br /&gt;
==Client-Side==&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Adding possibility to toggle radio hud label by '''showHudComponent''' -karlis  &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Pickup events clientside please, onClientPickupHit onClientPickupUse.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Would it be possible to add a color arg to guiGridListSetItemText()? Im trying to get each item colored differently in one list. Thanks, ABEL&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I need a function which could get current target of hydra or a HS rocket launcher, like when someone press space and targets a element, to get what element is it for calculating distance from it. '''getPlayerOccupiedVehicleTarget''' or '''getPlayerHSTarget'''. &lt;br /&gt;
Thanks in advance -Nidza a.k.a. CodeMaster 2:26 PM 19th June 2008.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It'd be useful to have something to disable elements of the default hud (weapon display, health display, armor, radar, etcetera) so that you can create your own HUDs. Something like '''setHudElement(element name, toggle)'''.&lt;br /&gt;
&lt;br /&gt;
[[User:Lord Xalphox|Lord Xalphox]] 19:32, 22 March 2009 (CET)&lt;br /&gt;
:[[showPlayerHudComponent]]? [[User:Awwu|Awwu]] 19:43, 22 March 2009 (CET)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I'd like to have a function that sets the chatbox input line text. Then I could script my own chat history function (that inserts the last sent text into the input line again by pressing arrow up) (which samp has since 0.2 btw) since nobody builds it into the client. [[User:NeonBlack|NeonBlack]] 12:03, 4 July 2009 (CEST) PS.: samp also supports cut, copy and paste :P&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
A function setElementMatrix, doing the exact opposite of getElementMatrix would be much appreciated. --[[User:Kayl|Kayl]] 15:21, 13 November 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Functions like setTrainPosition(train,track,pos) and track,pos getTrainPosition(train) would be great in order to allow more script side control of trains.&lt;br /&gt;
The track argument would be an index of the track number (currently there are around 4 tracks handled, including 1 incompletely defined).&lt;br /&gt;
The position would be a float between 0 and 1 (or however you guys handle it) telling where on the track the train currently is.&lt;br /&gt;
It would be great if those functions could be available client and server side. --[[User:Kayl|Kayl]] 12:58, 23 November 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
need this function client and server side '''movePlayerHudComponent(string component, float x, float y)''' --[[User:SuatEyrice|SuatEyrice]] 00:18, 26 February 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''(marcol07, June the 27th, 2010)''' I would be so happy to have fuction to set Analog control of player sth like '''getAnalogControlState(string controlName)''' but inverted to '''setAnalogControlState(string controlName, float state)'''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
OnPedDamage (serverside) event. There is OnClientPedDamage, but it's clientside. [[User:damage22|damage22]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
'''setRadioVolume(element thePlayer, int volume)''', to create GUI volume control, turn off the radio without changing the station, etc. [[User:JacobS|JacobS]] 14:47, 29 July 2010 (UTC)&lt;br /&gt;
----&lt;br /&gt;
'''setVehicleHydraulics(element theVehicle, bool state)''', to force hydraulics to be up (true) or down (false)&lt;br /&gt;
----&lt;br /&gt;
'''createFire(x, y, z, theSize, dimension)''', just like [[createFire]], only with the option to enter a dimension for the fire to appear in&lt;br /&gt;
----&lt;br /&gt;
'''setGunshotsEnabled(bool enabled)''', '''getGunshotsEnabled()''' and '''createGunshot(x,y,z,radius)''' - to enable/disable the game's gunshot ambience, and to create gunshots at specific locations with radii that it is audible in [[User:JacobS.|JacobS.]] 19:28, 11 September 2010 (MDT)&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=29841</id>
		<title>Requested Functions and Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=29841"/>
		<updated>2012-04-02T11:04:24Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Server-side */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Server-side==&lt;br /&gt;
&lt;br /&gt;
onPedWarpedIntoVehicle would be useful, instead of checking if a player is in a vehicle. Since onVehicleEnter doesn't work for warps&lt;br /&gt;
----------&lt;br /&gt;
Event like onServerTick wich is run very often. Like the clientside onClientRender. This could be useful for constat checking wich must be done under 50ms (lower than timers can handle).&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
onVehicleCreated or an equivalent... shouldn't be too hard? -Robhol (14:15 Jul 6, 08)&lt;br /&gt;
:If we did it, it'd be onElementCreated - what do you want this for? [[User:EAi|eAi]] 08:58, 7 July 2008 (CDT)&lt;br /&gt;
::onElementCreated is a good idea - it could be used for lots of things. Also, how about onVehicleDrown or whatever? that is, when a vehicle hits deep water. Checking for collisions and stuff is very awkward, and client-side only, and has to be checked constantly.. -Robhol (17:31 Jul 9 08)&lt;br /&gt;
:::I second that. It would be useful if you use like me element data like the fuel amount or other stuff. And an event like this would help me to setup those element data, when a car spawns. Otherwise I would either have to edit every car spawn script I use or do a post-setup when someone is entering the car.. [[User:MaddDogg14]] (04:34 Apr 4, 10 (CEST))&lt;br /&gt;
::::i definetly agree, onElementCreated would be VERY useful for utility/librares scripts, but i think this should be limited by ACL, because &amp;quot;evil&amp;quot; scripts could abuse this othervise -Karlis (9:10 Apr 5, 10)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I ask for a function that detects if a ped is on floor, eg. '''isPedOnFloor(ped thePed)''', thanks. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 11:29, 15 June 2008 (CDT)&lt;br /&gt;
: [[isPedOnGround]]? [[User:Awwu|Awwu]] 12:58, 15 June 2008 (CDT)&lt;br /&gt;
::I need to know if the player has its back touching the ground, not if it's simply &amp;quot;on ground&amp;quot;. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 14:16, 16 June 2008 (CDT)&lt;br /&gt;
:::Check what task the player has, they should have TASK_COMPLEX_FALL_AND_GET_UP or TASK_COMPLEX_FALL_AND_STAY_DOWN... [[User:EAi|eAi]] 19:12, 16 June 2008 (CDT)&lt;br /&gt;
::::Thanks. What task does player have after being hitten by a melee attack that cause it to fall down? Would &amp;quot;TASK_SIMPLE_BE_KICKED_ON_GROUND&amp;quot; and &amp;quot;TASK_SIMPLE_GET_UP&amp;quot; work? --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 09:35, 17 June 2008 (CDT)&lt;br /&gt;
:::::Try it, I'm not entirely sure. You should be able to produce some code to show the player's current tasks very easily... [[User:EAi|eAi]] 19:20, 17 June 2008 (CDT)&lt;br /&gt;
::::::My goal is to edit the standard damage of the attacks, in this case i have to know when player is on ground to cause higher damage. However it doesn't seem to work, when i hit the player it simply gets up without animation with no damage. --&amp;lt;span style=&amp;quot;font-family:Courier New, Courier, monospace&amp;quot;&amp;gt;[[User:Shadd|Shadd]]&amp;lt;/span&amp;gt;&amp;lt;sub&amp;gt;([[User_talk:Shadd|In caso di emergenza rompere le scatole]])&amp;lt;/sub&amp;gt; 19:10, 19 June 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It may looks strange and useless (waste of time?) but I think that it could be a awesome feature. Having a web browser.&lt;br /&gt;
Like: http://www.youtube.com/watch?v=wT1UR6qEgdg&lt;br /&gt;
http://princeofcode.com/awesomium.php&lt;br /&gt;
:definetly useles and waste of time, suporting xfire enought. -karlis&lt;br /&gt;
::Really Karlis, who asked you bro. It could be very useful, actually. For example, creating dynamic billboards. Instead of changing the TXD, they could set up a browser object over the billboard. That way they can also set up a timer to change the image, etc. [[User:JacobS|JacobS]] 20:08, 1 August 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
There could be something like createBrowser( float x, float y, float z, [float rx, float ry, float rz, float width, float high, string url, bool locked] ) &lt;br /&gt;
locked parameter: false = navigation bar present, true = no navigation bar&lt;br /&gt;
toggleBrowserFullsceenMode(browser theBrowser, bool tog, [bool smooth])&lt;br /&gt;
smooth parameter: If set to true the browser will smoothly move from his ingame position to the fullscreen position&lt;br /&gt;
toggleBrowserBackground(browser theBrowser, bool tog)&lt;br /&gt;
Set the browser background transparent.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Security: Disable file downloads, disable popups (disable flash, javascript and any other protocols than http and https [no mailto and stuff...]?)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Should be a Client and server function. --[[User:Masterofquebec|Masterofquebec]] 00:10, 15 October 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Support of tooltips from CEGUI would be cool. I saw a property for that, but it didn't work for me. [[User:MaddDogg14]] (04:36 Apr 4, 10 (CEST))&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I request a function that gets all clothes from a ped, just like getPedClothes but for all bodyparts. With this function it would be more ease to save clothes to database.&lt;br /&gt;
:That's so easy to do yourself that it's barely worth adding. Just loop all the indexes 0-17 and save them to a table. [[User:Awwu|Awwu]] 19:26, 17 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[setProjectileTarget]] for setting a projectile to target a specific entity. I am trying to create a Battlefield Bad Company type of gamemode and in that game, you can plant a 'tracer'. Any rocket fired (if the tracer is on screen) will seek the tracer. [[User:LeetWoovie|LeetWoovie]] 05:01, 19 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
(marcol07, June the 25th, 2010) I would like to have some function to create light source as element or sth like createFire, for example createLight(x,y,z,xrot,yrot,zrot,f,r,g,b) where &amp;quot;f&amp;quot; is an angle of lightning. or it is possible with some model or function? It would be good to create for example fog lamps or classic street lamps&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
moveElement available for markers, objects, pedestrians and players or maybe more if you can do. [[User:Socialz|Socialz]] 13:10, 1 January 2012 (CET)&lt;br /&gt;
&lt;br /&gt;
==Client-Side==&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Adding possibility to toggle radio hud label by '''showHudComponent''' -karlis  &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Pickup events clientside please, onClientPickupHit onClientPickupUse.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Would it be possible to add a color arg to guiGridListSetItemText()? Im trying to get each item colored differently in one list. Thanks, ABEL&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I need a function which could get current target of hydra or a HS rocket launcher, like when someone press space and targets a element, to get what element is it for calculating distance from it. '''getPlayerOccupiedVehicleTarget''' or '''getPlayerHSTarget'''. &lt;br /&gt;
Thanks in advance -Nidza a.k.a. CodeMaster 2:26 PM 19th June 2008.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
It'd be useful to have something to disable elements of the default hud (weapon display, health display, armor, radar, etcetera) so that you can create your own HUDs. Something like '''setHudElement(element name, toggle)'''.&lt;br /&gt;
&lt;br /&gt;
[[User:Lord Xalphox|Lord Xalphox]] 19:32, 22 March 2009 (CET)&lt;br /&gt;
:[[showPlayerHudComponent]]? [[User:Awwu|Awwu]] 19:43, 22 March 2009 (CET)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I'd like to have a function that sets the chatbox input line text. Then I could script my own chat history function (that inserts the last sent text into the input line again by pressing arrow up) (which samp has since 0.2 btw) since nobody builds it into the client. [[User:NeonBlack|NeonBlack]] 12:03, 4 July 2009 (CEST) PS.: samp also supports cut, copy and paste :P&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
A function setElementMatrix, doing the exact opposite of getElementMatrix would be much appreciated. --[[User:Kayl|Kayl]] 15:21, 13 November 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Functions like setTrainPosition(train,track,pos) and track,pos getTrainPosition(train) would be great in order to allow more script side control of trains.&lt;br /&gt;
The track argument would be an index of the track number (currently there are around 4 tracks handled, including 1 incompletely defined).&lt;br /&gt;
The position would be a float between 0 and 1 (or however you guys handle it) telling where on the track the train currently is.&lt;br /&gt;
It would be great if those functions could be available client and server side. --[[User:Kayl|Kayl]] 12:58, 23 November 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
need this function client and server side '''movePlayerHudComponent(string component, float x, float y)''' --[[User:SuatEyrice|SuatEyrice]] 00:18, 26 February 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''(marcol07, June the 27th, 2010)''' I would be so happy to have fuction to set Analog control of player sth like '''getAnalogControlState(string controlName)''' but inverted to '''setAnalogControlState(string controlName, float state)'''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
OnPedDamage (serverside) event. There is OnClientPedDamage, but it's clientside. [[User:damage22|damage22]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
'''setRadioVolume(element thePlayer, int volume)''', to create GUI volume control, turn off the radio without changing the station, etc. [[User:JacobS|JacobS]] 14:47, 29 July 2010 (UTC)&lt;br /&gt;
----&lt;br /&gt;
'''setVehicleHydraulics(element theVehicle, bool state)''', to force hydraulics to be up (true) or down (false)&lt;br /&gt;
----&lt;br /&gt;
'''createFire(x, y, z, theSize, dimension)''', just like [[createFire]], only with the option to enter a dimension for the fire to appear in&lt;br /&gt;
----&lt;br /&gt;
'''setGunshotsEnabled(bool enabled)''', '''getGunshotsEnabled()''' and '''createGunshot(x,y,z,radius)''' - to enable/disable the game's gunshot ambience, and to create gunshots at specific locations with radii that it is audible in [[User:JacobS.|JacobS.]] 19:28, 11 September 2010 (MDT)&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleRespawnPosition&amp;diff=29818</id>
		<title>SetVehicleRespawnPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleRespawnPosition&amp;diff=29818"/>
		<updated>2012-03-30T23:22:21Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Required Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}} &lt;br /&gt;
This function sets the position (and rotation) the vehicle will respawn to.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setVehicleRespawnPosition ( vehicle theVehicle, float x, float y, float z, [float rx, float ry, float rz ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theVehicle''': The [[vehicle]] you wish to change the respawn position of.&lt;br /&gt;
* '''x''': A floating point number representing the X coordinate on the map.&lt;br /&gt;
* '''y''': A floating point number representing the Y coordinate on the map.&lt;br /&gt;
* '''z''': A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''rx''': A floating point number representing the rotation about the X axis in Degrees.&lt;br /&gt;
* '''ry''': A floating point number representing the rotation about the Y axis in Degrees.&lt;br /&gt;
* '''rz''': A floating point number representing the rotation about the Z axis in Degrees.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if the vehicle was found and edited, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example creates a vehicle and changes its respawn position.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local vehicle = createVehicle ( 400, 1, 1, 1 ) -- create us a new vehicle&lt;br /&gt;
if ( vehicle ) then&lt;br /&gt;
  setVehicleRespawnPosition ( vehicle, 10, 10, 10 ) -- tell the server to respawn the vehicle at position (10,10,10)&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>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPedWasted&amp;diff=29745</id>
		<title>OnPedWasted</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPedWasted&amp;diff=29745"/>
		<updated>2012-03-27T16:10:28Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* 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 ped is killed or dies.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int totalAmmo, element killer, int killerWeapon, int bodypart [, bool stealth ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''totalAmmo''': an integer representing the total ammo the victim had when he died.&lt;br /&gt;
*'''killer''': an [[element]] representing the player or vehicle who was the killer.  If there was no killer this is ''false''.&lt;br /&gt;
*'''killerWeapon''': an integer representing the [[Weapons|killer weapon]] or the [[Death Reasons|death reason]].&lt;br /&gt;
*'''bodypart''': an integer representing the bodypart ID the victim was hit on when he died.&lt;br /&gt;
{{BodyParts}}&lt;br /&gt;
*'''stealth''': boolean value representing whether or not this was a stealth kill&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[ped]] that died or got killed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function pedDied(totalAmmo, killer, killerWeapon)&lt;br /&gt;
if ( getElementType(&amp;quot;killer&amp;quot;) == &amp;quot;player&amp;quot; ) and ( getElementType(&amp;quot;source&amp;quot;) == &amp;quot;player&amp;quot; ) then -- if the killer is a player and the ped who died is then&lt;br /&gt;
outputChatBox( getPlayerName(source) .. &amp;quot; was killed by &amp;quot; .. getPlayerName(killer) .. &amp;quot; with &amp;quot; .. killerWeapon .. &amp;quot;.&amp;quot;)--Say who killed who with what weapon&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPedWasted&amp;quot;, getRootElement(), pedDied) -- onPedWasted the function pedDied gets called&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;
{{Ped_events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29744</id>
		<title>OnElementStopSync</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29744"/>
		<updated>2012-03-27T16:08:46Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{Warning|In 1.1.x, Destroying the source of this event could crash the server!|true}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
&lt;br /&gt;
This event is triggered when an element is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player oldSyncer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''oldSyncer''': [[player]] element representing the last player who was syncing the element&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] which is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&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;
veh = createVehicle(520, 0,0,4) --  create our testing vehicle&lt;br /&gt;
&lt;br /&gt;
function syncStop()&lt;br /&gt;
if source == veh then -- check if the element that stopped getting synced was our vehicle&lt;br /&gt;
outputChatBox(&amp;quot;You stopped syncing the vehicle!!&amp;quot;,oldSyncer) -- tell the player he stopped syncing the vehicle ( veh )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onElementStopSync&amp;quot;,getRootElement(),syncStop) --  onElementStopSync, the function syncStop gets called&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
{{See also/Server event|Element events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29743</id>
		<title>OnElementStopSync</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29743"/>
		<updated>2012-03-27T16:08:30Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{Warning|In 1.1.x, Destroying the source of this event could crash the server!|true}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
&lt;br /&gt;
This event is triggered when an element is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player oldSyncer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''oldSyncer''': [[player]] element representing the last player who was syncing the element&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] which is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
veh = createVehicle(520, 0,0,4) --  create our testing vehicle&lt;br /&gt;
&lt;br /&gt;
function syncStop()&lt;br /&gt;
if source == veh then -- check if the element that stopped getting synced was our vehicle&lt;br /&gt;
outputChatBox(&amp;quot;You stopped syncing the vehicle!!&amp;quot;,oldSyncer) -- tell the player he stopped syncing the vehicle ( veh )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onElementStopSync&amp;quot;,getRootElement(),syncStop) --  onElementStopSync, the function syncStop gets called&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Element events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29742</id>
		<title>OnElementStopSync</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29742"/>
		<updated>2012-03-27T16:08:03Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{Warning|In 1.1.x, Destroying the source of this event could crash the server!|true}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
&lt;br /&gt;
This event is triggered when an element is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player oldSyncer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''oldSyncer''': [[player]] element representing the last player who was syncing the element&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] which is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
veh = createVehicle(520, 0,0,4) --  create our testing vehicle&lt;br /&gt;
&lt;br /&gt;
function syncStop()&lt;br /&gt;
if source == veh then -- check if the element that stopped getting synced was our vehicle&lt;br /&gt;
outputChatBox(&amp;quot;You stopped syncing the vehicle!!&amp;quot;,oldSyncer) -- tell the player he stopped syncing the vehicle ( veh )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onElementStopSync&amp;quot;,getRootElement(),syncStop) --  onElementStopSync, the function syncStop gets called&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Element events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29741</id>
		<title>OnElementStopSync</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnElementStopSync&amp;diff=29741"/>
		<updated>2012-03-27T16:03:39Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server event}}&lt;br /&gt;
{{Warning|In 1.1.x, Destroying the source of this event could crash the server!|true}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
&lt;br /&gt;
This event is triggered when an element is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player oldSyncer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''oldSyncer''': [[player]] element representing the last player who was syncing the element&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[element]] which is no longer synced by a player.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
veh = createVehicle(520, 0,0,1) --  create our testing vehicle&lt;br /&gt;
&lt;br /&gt;
function syncStop()&lt;br /&gt;
if source == veh then -- check if the element that stopped getting synced was our vehicle&lt;br /&gt;
outputChatBox(&amp;quot;You stopped syncing the vehicle!!&amp;quot;,oldSyncer) -- tell the player he stopped syncing the vehicle ( veh )&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onElementStopSync&amp;quot;,getRootElement(),syncStop) --  onElementStopSync, the function syncStop gets called&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Element events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Introduction_to_Scripting_the_GUI&amp;diff=29726</id>
		<title>Introduction to Scripting the GUI</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Introduction_to_Scripting_the_GUI&amp;diff=29726"/>
		<updated>2012-03-26T17:03:48Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* Relative and Absolute */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- place holder --&amp;gt;&lt;br /&gt;
One important feature in MTA:SA is the ability to script customized GUI (Graphic User Interface). The GUI consists of windows, button, edit boxes, check boxes... Almost every standard form components in graphical environments. They can be displayed while the user is in game, and used for inputs and outputs in place of traditional commands. &lt;br /&gt;
&lt;br /&gt;
[[Image:AdminGUI.png|thumb|Admin Console GUI]]&lt;br /&gt;
&lt;br /&gt;
==A tutorial to make a login window==&lt;br /&gt;
In this tutorial we'll make a simple login window, with two input boxes and a button. The window appears when the player joins the game, and once the button is clicked, the player is spawned. The tutorial will continue the gamemode we made in [[Scripting Introduction|Introduction to Scripting]] ''(If you have used the [[Scripting Introduction|Introduction to Scripting]], you will need to remove or comment the [[spawnPlayer]] line in the &amp;quot;joinHandler&amp;quot; function in your code, as we will be replacing it with a gui alternative in this tutorial)''. We'll also take a look at client-side scripting. &lt;br /&gt;
&lt;br /&gt;
===Draw the window===&lt;br /&gt;
All the GUI must be made client side. It is also a good practice to keep all the client scripts in a separate folder. &lt;br /&gt;
&lt;br /&gt;
Browse to /Your MTA Server/mods/deathmatch/resources/myserver/ directory, and create a folder named &amp;quot;client&amp;quot;. Under /client/ directory, create a text file and name it &amp;quot;gui.lua&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
In this file we will write a funtion that draws the window. To create a window we will use [[guiCreateWindow]]:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createLoginWindow()&lt;br /&gt;
	-- define the X and Y positions of the window&lt;br /&gt;
	local X = 0.375&lt;br /&gt;
	local Y = 0.375&lt;br /&gt;
	-- define the width and height of the window&lt;br /&gt;
	local Width = 0.25&lt;br /&gt;
	local Height = 0.25&lt;br /&gt;
	-- create the window and save its element value into the variable 'wdwLogin'&lt;br /&gt;
	-- click on the function's name to read its documentation&lt;br /&gt;
	wdwLogin = guiCreateWindow(X, Y, Width, Height, &amp;quot;Please Log In&amp;quot;, true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Relative and Absolute===&lt;br /&gt;
Note that the final argument passed to guiCreateWindow in the above example is ''true''. This indicates that the coordinates and dimensions of the window are '''relative''', meaning they are a ''percentage'' of the total screen size. This means that if the far left side of the screen is 0, and the far right is 1, an X position of 0.5 would represent the centre point of the screen. Similarly, if the top of the screen is 0 and the bottom is 1, a Y position of 0.2 would be 20% of the way down the screen. The same principles apply to both Width and Height as well (with a Width value of 0.5 meaning the window will be half as wide as the screen).&lt;br /&gt;
&lt;br /&gt;
The alternative to using relative values is using '''absolute''' (by passing ''false'' instead of true to guiCreateWindow). Absolute values are calculated as the total number of pixels from the top-left corner of the parent (if no gui element parent is specified, the parent is the screen itself). If we assume a screen resolution of 1920x1200, the far left side of the screen being 0 pixels and the far right being 1920 pixels, an X position of 960 will represent the centre point of the screen. Similarly, if the top of the screen is 0 pixels and the bottom is 1200, a Y position of 20 would be 20 pixels down from the top of the screen. The same principles apply to both Width and Height as well (with a Width value of 50 meaning the window will be 50 pixels wide). ''You can use [[guiGetScreenSize]] and a little maths to calculate certain absolute positions.''&lt;br /&gt;
&lt;br /&gt;
The differences between using relative and absolute values is quite simple; gui created using absolute values will always remain exactly the same pixel size and position, while gui created using relative values will always be a percentage of its parent's size.&lt;br /&gt;
&lt;br /&gt;
Absolute is generally easier to maintain when editing code by hand, however your choice of type depends on the situation you are using it for.&lt;br /&gt;
&lt;br /&gt;
For the purposes of this introduction we will be using relative values.&lt;br /&gt;
&lt;br /&gt;
===Adding the components===&lt;br /&gt;
Next, we'll add the text labels (saying &amp;quot;username:&amp;quot; and &amp;quot;password:&amp;quot;), edit boxes (for entering your data) and a button to log in.&lt;br /&gt;
&lt;br /&gt;
To create buttons we use [[guiCreateButton]] and to create edit boxes use [[guiCreateEdit]]:&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'createLoginWindow' function. This is not a new function and is meant to replace what you already have.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createLoginWindow()&lt;br /&gt;
	local X = 0.375&lt;br /&gt;
	local Y = 0.375&lt;br /&gt;
	local Width = 0.25&lt;br /&gt;
	local Height = 0.25&lt;br /&gt;
	wdwLogin = guiCreateWindow(X, Y, Width, Height, &amp;quot;Please Log In&amp;quot;, true)&lt;br /&gt;
	&lt;br /&gt;
	-- define new X and Y positions for the first label&lt;br /&gt;
	X = 0.0825&lt;br /&gt;
	Y = 0.2&lt;br /&gt;
	-- define new Width and Height values for the first label&lt;br /&gt;
	Width = 0.25&lt;br /&gt;
	Height = 0.25&lt;br /&gt;
	-- create the first label, note the final argument passed is 'wdwLogin' meaning the window&lt;br /&gt;
	-- we created above is the parent of this label (so all the position and size values are now relative to the position of that window)&lt;br /&gt;
	guiCreateLabel(X, Y, Width, Height, &amp;quot;Username&amp;quot;, true, wdwLogin)&lt;br /&gt;
	-- alter the Y value, so the second label is slightly below the first&lt;br /&gt;
	Y = 0.5&lt;br /&gt;
	guiCreateLabel(X, Y, Width, Height, &amp;quot;Password&amp;quot;, true, wdwLogin)&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
	X = 0.415&lt;br /&gt;
	Y = 0.2&lt;br /&gt;
	Width = 0.5&lt;br /&gt;
	Height = 0.15&lt;br /&gt;
	edtUser = guiCreateEdit(X, Y, Width, Height, &amp;quot;&amp;quot;, true, wdwLogin)&lt;br /&gt;
	Y = 0.5&lt;br /&gt;
	edtPass = guiCreateEdit(X, Y, Width, Height, &amp;quot;&amp;quot;, true, wdwLogin)&lt;br /&gt;
	-- set the maximum character length for the username and password fields to 50&lt;br /&gt;
	guiEditSetMaxLength(edtUser, 50)&lt;br /&gt;
	guiEditSetMaxLength(edtPass, 50)&lt;br /&gt;
	&lt;br /&gt;
	X = 0.415&lt;br /&gt;
	Y = 0.7&lt;br /&gt;
	Width = 0.25&lt;br /&gt;
	Height = 0.2&lt;br /&gt;
	btnLogin = guiCreateButton(X, Y, Width, Height, &amp;quot;Log In&amp;quot;, true, wdwLogin)&lt;br /&gt;
	&lt;br /&gt;
	-- make the window invisible&lt;br /&gt;
	guiSetVisible(wdwLogin, false)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that every GUI component created is a child of the window, this is done by specifying the parent element (wdwLogin, in this case) when creating the component. &lt;br /&gt;
&lt;br /&gt;
This is very useful because not only does it mean that all the components are attached to the window and will move with it, but also that any changes done to the parent window will be applied down the tree to these child components. For example, we can now hide all of the GUI we just created by simply hiding the window:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiSetVisible(wdwLogin, false) --hides all the GUI we made so we can show them to the player at the appropriate moment. &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using the function we wrote===&lt;br /&gt;
The createLoginWindow function is now complete, but it won't do anything until we call it. It is recommended to create all GUI when the client resource starts, hide them, and show them to the player later when needed. Therefore, we'll write an event handler for &amp;quot;[[onClientResourceStart]]&amp;quot; to create the window:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- attach the event handler to the root element of the resource&lt;br /&gt;
-- this means it will only trigger when its own resource is started&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(getThisResource()), &lt;br /&gt;
	function ()&lt;br /&gt;
		createLoginWindow()&lt;br /&gt;
	end&lt;br /&gt;
)	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As this is a log in window, we now need to show the window when the player joins the game. &lt;br /&gt;
This can be done using the same event, &amp;quot;[[onClientResourceStart]]&amp;quot;, so we can modify the above code to include showing the window:&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'onClientResourceStart' handler. This is not a new event handler and is meant to replace what you already have.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement(getThisResource()), &lt;br /&gt;
	function ()&lt;br /&gt;
		-- create the log in window and its components&lt;br /&gt;
		createLoginWindow()&lt;br /&gt;
&lt;br /&gt;
		-- output a brief welcome message to the player&lt;br /&gt;
                outputChatBox(&amp;quot;Welcome to My MTA:SA Server, please log in.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
		-- if the GUI was successfully created, then show the GUI to the player&lt;br /&gt;
	        if (wdwLogin ~= nil) then&lt;br /&gt;
			guiSetVisible(wdwLogin, true)&lt;br /&gt;
		else&lt;br /&gt;
			-- if the GUI hasnt been properly created, tell the player&lt;br /&gt;
			outputChatBox(&amp;quot;An unexpected error has occurred and the log in GUI has not been created.&amp;quot;)&lt;br /&gt;
	        end &lt;br /&gt;
&lt;br /&gt;
		-- enable the players cursor (so they can select and click on the components)&lt;br /&gt;
	        showCursor(true)&lt;br /&gt;
		-- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening&lt;br /&gt;
	        guiSetInputEnabled(true)&lt;br /&gt;
	end&lt;br /&gt;
)	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that we have a simple security check before making the window visible, so in the unlikely event that the window has not been created, meaning wdwLogin is not a valid element, we don't get an error and just inform the player what has happened. &lt;br /&gt;
In the next step, we will create the button functionality for the log in button.&lt;br /&gt;
&lt;br /&gt;
==Scripting the button==&lt;br /&gt;
Now that we have created our GUI and shown it to the player, we need to make it work. &lt;br /&gt;
&lt;br /&gt;
===Detecting the click===&lt;br /&gt;
When the player clicks on any part of the GUI, the event &amp;quot;[[onClientGUIClick]]&amp;quot; will be triggered for the GUI component you clicked on. This allows us to easily detect any clicks on the GUI elements we want to use.&lt;br /&gt;
For example, we can attach the event to the btnLogin button to catch any clicks on it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- attach the event onClientGUIClick to btnLogin and set it to trigger the 'clientSubmitLogin' function&lt;br /&gt;
addEventHandler(&amp;quot;onClientGUIClick&amp;quot;, btnLogin, clientSubmitLogin, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Note the final argument passed is &amp;quot;false&amp;quot;. This indicates that the event will only trigger directly on btnLogin, not if the event has propagated up or down the tree. Setting this to &amp;quot;true&amp;quot; while attaching to gui elements will mean that clicking on any element in the same branch will trigger this event.'''&lt;br /&gt;
&lt;br /&gt;
This line of code can now be added inside the createLoginWindow function. It is a common mistake to try and attach events to non-existant GUI elements, so make sure you always attach your events '''after''' the gui element (in this case, the button) has been created:&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'createLoginWindow' function.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createLoginWindow()&lt;br /&gt;
	-- create all our GUI elements&lt;br /&gt;
	...&lt;br /&gt;
&lt;br /&gt;
	-- now add our onClientGUIClick event to the button we just created&lt;br /&gt;
	addEventHandler(&amp;quot;onClientGUIClick&amp;quot;, btnLogin, clientSubmitLogin, false)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Managing the click===&lt;br /&gt;
Now that we can detect when the player clicks on the button, we need to write code to manage what happens when they do.&lt;br /&gt;
In our [[onClientGUIClick]] event handle, we told it to call the function clientSubmitLogin whenever btnLogin is clicked.&lt;br /&gt;
Therefore, we can now use the function clientSubmitLogin to control what happens when the button is clicked:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create the function and define the 'button' and 'state' parameters&lt;br /&gt;
-- (these are passed automatically by onClientGUIClick)&lt;br /&gt;
function clientSubmitLogin(button,state)&lt;br /&gt;
	-- if our login button was clicked with the left mouse button, and the state of the mouse button is up&lt;br /&gt;
	if button == &amp;quot;left&amp;quot; and state == &amp;quot;up&amp;quot; then&lt;br /&gt;
		-- move the input focus back onto the game (allowing players to move around, open the chatbox, etc)&lt;br /&gt;
		guiSetInputEnabled(false)&lt;br /&gt;
		-- hide the window and all the components&lt;br /&gt;
		guiSetVisible(wdwLogin, false)&lt;br /&gt;
		-- hide the mouse cursor&lt;br /&gt;
		showCursor(false)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Now, when the button is clicked, the window will be hidden and all controls will be returned to the player. Next, we will tell the server to allow the player to spawn.&lt;br /&gt;
&lt;br /&gt;
===Triggering the server===&lt;br /&gt;
Triggering the server can be done using [[triggerServerEvent]]. This allows you to trigger a specified event on the server from the client. The same can be done in reverse using [[triggerClientEvent]].&lt;br /&gt;
Here, we use the [[triggerServerEvent]] function to call our own custom event on the server, named &amp;quot;submitLogin&amp;quot;, which will then control the spawning of the player serverside.&lt;br /&gt;
&lt;br /&gt;
'''Note that we are now writing more code for our existing 'clientSubmitLogin' function. This is not a new function and is meant to replace what you already have.''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function clientSubmitLogin(button,state)&lt;br /&gt;
	if button == &amp;quot;left&amp;quot; and state == &amp;quot;up&amp;quot; then&lt;br /&gt;
		-- get the text entered in the 'username' field&lt;br /&gt;
		local username = guiGetText(edtUser)&lt;br /&gt;
		-- get the text entered in the 'password' field&lt;br /&gt;
		local password = guiGetText(edtPass)&lt;br /&gt;
&lt;br /&gt;
		-- if the username and password both exist&lt;br /&gt;
		if username and password then&lt;br /&gt;
			-- trigger the server event 'submitLogin' and pass the username and password to it&lt;br /&gt;
			triggerServerEvent(&amp;quot;submitLogin&amp;quot;, getRootElement(), username, password)&lt;br /&gt;
&lt;br /&gt;
			-- hide the gui, hide the cursor and return control to the player&lt;br /&gt;
			guiSetInputEnabled(false)&lt;br /&gt;
			guiSetVisible(wdwLogin, false)&lt;br /&gt;
			showCursor(false)&lt;br /&gt;
		else&lt;br /&gt;
			-- otherwise, output a message to the player, do not trigger the server&lt;br /&gt;
			-- and do not hide the gui&lt;br /&gt;
			outputChatBox(&amp;quot;Please enter a username and password.&amp;quot;)&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;
===Creating the serverside event===&lt;br /&gt;
At this point we now have all the code needed on the client side, so open up your serverside 'script.lua' file (from the [[Scripting Introduction|Introduction to Scripting]]) or another suitable serverside file to work with.&lt;br /&gt;
&lt;br /&gt;
On the server side, recall that we are spawning the player as soon as they login.&lt;br /&gt;
So, first of all, we will need to define the custom event that we used before on the client. This can be done using [[addEvent]] and [[addEventHandler]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create our loginHandler function, with username and password parameters (passed from the client gui)&lt;br /&gt;
function loginHandler(username,password)&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- define our custom event, and allow it to be triggered from the client ('true')&lt;br /&gt;
addEvent(&amp;quot;submitLogin&amp;quot;,true)&lt;br /&gt;
-- add an event handler so that when submitLogin is triggered, the function loginHandler is called&lt;br /&gt;
addEventHandler(&amp;quot;submitLogin&amp;quot;,root,loginHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Logging in===&lt;br /&gt;
Now we have a function that is called through the custom event 'submitLogin', we can start to work on logging in and spawning the player, using our 'loginHandler' function:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function loginHandler(username,password)&lt;br /&gt;
	-- check that the username and password are correct&lt;br /&gt;
	if username == &amp;quot;user&amp;quot; and password == &amp;quot;apple&amp;quot; then&lt;br /&gt;
		-- the player has successfully logged in, so spawn them&lt;br /&gt;
		if (client) then&lt;br /&gt;
			spawnPlayer(client, 1959.55, -1714.46, 10)&lt;br /&gt;
			fadeCamera(client, true)&lt;br /&gt;
                        setCameraTarget(client, client)&lt;br /&gt;
			outputChatBox(&amp;quot;Welcome to My Server.&amp;quot;, client)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- if the username or password are not correct, output a message to the player&lt;br /&gt;
		outputChatBox(&amp;quot;Invalid username and password. Please re-connect and try again.&amp;quot;,client)&lt;br /&gt;
        end			&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent(&amp;quot;submitLogin&amp;quot;,true)&lt;br /&gt;
addEventHandler(&amp;quot;submitLogin&amp;quot;,root,loginHandler)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''For the purposes of this tutorial, a very basic username and password system is shown. For a more comprehensive alternative, you can use the Account System or a MySQL database.'''&lt;br /&gt;
&lt;br /&gt;
Also note the use of the variable &amp;quot;client&amp;quot;, it's an internal variable used by MTA to identify the player who triggered the event. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, do not forget to include the new gui.lua file in the meta.xml of the main resource, and label it as a client script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client/gui.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At this point, we now have a basic login window that checks the player's username and password when the login button is clicked. If they are correct, the player is automatically spawned.&lt;br /&gt;
&lt;br /&gt;
For further help with GUI, see the [[:Category:GUI_Tutorials|GUI tutorials]].&lt;br /&gt;
&lt;br /&gt;
[[Category:GUI_Tutorials]]&lt;br /&gt;
[[it:Introduzione_allo_scripting_della_GUI]]&lt;br /&gt;
[[ru:Introduction to Scripting the GUI]]&lt;br /&gt;
[[es:Introducción a la Programación de GUI]]&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPedWasted&amp;diff=29712</id>
		<title>OnPedWasted</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPedWasted&amp;diff=29712"/>
		<updated>2012-03-24T22:55:33Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* 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 ped is killed or dies.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int totalAmmo, element killer, int killerWeapon, int bodypart [, bool stealth ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''totalAmmo''': an integer representing the total ammo the victim had when he died.&lt;br /&gt;
*'''killer''': an [[element]] representing the player or vehicle who was the killer.  If there was no killer this is ''false''.&lt;br /&gt;
*'''killerWeapon''': an integer representing the [[Weapons|killer weapon]] or the [[Death Reasons|death reason]].&lt;br /&gt;
*'''bodypart''': an integer representing the bodypart ID the victim was hit on when he died.&lt;br /&gt;
{{BodyParts}}&lt;br /&gt;
*'''stealth''': boolean value representing whether or not this was a stealth kill&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[ped]] that died or got killed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function pedDied(totalAmmo, killer, killerWeapon)&lt;br /&gt;
if ( getElementType(&amp;quot;killer&amp;quot;) == &amp;quot;player&amp;quot; ) and ( getElementType(&amp;quot;source&amp;quot;) == &amp;quot;player&amp;quot; ) then&lt;br /&gt;
outputChatBox( getPlayerName(source) .. &amp;quot; was killed by &amp;quot; .. getPlayerName(killer) .. &amp;quot; with &amp;quot; .. killerWeapon .. &amp;quot;.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPedWasted&amp;quot;, getRootElement(), pedDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped_events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPedWasted&amp;diff=29711</id>
		<title>OnPedWasted</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPedWasted&amp;diff=29711"/>
		<updated>2012-03-24T22:51:04Z</updated>

		<summary type="html">&lt;p&gt;FabioGNR: /* 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 ped is killed or dies.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int totalAmmo, element killer, int killerWeapon, int bodypart [, bool stealth ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''totalAmmo''': an integer representing the total ammo the victim had when he died.&lt;br /&gt;
*'''killer''': an [[element]] representing the player or vehicle who was the killer.  If there was no killer this is ''false''.&lt;br /&gt;
*'''killerWeapon''': an integer representing the [[Weapons|killer weapon]] or the [[Death Reasons|death reason]].&lt;br /&gt;
*'''bodypart''': an integer representing the bodypart ID the victim was hit on when he died.&lt;br /&gt;
{{BodyParts}}&lt;br /&gt;
*'''stealth''': boolean value representing whether or not this was a stealth kill&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[ped]] that died or got killed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function pedDied(totalAmmo, killer, killerWeapon)&lt;br /&gt;
outputChatBox( getPlayerName(source) .. &amp;quot; was killed by &amp;quot; .. getPlayerName(killer) .. &amp;quot; with &amp;quot; .. killerWeapon .. &amp;quot;.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPedWasted&amp;quot;, getRootElement(), pedDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped_events}}&lt;/div&gt;</summary>
		<author><name>FabioGNR</name></author>
	</entry>
</feed>