<?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=NanoBob</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=NanoBob"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/NanoBob"/>
	<updated>2026-04-23T16:56:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleColor&amp;diff=62443</id>
		<title>GetVehicleColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleColor&amp;diff=62443"/>
		<updated>2019-04-03T07:17:43Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: Consistency with other wiki pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns the color of the specified vehicle. A vehicle can have up to four colors.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int, int, int, int, int, int, int, int, int, int, int, int getVehicleColor ( vehicle theVehicle, bool bRGB )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{OOP||[[vehicle]]:getColor}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' The [[vehicle]] that you wish to get the color of.&lt;br /&gt;
*'''bRGB :''' A boolean specifying whether to return RGB values. A setting of ''false'' will result in the function returning color ids instead.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*Returns 12 [[int|ints]] (if bRGB is ''true'') indicating the red, green and blue components of each of the 4 vehicle colors.&lt;br /&gt;
*Returns 4 [[int|ints]] (if bRGB is ''false'') indicating the color ids of each of the 4 vehicle colors.&lt;br /&gt;
*Returns ''false'' if the vehicle doesn't exist.&lt;br /&gt;
&lt;br /&gt;
Valid color ids if bRGB is set to false:&lt;br /&gt;
{{Vehicle_colors}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt; &lt;br /&gt;
This will output the 4 colors of any car that the player enters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerEnterVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
    -- Get the colors of the car and store them to 4 seperate variables&lt;br /&gt;
    local color1, color2, color3, color4 = getVehicleColor ( theVehicle )&lt;br /&gt;
    -- Output the four retrieved car colors into the chatbox&lt;br /&gt;
    outputChatBox ( &amp;quot;Car color 1: &amp;quot; .. color1 )&lt;br /&gt;
    outputChatBox ( &amp;quot;Car color 2: &amp;quot; .. color2 )&lt;br /&gt;
    outputChatBox ( &amp;quot;Car color 3: &amp;quot; .. color3 )&lt;br /&gt;
    outputChatBox ( &amp;quot;Car color 4: &amp;quot; .. color4 )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, getRootElement(), playerEnterVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementAngularVelocity&amp;diff=62442</id>
		<title>GetElementAngularVelocity</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementAngularVelocity&amp;diff=62442"/>
		<updated>2019-04-03T07:16:42Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: Consistency with other wiki pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature/item|3.0156|1.5.5|14165|Gets the current angular velocity of a specified, supported 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;
float, float, float getElementAngularVelocity ( element theElement )           &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:getAngularVelocity|angularVelocity|setElementAngularVelocity}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The [[element]] to retrieve the angular velocity from. Can be either a [[player]], [[ped]], [[object]], [[vehicle]] or a [[Element/Weapon|custom weapon]]. '''Server side supports only vehicles currently.'''&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns three floats describing the x, y and z rotation&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;getangularvelocity&amp;quot;, function(player)&lt;br /&gt;
    --retrieve angular velocity of the player&lt;br /&gt;
    local avx, avy, avz = getElementAngularVelocity(player)&lt;br /&gt;
    outputChatBox(&amp;quot;Your current angular velocity is: X: &amp;quot;..avx..&amp;quot; Y: &amp;quot;..avy..&amp;quot; Z: &amp;quot;..avz, player, 0, 255, 0, false)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.5.5-9.14060|1.5.5-9.14060|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVersion&amp;diff=62441</id>
		<title>GetVersion</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVersion&amp;diff=62441"/>
		<updated>2019-04-02T13:47:59Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: The point of this example was to implement a fallback to a method when running an older version. However someone (4 years ago) changed this which ended up with the example making no sense at all.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
This function gives you various version information about MTA and the operating system.&lt;br /&gt;
&lt;br /&gt;
''Note:'' Clientside will return the version from the player, and the server-sided will return version from the server.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getVersion ( )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table with version information. Specifically these keys are present in the table:&lt;br /&gt;
*'''number:''' the MTA server or client version (depending where the function was called) in pure numerical form, e.g. ''&amp;quot;256&amp;quot;''&lt;br /&gt;
*'''mta:''' the MTA server or client version (depending where the function was called) in textual form, e.g. ''&amp;quot;1.0&amp;quot;''&lt;br /&gt;
*'''name:''' the full MTA product name, either ''&amp;quot;MTA:SA Server&amp;quot;'' or ''&amp;quot;MTA:SA Client&amp;quot;''.&lt;br /&gt;
*'''netcode:''' the netcode version number.&lt;br /&gt;
*'''os:''' returns the operating system on which the server or client is running&lt;br /&gt;
*'''type:''' the type of build.  can be:&lt;br /&gt;
**'''&amp;quot;Nightly rX&amp;quot;''' - A nightly development build.  '''X''' represents the nightly build revision.&lt;br /&gt;
**'''&amp;quot;Custom&amp;quot;''' - A build compiled manually&lt;br /&gt;
**'''&amp;quot;Release&amp;quot;''' - A build that is publicly released (provisional).&lt;br /&gt;
*'''tag:''' the build tag (from 1.0.3 onwards). Contains infomation about the underlying version used. i.e. The final version of 1.0.3 has the build tag of &amp;quot;1.0.3 rc-9&amp;quot;. (This can be confirmed by using the console command 'ver'.)&lt;br /&gt;
*'''sortable:''' a 15 character sortable version string (from 1.0.4 onwards). Format of the string is described in [[getPlayerVersion]].&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example will make a script compatible only with version 1.0:&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function setHoboSkin(playerSource)&lt;br /&gt;
  local version = getVersion()&lt;br /&gt;
  if version.number &amp;lt; 256 then -- MTA 1.0 version number is 0x0100&lt;br /&gt;
    setPlayerSkin(playerSource, 137)&lt;br /&gt;
  else&lt;br /&gt;
    setElementModel(playerSource, 137)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;hobo&amp;quot;, setHoboSkin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This client and server example will kick players that have anything earlier than the final released version of 1.0.3:&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function sendVersion()&lt;br /&gt;
  -- Send local player version to the server&lt;br /&gt;
  triggerServerEvent(&amp;quot;onNotifyPlayerVersion&amp;quot;, resourceRoot, getVersion())&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, sendVersion)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function handlePlayerVersion(version)&lt;br /&gt;
  if version.number &amp;gt; 256 + 3 then  -- Allow anything above 1.0.3&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if version.number == 256 + 3 then  -- Check further if it is exactly 1.0.3&lt;br /&gt;
    if version.type == &amp;quot;Release&amp;quot; then -- Check further if it is the &amp;quot;Release&amp;quot; type&lt;br /&gt;
      local _, _, buildnumber = string.find(version.tag or &amp;quot;&amp;quot;, &amp;quot;(%d)$&amp;quot;)  -- Extract the build number if there&lt;br /&gt;
      buildnumber = tonumber(buildnumber) or 0&lt;br /&gt;
      if buildnumber &amp;gt;= 9 then  -- Allow 9 and above&lt;br /&gt;
        return&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  outputConsole(&amp;quot;Kicking player as below 1.0.3 Release build 9&amp;quot;)&lt;br /&gt;
  kickPlayer(client, &amp;quot;Upgrade your version at www.mtasa.com&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEvent(&amp;quot;onNotifyPlayerVersion&amp;quot;, true)&lt;br /&gt;
addEventHandler(&amp;quot;onNotifyPlayerVersion&amp;quot;, resourceRoot, handlePlayerVersion)&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>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetWeaponProperty&amp;diff=62339</id>
		<title>SetWeaponProperty</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetWeaponProperty&amp;diff=62339"/>
		<updated>2019-03-08T15:36:02Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: Changed layout to be more consistent with the rest of the wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&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 function sets the weapon property of the specified weapons specified weapon type. See lower down the page for documentation related to weapon creation.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setWeaponProperty ( int weaponID/string weaponName, string weaponSkill, string property, int/float theValue )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''weaponID:''' The ID or name of the [[Weapons|weapon]] you want to set a property of. Names can be:&lt;br /&gt;
{{Some Weapon Types}}&lt;br /&gt;
*'''weaponSkill:''' Either: &amp;quot;pro&amp;quot;, &amp;quot;std&amp;quot; or &amp;quot;poor&amp;quot;. The player must have this skill level set to have the effect.&lt;br /&gt;
*'''property:''' The property you want to set the value of:&lt;br /&gt;
{{Weapon Properties Writable}}&lt;br /&gt;
*'''theValue:''' The value to set the property to.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
On success:&lt;br /&gt;
&lt;br /&gt;
'''bool:''' Returns true if the weapon property was successfully set&lt;br /&gt;
&lt;br /&gt;
On failure:&lt;br /&gt;
&lt;br /&gt;
'''bool:''' Returns false if the weapon property was unable to be set&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;p&amp;gt;The client side function only applies to custom weapons created client sided&amp;lt;/p&amp;gt;&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setWeaponProperty ( weapon theWeapon, string strProperty, value theValue )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/Weapon|weapon]]:setProperty||getWeaponProperty}}&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
&lt;br /&gt;
* '''theWeapon:''' the weapon to change the property of.&lt;br /&gt;
* '''strProperty:''' the property to edit:&lt;br /&gt;
{{Custom Weapon Properties Writable}}&lt;br /&gt;
* '''theValue:''' The value to set the property to.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if the property was set.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example sets the weapon range of the M4 at poor skill level to 75&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local rangeSet = setWeaponProperty(31, &amp;quot;poor&amp;quot;, &amp;quot;weapon_range&amp;quot;, 75)&lt;br /&gt;
if (rangeSet) then&lt;br /&gt;
    outputChatBox(&amp;quot;M4 range at poor skill is set now 75!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example makes the silenced pistol dual wielded at pro skill level&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
setWeaponProperty(23, &amp;quot;pro&amp;quot;, &amp;quot;flags&amp;quot;, 0x000800) -- Warning - Depends on the current flag setting&lt;br /&gt;
setWeaponProperty(23, &amp;quot;pro&amp;quot;, &amp;quot;flags&amp;quot;, 0x000002) -- Warning - Depends on the current flag setting&lt;br /&gt;
setWeaponProperty(23, &amp;quot;pro&amp;quot;, &amp;quot;maximum_clip_ammo&amp;quot;, 34)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This examples doubles the range of the colt 45 hand gun&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
setWeaponProperty(22, &amp;quot;poor&amp;quot;, &amp;quot;weapon_range&amp;quot;, 70)&lt;br /&gt;
setWeaponProperty(22, &amp;quot;std&amp;quot;, &amp;quot;weapon_range&amp;quot;, 70)&lt;br /&gt;
setWeaponProperty(22, &amp;quot;pro&amp;quot;, &amp;quot;weapon_range&amp;quot;, 70)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example makes the minigun able to fire all its ammo without the short reload time&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
setWeaponProperty(&amp;quot;minigun&amp;quot;, &amp;quot;pro&amp;quot;, &amp;quot;maximum_clip_ammo&amp;quot;, 1000)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example turns off auto aim for all weapons&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function setAutoAimForAllWeapons( bEnable )&lt;br /&gt;
    weaponList = { &amp;quot;colt 45&amp;quot;, &amp;quot;silenced&amp;quot;, &amp;quot;deagle&amp;quot;, &amp;quot;shotgun&amp;quot;, &amp;quot;sawed-off&amp;quot;, &amp;quot;combat shotgun&amp;quot;, &amp;quot;uzi&amp;quot;, &amp;quot;mp5&amp;quot;, &amp;quot;ak-47&amp;quot;, &amp;quot;m4&amp;quot;, &amp;quot;tec-9&amp;quot;, &amp;quot;rifle&amp;quot;, &amp;quot;sniper&amp;quot;, &amp;quot;minigun&amp;quot; }&lt;br /&gt;
    for _,weapon in ipairs( weaponList ) do&lt;br /&gt;
        for _,skill in ipairs( { &amp;quot;poor&amp;quot;, &amp;quot;std&amp;quot;, &amp;quot;pro&amp;quot; } ) do&lt;br /&gt;
            setWeaponPropertyFlag( weapon, skill, 0x0001, not bEnable )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Set or clear an individual weapon flag bit&lt;br /&gt;
function setWeaponPropertyFlag( weapon, skill, flagBit, bSet )&lt;br /&gt;
    local bIsSet = bitAnd( getWeaponProperty(weapon, skill, &amp;quot;flags&amp;quot;), flagBit ) ~= 0&lt;br /&gt;
    if bIsSet ~= bSet then&lt;br /&gt;
        setWeaponProperty(weapon, skill, &amp;quot;flags&amp;quot;, flagBit)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Turn off auto aim&lt;br /&gt;
setAutoAimForAllWeapons( false )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.3|1.3.0-9.04555|}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.4.0-9.06339|Added 'fire_rotation' property}}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Weapon functions}}&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateMarker&amp;diff=62338</id>
		<title>CreateMarker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateMarker&amp;diff=62338"/>
		<updated>2019-03-08T09:48:49Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: Missing argument type&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
[[Image:Mtasa_markers.png|thumb|337px|This image shows all the different marker types available using this function.]]&lt;br /&gt;
&lt;br /&gt;
This function creates a marker. A marker is a 3D model in the world that can highlight a particular point or area, often used to instruct players where to go to perform actions such as entering buildings.&lt;br /&gt;
&lt;br /&gt;
There are various limits that govern the maximum number of each type that can be visible at once. These are:&lt;br /&gt;
* Coronas: 32&lt;br /&gt;
* Checkpoints, Rings, Cylinders and Arrows combined: 32&lt;br /&gt;
&lt;br /&gt;
You are able to create as many markers as you wish (memory and element limit permitting), but the player will only be able to see the nearest ones up to the limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&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;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, bool visibleTo = getRootElement( ) ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&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;
* '''theType''': The visual type of the marker to be created. Possible values:&lt;br /&gt;
{{Marker_types}}&lt;br /&gt;
* '''size''': The diameter of the marker to be created, in meters.&lt;br /&gt;
* '''r''': An integer number representing the amount of red to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''g''': An integer number representing the amount of green to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''b''': An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''a''': An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).&lt;br /&gt;
* '''visibleTo''': This defines which elements can see the marker. Defaults to visible to everyone. See [[visibility]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&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;
* '''theType''': The visual type of the marker to be created. Possible values:&lt;br /&gt;
{{Marker_types}}&lt;br /&gt;
* '''size''': The diameter of the marker to be created, in meters.&lt;br /&gt;
* '''r''': An integer number representing the amount of red to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''g''': An integer number representing the amount of green to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''b''': An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''a''': An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the [[marker]] element that was created, or ''false'' if the arguments are incorrect.&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 example creates a marker next to the player when they type 'createmarker':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- this function is called whenever someone types 'createmarker' in the console:&lt;br /&gt;
function consoleCreateMarker ( thePlayer, commandName )&lt;br /&gt;
   if ( thePlayer ) then&lt;br /&gt;
      local x, y, z = getElementPosition ( thePlayer ) -- get the player's position&lt;br /&gt;
      -- create a cylindrical marker next to the player:&lt;br /&gt;
      local theMarker = createMarker ( x + 2, y + 2, z, &amp;quot;cylinder&amp;quot;, 1.5, 255, 255, 0, 170 )&lt;br /&gt;
      if ( theMarker ) then -- check if the marker was created successfully&lt;br /&gt;
         outputConsole ( &amp;quot;Marker created successfully&amp;quot;, thePlayer )&lt;br /&gt;
      else&lt;br /&gt;
         outputConsole ( &amp;quot;Failed to create marker&amp;quot;, thePlayer )&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&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;
==See Also==&lt;br /&gt;
{{Marker functions}}&lt;br /&gt;
[[ru:createMarker]]&lt;br /&gt;
[[ar:createMarker]]&lt;br /&gt;
[[pl:createMarker]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementData&amp;diff=62337</id>
		<title>GetElementData</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementData&amp;diff=62337"/>
		<updated>2019-03-08T09:21:10Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: Missing argument type&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function retrieves [[element data]] attached to an element under a certain key.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;var getElementData ( element theElement, string key [, bool inherit = true] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getData||setElementData}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' This is the element with data you want to retrieve.&lt;br /&gt;
*'''key:''' The name of the element data entry you want to retrieve. (Maximum 31 characters.)&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''inherit:''' - toggles whether or not the function should go up the hierarchy to find the requested key in case the specified element doesn't have it.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function returns a ''variable'' containing the requested element data, or ''false'' if the element or the element data does not exist. When getting data corresponding to a XML attribute, this is always a ''string''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example stores the tick count when a player joins and then allows players to see how long they are connected using a console function 'joinTime'.&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinTime ( )&lt;br /&gt;
    setElementData ( source, &amp;quot;joinTime&amp;quot;, getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime'&lt;br /&gt;
end&lt;br /&gt;
-- Make our 'joinTime' function be called when a player joins&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, joinTime )&lt;br /&gt;
&lt;br /&gt;
function showJoinTime ( source, commandName, playerName )&lt;br /&gt;
	if ( playerName ) then -- see if a player was specified&lt;br /&gt;
		thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player&lt;br /&gt;
		if ( thePlayer ) then -- if one was found...&lt;br /&gt;
			local timeOnline = (getTickCount() - getElementData ( thePlayer, &amp;quot;joinTime&amp;quot; )) / 1000 -- calculates the time since join&lt;br /&gt;
			outputChatBox ( getPlayerName ( thePlayer )..&amp;quot; joined &amp;quot;..timeOnline..&amp;quot; seconds ago&amp;quot;, source ) -- output the player's join time&lt;br /&gt;
		else&lt;br /&gt;
			outputChatBox ( &amp;quot;Couldn't find '&amp;quot; .. playerName .. &amp;quot;'&amp;quot;, source ) -- display an error&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- display when the player who used the function joined and inform how to see other people's join time&lt;br /&gt;
		local timeOnline = (getTickCount() - getElementData ( source, &amp;quot;joinTime&amp;quot; )) / 1000 -- calculate the time since join&lt;br /&gt;
		outputChatBox ( &amp;quot;You joined &amp;quot; ..timeOnline..&amp;quot; seconds ago&amp;quot;, source )&lt;br /&gt;
		outputChatBox ( &amp;quot;Use 'join_time &amp;lt;player name&amp;gt;' to see other people's join time&amp;quot;, source )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Add a console command joinTime, that takes an optional parameter of a player's name&lt;br /&gt;
addCommandHandler ( &amp;quot;joinTime&amp;quot;, showJoinTime )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateBlipAttachedTo&amp;diff=62336</id>
		<title>CreateBlipAttachedTo</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateBlipAttachedTo&amp;diff=62336"/>
		<updated>2019-03-08T09:20:13Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: Missing argument type&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function creates a [[blip]] that is attached to an [[element]]. This blip is displayed as an icon on the client's radar and will 'follow' the element that it is attached to around.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
blip createBlipAttachedTo ( element elementToAttachTo [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0, element visibleTo = getRootElement( ) ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
blip createBlipAttachedTo ( element elementToAttachTo [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{OOP||[[Blip]].createAttachedTo||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''elementToAttachTo:''' The [[element]] to attach the marker to.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''icon:''' The icon that the radar blips should be. Valid values can be seen at [[Radar Blips]]&lt;br /&gt;
*'''size:''' The size of the radar blip. Only applicable to the ''Marker'' icon. Default value is 2. Maximum is 25.&lt;br /&gt;
*'''r:''' The amount of red in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 255. &lt;br /&gt;
*'''g:''' The amount of green in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 0.&lt;br /&gt;
*'''b:''' The amount of blue in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 0.&lt;br /&gt;
*'''a:''' The amount of alpha in the blip's color (0 - 255). Only applicable to the ''Marker'' icon. Default is 255.&lt;br /&gt;
{{New feature/item|3|1.0||&lt;br /&gt;
*'''ordering:''' This defines the blip's Z-level ordering (-32768 - 32767). Default is 0.&lt;br /&gt;
*'''visibleDistance:''' The maximum distance from the camera at which the blip is still visible (0-65535)&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;
*'''visibleTo:''' What elements can see the blip. Defaults to visible to everyone. See [[visibility]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[blip]] if the blip was created succesfully, or ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a radar blip attached to a random player, visible to everyone. The blip will follow the player around as they move. This could be used for manhunt, to emphasise a random player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Pick a random player&lt;br /&gt;
function setupRandomRobber ()&lt;br /&gt;
	local myPlayer = getRandomPlayer ()&lt;br /&gt;
	-- Create a radar blip at the player's position, with a 'cash' icon and only visible to everyone (no 'visibleTo' parameter)&lt;br /&gt;
	local myBlip = createBlipAttachedTo ( myPlayer, 52 )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Blip_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:createBlipAttachedTo]]&lt;br /&gt;
[[RU:createBlipAttachedTo]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateBlip&amp;diff=62335</id>
		<title>CreateBlip</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateBlip&amp;diff=62335"/>
		<updated>2019-03-08T09:19:30Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: Missing return type&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function creates a [[blip]] [[element]], which is displayed as an icon on the client's radar.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
blip createBlip ( float x, float y, float z [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0, element visibleTo = getRootElement( ) ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
blip createBlip ( float x, float y, float z [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 16383.0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
{{OOP||[[Blip]]}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''x:''' The x position of the blip, in world coordinates.&lt;br /&gt;
*'''y:''' The y position of the blip, in world coordinates.&lt;br /&gt;
*'''z:''' The z position of the blip, in world coordinates.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''icon:''' The icon that the radar blips should be. Valid values can be seen at [[Radar Blips]]&lt;br /&gt;
*'''size:''' The size of the radar blip. Only applicable to the ''Marker'' icon. Default is 2. Maximum is 25.&lt;br /&gt;
*'''r:''' The amount of red in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 255. &lt;br /&gt;
*'''g:''' The amount of green in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 0.&lt;br /&gt;
*'''b:''' The amount of blue in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 0.&lt;br /&gt;
*'''a:''' The amount of alpha in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 255.&lt;br /&gt;
{{New feature/item|3|1.0||&lt;br /&gt;
*'''ordering:''' This defines the blip's Z-level ordering (-32768–32767). Default is 0.&lt;br /&gt;
*'''visibleDistance:''' The maximum distance from the camera at which the blip is still visible (0–65535).&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;
*'''visibleTo:''' This defines which elements can see the blip. Defaults to visible to everyone. See [[visibility]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns an [[element]] of the [[blip]] if it was created successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
'''Example 1:''' This example creates a radar blip at a random player's position and makes it so that it is only visible to that player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Pick a random player&lt;br /&gt;
local myPlayer = getRandomPlayer( )&lt;br /&gt;
-- Retrieve the player's position and store it in the variables x, y and z&lt;br /&gt;
local x, y, z = getElementPosition( myPlayer )&lt;br /&gt;
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to the player&lt;br /&gt;
local myBlip = createBlip( x, y, z, 51, 0, 0, 0, 255, myPlayer )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example attaches a blip to a player. You can attach a blip to an element by just setting the blip's parent to that element.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Pick a random player&lt;br /&gt;
local myPlayer = getRandomPlayer( )&lt;br /&gt;
-- Create a radar blip in the middle of the map&lt;br /&gt;
local myBlip = createBlip( 0, 0, 0 )&lt;br /&gt;
-- Make the player the parent of the blip, so that the blip follows the player around&lt;br /&gt;
setElementParent( myBlip, myPlayer )&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;
{{Blip_functions}}&lt;br /&gt;
&lt;br /&gt;
[[HU:createBlip]]&lt;br /&gt;
[[AR:createBlip]]&lt;br /&gt;
[[es:createBlip]]&lt;br /&gt;
[[DE:createBlip]]&lt;br /&gt;
[[PL:createBlip]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPlayerMoney&amp;diff=62334</id>
		<title>GetPlayerMoney</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPlayerMoney&amp;diff=62334"/>
		<updated>2019-03-08T09:00:36Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: The return value in the server block was inconsistent with almost any other page on the wiki (and even the client block on the same page)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
Returns the amount of money a player currently has.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' The amount may vary between the server and client, you shouldn't trust the client side value to always be accurate.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int getPlayerMoney ( player thePlayer )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[player]]:getMoney|money|setPlayerMoney}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player you wish the retrieve the amount of money from.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an integer with the amount of money the specified player has, ''false'' if the player is invalid.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int getPlayerMoney ( )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[Player]].getMoney||setPlayerMoney}}&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an integer with the amount of money the local player has.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
When a player types '/checkMoney' this example retrieves the player's money and outputs a message according to the value.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkMoney(thePlayer, command)&lt;br /&gt;
	local money = getPlayerMoney(thePlayer)                                -- get the amount of money from the player who entered the command&lt;br /&gt;
	if (money &amp;gt; 1000) then                                                 -- if money is more than 1000&lt;br /&gt;
		outputChatBox(&amp;quot;You are rich: &amp;quot; .. tostring(money), thePlayer)  -- output this message together with the money&lt;br /&gt;
 	else&lt;br /&gt;
		outputChatBox(&amp;quot;Poor guy...&amp;quot;, thePlayer)                        -- and else, output this message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;checkMoney&amp;quot;, checkMoney)                                    -- add the console command&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;
{{Player functions}}&lt;br /&gt;
&lt;br /&gt;
[[pt-br:getPlayerMoney]]&lt;br /&gt;
[[ru:getPlayerMoney]]&lt;br /&gt;
[[tr:getPlayerMoney]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiGridListSetSelectionMode&amp;diff=62329</id>
		<title>GuiGridListSetSelectionMode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiGridListSetSelectionMode&amp;diff=62329"/>
		<updated>2019-03-06T12:48:44Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: For more consistency&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function sets the selection mode of a gui gridlist.  For example, the MTA ''server browser'' selects a whole row, while the ''Controls'' dialog selects a single cell. To select multiple items you must be holding down 'ctrl'.&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 guiGridListSetSelectionMode ( gui-Element gridlist, int mode )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:setSelectionMode|selectionMode}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''gridlist:''' The gridlist in which you wish to set the selection mode.&lt;br /&gt;
*'''mode:''' The mode of the selection.  Can be the following values:&lt;br /&gt;
**'''0:''' Single row selection&lt;br /&gt;
**'''1:''' Multiple row selection&lt;br /&gt;
**'''2:''' Single cell selection&lt;br /&gt;
**'''3:''' Multiple cell selection&lt;br /&gt;
**'''4:''' Nominated(First) single column selection&lt;br /&gt;
**'''5:''' Nominated(First) multiple column selection&lt;br /&gt;
**'''6:''' Single column selection&lt;br /&gt;
**'''7:''' Multiple column selection&lt;br /&gt;
**'''8:''' Nominated(First) single row selection&lt;br /&gt;
**'''9:''' Nominated(First) multiple row selection&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the selection mode was successfully set, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a grid list with 3 columns and 3 rows, each with text describing its position in the grid list. Also, the cursor is turned on. The player can use the command 'setmode #' to change how the grid list can be selected.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function clientsideResourceStart ()&lt;br /&gt;
	--Create a gridlist&lt;br /&gt;
    	myGridList = guiCreateGridList ( 0.35, 0.35, 0.4, 0.1, true ) &lt;br /&gt;
    	--Create a column for myGridList to add rows into&lt;br /&gt;
	columnA = guiGridListAddColumn ( myGridList, &amp;quot;columnA Title&amp;quot;, 0.3 )&lt;br /&gt;
	columnB = guiGridListAddColumn ( myGridList, &amp;quot;columnA Title&amp;quot;, 0.3 )&lt;br /&gt;
	columnC = guiGridListAddColumn ( myGridList, &amp;quot;columnA Title&amp;quot;, 0.3 ) &lt;br /&gt;
	--Create a row for columnA&lt;br /&gt;
	rowA = guiGridListAddRow ( myGridList )&lt;br /&gt;
	rowB = guiGridListAddRow ( myGridList )&lt;br /&gt;
	rowC = guiGridListAddRow ( myGridList )&lt;br /&gt;
        --Set the text of columnA, rowA to &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowA, columnA, &amp;quot;rowA ColumnA&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowB, columnA, &amp;quot;rowB ColumnA&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowC, columnA, &amp;quot;rowC ColumnA&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowA, columnB, &amp;quot;rowA ColumnB&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowB, columnB, &amp;quot;rowB ColumnB&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowC, columnB, &amp;quot;rowC ColumnB&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowA, columnC, &amp;quot;rowA ColumnC&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowB, columnC, &amp;quot;rowB ColumnC&amp;quot;, false, false )&lt;br /&gt;
	guiGridListSetItemText ( myGridList, rowC, columnC, &amp;quot;rowC ColumnC&amp;quot;, false, false )&lt;br /&gt;
	showCursor ( true )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientResourceStart&amp;quot;, resourceRoot, clientsideResourceStart )  &lt;br /&gt;
&lt;br /&gt;
--The player types 'setmode' to activate this function. Additionaly, the player needs&lt;br /&gt;
--to type a modeNumber. Ex: 'setmode 5', 5 would be stored as modeNumber&lt;br /&gt;
function setSelectionMode ( commandName, modeNumber )&lt;br /&gt;
	--The player enters the command &amp;quot;setmode #&amp;quot;. The modeNumber entry will be a string&lt;br /&gt;
	--argument. Ex: &amp;quot;9&amp;quot; &amp;quot;nine&amp;quot;. Attempt to change modeNumber into a number argument.&lt;br /&gt;
	modeNumber = tonumber(modeNumber)&lt;br /&gt;
	--If the selection mode was successfully changed, output a message saying which&lt;br /&gt;
	--mode it changed to. Otherwise, list reasons why it did not work.&lt;br /&gt;
        if ( guiGridListSetSelectionMode ( myGridList, modeNumber ) ) then&lt;br /&gt;
		outputChatBox ( &amp;quot;Changed grid list selection mode to: &amp;quot;..modeNumber )&lt;br /&gt;
	else                                                                        &lt;br /&gt;
		outputChatBox ( &amp;quot;modeNumber must be a number and be between 0 and 9&amp;quot; )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setmode&amp;quot;, setSelectionMode )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI functions}}&lt;br /&gt;
{{GUI_events}}&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateEffect&amp;diff=62328</id>
		<title>CreateEffect</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateEffect&amp;diff=62328"/>
		<updated>2019-03-06T12:19:40Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{New items|3.0140|1.4|&lt;br /&gt;
Creates an [[Element/Effect|effect]] on specified position.&lt;br /&gt;
}}&lt;br /&gt;
{{Note|Not all effects support rotation (e.g. the &amp;quot;fire&amp;quot; - effect doesn't).}}&lt;br /&gt;
{{Note|All effects have their own duration.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;effect createEffect ( string name, float x, float y, float z [, float rX, float rY, float rZ, float drawDistance = 0, bool soundEnable = false ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Effect]]}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''name:''' A string contains [[Element/Effect#Effects_list|effect name]].&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;
*'''drawDistance:''' A floating point number between 1 and 8191 which represents the draw distance of the effect, or 0 to use the default draw distance.&lt;br /&gt;
{{New feature/item|3.0155|1.5.5||&lt;br /&gt;
*'''soundEnable:''' to enable the sound of the effect.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Returns ===&lt;br /&gt;
Returns the [[Element/Effect|effect]] element if creation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--There are 82 effects&lt;br /&gt;
&lt;br /&gt;
local effectNames = {&lt;br /&gt;
&amp;quot;blood_heli&amp;quot;,&amp;quot;boat_prop&amp;quot;,&amp;quot;camflash&amp;quot;,&amp;quot;carwashspray&amp;quot;,&amp;quot;cement&amp;quot;,&amp;quot;cloudfast&amp;quot;,&amp;quot;coke_puff&amp;quot;,&amp;quot;coke_trail&amp;quot;,&amp;quot;cigarette_smoke&amp;quot;,&lt;br /&gt;
&amp;quot;explosion_barrel&amp;quot;,&amp;quot;explosion_crate&amp;quot;,&amp;quot;explosion_door&amp;quot;,&amp;quot;exhale&amp;quot;,&amp;quot;explosion_fuel_car&amp;quot;,&amp;quot;explosion_large&amp;quot;,&amp;quot;explosion_medium&amp;quot;,&lt;br /&gt;
&amp;quot;explosion_molotov&amp;quot;,&amp;quot;explosion_small&amp;quot;,&amp;quot;explosion_tiny&amp;quot;,&amp;quot;extinguisher&amp;quot;,&amp;quot;flame&amp;quot;,&amp;quot;fire&amp;quot;,&amp;quot;fire_med&amp;quot;,&amp;quot;fire_large&amp;quot;,&amp;quot;flamethrower&amp;quot;,&lt;br /&gt;
&amp;quot;fire_bike&amp;quot;,&amp;quot;fire_car&amp;quot;,&amp;quot;gunflash&amp;quot;,&amp;quot;gunsmoke&amp;quot;,&amp;quot;insects&amp;quot;,&amp;quot;heli_dust&amp;quot;,&amp;quot;jetpack&amp;quot;,&amp;quot;jetthrust&amp;quot;,&amp;quot;nitro&amp;quot;,&amp;quot;molotov_flame&amp;quot;,&lt;br /&gt;
&amp;quot;overheat_car&amp;quot;,&amp;quot;overheat_car_electric&amp;quot;,&amp;quot;prt_blood&amp;quot;,&amp;quot;prt_boatsplash&amp;quot;,&amp;quot;prt_bubble&amp;quot;,&amp;quot;prt_cardebris&amp;quot;,&amp;quot;prt_collisionsmoke&amp;quot;,&lt;br /&gt;
&amp;quot;prt_glass&amp;quot;,&amp;quot;prt_gunshell&amp;quot;,&amp;quot;prt_sand&amp;quot;,&amp;quot;prt_sand2&amp;quot;,&amp;quot;prt_smokeII_3_expand&amp;quot;,&amp;quot;prt_smoke_huge&amp;quot;,&amp;quot;prt_spark&amp;quot;,&amp;quot;prt_spark_2&amp;quot;,&lt;br /&gt;
&amp;quot;prt_splash&amp;quot;,&amp;quot;prt_wake&amp;quot;,&amp;quot;prt_watersplash&amp;quot;,&amp;quot;prt_wheeldirt&amp;quot;,&amp;quot;petrolcan&amp;quot;,&amp;quot;puke&amp;quot;,&amp;quot;riot_smoke&amp;quot;,&amp;quot;spraycan&amp;quot;,&amp;quot;smoke30lit&amp;quot;,&amp;quot;smoke30m&amp;quot;,&lt;br /&gt;
&amp;quot;smoke50lit&amp;quot;,&amp;quot;shootlight&amp;quot;,&amp;quot;smoke_flare&amp;quot;,&amp;quot;tank_fire&amp;quot;,&amp;quot;teargas&amp;quot;,&amp;quot;teargasAD&amp;quot;,&amp;quot;tree_hit_fir&amp;quot;,&amp;quot;tree_hit_palm&amp;quot;,&amp;quot;vent&amp;quot;,&amp;quot;vent2&amp;quot;,&lt;br /&gt;
&amp;quot;water_hydrant&amp;quot;,&amp;quot;water_ripples&amp;quot;,&amp;quot;water_speed&amp;quot;,&amp;quot;water_splash&amp;quot;,&amp;quot;water_splash_big&amp;quot;,&amp;quot;water_splsh_sml&amp;quot;,&amp;quot;water_swim&amp;quot;,&amp;quot;waterfall_end&amp;quot;,&lt;br /&gt;
&amp;quot;water_fnt_tme&amp;quot;,&amp;quot;water_fountain&amp;quot;,&amp;quot;wallbust&amp;quot;,&amp;quot;WS_factorysmoke&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;createEffect&amp;quot;, function(_, effectIndex)&lt;br /&gt;
   effectIndex = tonumber(effectIndex)&lt;br /&gt;
   if effectIndex and type(effectIndex) == &amp;quot;number&amp;quot; then&lt;br /&gt;
      if effectIndex &amp;gt; 0 and effectIndex &amp;lt;= #effectNames then&lt;br /&gt;
         createEffect(effectNames[effectIndex], Vector3( getElementPosition( getLocalPlayer() ) ), 0, 0, 0)&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
--Example Command: /createEffect 3&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.4.0-9.06892|Added drawDistance argument}}&lt;br /&gt;
{{ChangelogItem|1.5.4-9.11631|Added soundEnable argument}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
{{Client_Effects_functions}}&lt;br /&gt;
[[ru:createEffect]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxGetPixelColor&amp;diff=62327</id>
		<title>DxGetPixelColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxGetPixelColor&amp;diff=62327"/>
		<updated>2019-03-06T12:18:50Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the color of a single pixel from [[Texture_pixels|pixels]] contained in a string. It only works with ''''plain'''' format pixels.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int, int, int, int dxGetPixelColor( string pixels, int x, int y )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''pixels :''' The pixels to use&lt;br /&gt;
*'''x:''' The X coordinate for the pixel&lt;br /&gt;
*'''y:''' The Y coordinate for the pixel&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns 4 ''int''s representing the rgba color value of the pixel if succesful, or ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local texture = dxCreateTexture(4,4)        --Create a texture&lt;br /&gt;
local pixel = dxGetTexturePixels(texture)  --Get pixel element&lt;br /&gt;
local sx,sy = dxGetPixelsSize(pixel)             --Get pixel size&lt;br /&gt;
local tab = {}                                           --Define a table&lt;br /&gt;
for i=0,sx-1 do                                         --From 0th pixel to 3th pixel in width&lt;br /&gt;
    tab[i+1] = {}                                         --Define a table&lt;br /&gt;
    for j=0,sy-1 do                                     --From 0th pixel to 3th pixel in height&lt;br /&gt;
        local r,g,b,a = dxGetPixelColor(pixel,i,j) --Get pixel color&lt;br /&gt;
        tab[i+1][j+1] = {r,g,b,a}                      --Save the color in the table&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxGetPixelColor]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxGetPixelColor&amp;diff=62326</id>
		<title>DxGetPixelColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxGetPixelColor&amp;diff=62326"/>
		<updated>2019-03-06T12:17:37Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function gets the color of a single pixel from [[Texture_pixels|pixels]] contained in a string. It only works with ''''plain'''' format pixels.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int, int, int, int dxGetPixelColor( string pixels, int x, int y )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''pixels :''' The pixels to use&lt;br /&gt;
*'''x:''' The X coordinate for the pixel&lt;br /&gt;
*'''y:''' The Y coordinate for the pixel&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns the color of pixel if successful, or ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local texture = dxCreateTexture(4,4)        --Create a texture&lt;br /&gt;
local pixel = dxGetTexturePixels(texture)  --Get pixel element&lt;br /&gt;
local sx,sy = dxGetPixelsSize(pixel)             --Get pixel size&lt;br /&gt;
local tab = {}                                           --Define a table&lt;br /&gt;
for i=0,sx-1 do                                         --From 0th pixel to 3th pixel in width&lt;br /&gt;
    tab[i+1] = {}                                         --Define a table&lt;br /&gt;
    for j=0,sy-1 do                                     --From 0th pixel to 3th pixel in height&lt;br /&gt;
        local r,g,b,a = dxGetPixelColor(pixel,i,j) --Get pixel color&lt;br /&gt;
        tab[i+1][j+1] = {r,g,b,a}                      --Save the color in the table&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|n/a|1.3|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxGetPixelColor]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawCircle&amp;diff=62325</id>
		<title>DxDrawCircle</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawCircle&amp;diff=62325"/>
		<updated>2019-03-06T12:14:16Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0156|1.5.5|13977|This function draws a circle shape on the screen - rendered for '''one''' frame.  This should be used in conjunction with [[onClientRender]] in order to be display continuously.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool dxDrawCircle ( float posX, float posY, float radius [, float startAngle = 0.0, float stopAngle = 360.0, color theColor = white,&lt;br /&gt;
                    color theCenterColor = theColor, int segments = 32, int ratio = 1, bool postGUI = false ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
[[Image:DxDrawCircle_Saml1er.png|thumb|An example of how dxDrawCircle function works in practice.]]&lt;br /&gt;
&lt;br /&gt;
* '''posX''': An integer representing the '''absolute''' X position of the circle center, represented by pixels on the screen.&lt;br /&gt;
* '''posY''': An integer representing the '''absolute''' Y position of the circle center, represented by pixels on the screen.&lt;br /&gt;
* '''radius''': An integer representing the radius scale of the circle that is being drawn.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''startAngle''': An integer representing the angle of the first point of the circle.&lt;br /&gt;
* '''stopAngle''': An integer representing the angle of the last point of the circle.&lt;br /&gt;
* '''theColor''': An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
* '''theCenterColor''': An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
* '''segments''': An integer ranging from 3-1024 representing how many triangles are used to form the circle, more segments = smoother circle. Note: using lots of segments may cause lag.&lt;br /&gt;
* '''ratio''': Ratio between width and height, e.g: 2 would mean that the width of the circle is 2 times the height.&lt;br /&gt;
* '''postGUI''': A bool representing whether the circle 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 the creation of the 2D circle was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This function draws a rectangle with rounded corners.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function dxDrawRoundedRectangle(x, y, rx, ry, color, radius)&lt;br /&gt;
    rx = rx - radius * 2&lt;br /&gt;
    ry = ry - radius * 2&lt;br /&gt;
    x = x + radius&lt;br /&gt;
    y = y + radius&lt;br /&gt;
&lt;br /&gt;
    if (rx &amp;gt;= 0) and (ry &amp;gt;= 0) then&lt;br /&gt;
        dxDrawRectangle(x, y, rx, ry, color)&lt;br /&gt;
        dxDrawRectangle(x, y - radius, rx, radius, color)&lt;br /&gt;
        dxDrawRectangle(x, y + ry, rx, radius, color)&lt;br /&gt;
        dxDrawRectangle(x - radius, y, radius, ry, color)&lt;br /&gt;
        dxDrawRectangle(x + rx, y, radius, ry, color)&lt;br /&gt;
&lt;br /&gt;
        dxDrawCircle(x, y, radius, 180, 270, color, color, 7)&lt;br /&gt;
        dxDrawCircle(x + rx, y, radius, 270, 360, color, color, 7)&lt;br /&gt;
        dxDrawCircle(x + rx, y + ry, radius, 0, 90, color, color, 7)&lt;br /&gt;
        dxDrawCircle(x, y + ry, radius, 90, 180, color, color, 7)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
dxDrawRoundedRectangle(350, 50, 100, 100, tocolor(0, 255, 0, 255), 20)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
[[hu:dxDrawCircle]]&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetTimers&amp;diff=62324</id>
		<title>GetTimers</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetTimers&amp;diff=62324"/>
		<updated>2019-03-06T11:26:06Z</updated>

		<summary type="html">&lt;p&gt;NanoBob: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns a table of all active timers that the resource that calls it has created. Alternatively, only the timers with a remaining time less than or equal to a certain value can be retrieved.&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 getTimers ( [ int theTime = nil ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''theTime:''' The maximum time left (in milliseconds) on the timers you wish to retrieve.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table of all the active timers.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example kills timers with a remaining time of less than 1 minute.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Find and kill all the timers with less than 1 minute to go&lt;br /&gt;
timers = getTimers ( 60000 )&lt;br /&gt;
-- Loop through the timer list&lt;br /&gt;
for timerKey, timerValue in ipairs(timers) do&lt;br /&gt;
	-- kill the timer&lt;br /&gt;
      killTimer ( timerValue )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Utility functions}}&lt;/div&gt;</summary>
		<author><name>NanoBob</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Scripting_Introduction&amp;diff=55312</id>
		<title>Scripting Introduction</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Scripting_Introduction&amp;diff=55312"/>
		<updated>2018-06-14T08:21:38Z</updated>

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