<?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=Backsage</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=Backsage"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Backsage"/>
	<updated>2026-04-22T13:54:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=52210</id>
		<title>Requested Functions and Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=52210"/>
		<updated>2017-09-05T20:16:36Z</updated>

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

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

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

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

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in ipairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in ipairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	 for column, value in pairs ( row ) do&lt;br /&gt;
	      outputChatBox(sid..&amp;quot;, &amp;quot;..rid..&amp;quot;, &amp;quot;..column..&amp;quot;, &amp;quot;..tostring(value)..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Only shows SELECT statements&lt;br /&gt;
	end&lt;br /&gt;
    end			&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	for column, value in pairs ( row ) do&lt;br /&gt;
	       &lt;br /&gt;
	end&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(sid..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Shows all statement ids, but only shows affected rows and last insert id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=51704</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=51704"/>
		<updated>2017-07-20T06:55:43Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in ipairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in ipairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	 for column, value in pairs ( row ) do&lt;br /&gt;
	      outputChatBox(sid..&amp;quot;, &amp;quot;..rid..&amp;quot;, &amp;quot;..column..&amp;quot;, &amp;quot;..tostring(value)..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Only shows SELECT statements&lt;br /&gt;
	end&lt;br /&gt;
    end			&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	for column, value in pairs ( row ) do&lt;br /&gt;
	       &lt;br /&gt;
	end&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(sid..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Shows all statement ids, but only shows affected rows and last insert id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=51703</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=51703"/>
		<updated>2017-07-20T06:55:00Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in ipairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	 for column, value in pairs ( row ) do&lt;br /&gt;
	      outputChatBox(sid..&amp;quot;, &amp;quot;..rid..&amp;quot;, &amp;quot;..column..&amp;quot;, &amp;quot;..tostring(value)..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Only shows SELECT statements&lt;br /&gt;
	end&lt;br /&gt;
    end			&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	for column, value in pairs ( row ) do&lt;br /&gt;
	       &lt;br /&gt;
	end&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(sid..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Shows all statement ids, but only shows affected rows and last insert id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50917</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50917"/>
		<updated>2017-05-11T04:39:10Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	 for column, value in pairs ( row ) do&lt;br /&gt;
	      outputChatBox(sid..&amp;quot;, &amp;quot;..rid..&amp;quot;, &amp;quot;..column..&amp;quot;, &amp;quot;..tostring(value)..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Only shows SELECT statements&lt;br /&gt;
	end&lt;br /&gt;
    end			&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	for column, value in pairs ( row ) do&lt;br /&gt;
	       &lt;br /&gt;
	end&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(sid..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Shows all statement ids, but only shows affected rows and last insert id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50912</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50912"/>
		<updated>2017-05-10T03:22:09Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	 for column, value in pairs ( row ) do&lt;br /&gt;
	       outputChatBox(sid..&amp;quot;, &amp;quot;..rid..&amp;quot;, &amp;quot;..column..&amp;quot;, &amp;quot;..tostring(value)..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Only shows SELECT statements&lt;br /&gt;
	end&lt;br /&gt;
    end			&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	for column, value in pairs ( row ) do&lt;br /&gt;
	       &lt;br /&gt;
	end&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(sid..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Shows all statement ids, but only shows affected rows and last insert id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50911</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50911"/>
		<updated>2017-05-10T03:21:14Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	 for column, value in pairs ( row ) do&lt;br /&gt;
	       outputChatBox(sid..&amp;quot;, &amp;quot;..rid..&amp;quot;, &amp;quot;..column..&amp;quot;, &amp;quot;..tostring(value)..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Only shows SELECT statements&lt;br /&gt;
	end&lt;br /&gt;
    end			&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (Name1) VALUES (&amp;quot;Hello&amp;quot;); SELECT * FROM Test1')&lt;br /&gt;
multiResults = dbPoll(queryhandle, -1)&lt;br /&gt;
&lt;br /&gt;
for sid, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
    local resultRows, num_affected_rows, last_insert_id =  unpack(statementResult) &lt;br /&gt;
    for rid, row in ipairs ( resultRows ) do &lt;br /&gt;
	 for column, value in pairs ( row ) do&lt;br /&gt;
	       &lt;br /&gt;
	end&lt;br /&gt;
    end&lt;br /&gt;
    outputChatBox(sid..&amp;quot;, &amp;quot;..num_affected_rows..&amp;quot;, &amp;quot;..last_insert_id) -- Shows all statement ids, but only shows affected rows and last insert id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50910</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50910"/>
		<updated>2017-05-10T03:05:39Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for rid, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50909</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50909"/>
		<updated>2017-05-10T01:11:33Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50908</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50908"/>
		<updated>2017-05-10T01:09:42Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Optional Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple queries&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query if it was a SELECT query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50907</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50907"/>
		<updated>2017-05-10T00:02:28Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple statements&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query if it was a SELECT query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'INSERT INTO Test1 (&amp;quot;Name1&amp;quot;, &amp;quot;Name2&amp;quot;) VALUES (&amp;quot;Hello&amp;quot;, &amp;quot;Hi&amp;quot;);')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Shows only rowid 1 affected because we only used INSERT INTO statement and not a SELECT statement.&lt;br /&gt;
&lt;br /&gt;
queryhandle = nil -- Making the query handle and result to nil&lt;br /&gt;
result = nil&lt;br /&gt;
&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1;')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
outputChatBox(toJSON(result)) -- Now shows rowid 2 affected.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50906</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50906"/>
		<updated>2017-05-09T23:40:00Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple statements&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query if it was a SELECT query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values (only when multipleResults is set to true):&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50902</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50902"/>
		<updated>2017-05-09T15:48:54Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple statements&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query if it was a SELECT query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multipleResults is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values:&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50901</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50901"/>
		<updated>2017-05-09T15:46:21Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple statements&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query if it was a SELECT query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]]. If multi_statements is set to true, it will first return a table pertaining to one query, followed by the results for that query and so on for the next queries.&lt;br /&gt;
** This also returns extra values:&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50899</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50899"/>
		<updated>2017-05-09T12:12:43Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple statements&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table with the result of the query if it was a SELECT query when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns extra values:&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50892</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50892"/>
		<updated>2017-05-07T22:31:57Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple statements&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns extra values:&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to print the results of the query:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (result) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
        outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another example of printing the results:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
connection = dbConnect(&amp;quot;sqlite&amp;quot;, &amp;quot;test.db&amp;quot;)&lt;br /&gt;
queryhandle = dbQuery( connection, 'SELECT * FROM Test1')&lt;br /&gt;
result = dbPoll(queryhandle, -1)&lt;br /&gt;
	&lt;br /&gt;
for _, row in pairs (fromJSON(toJSON(result))) do -- row represents the tables that are in 'result', which represent the rows&lt;br /&gt;
    for column, value in pairs (row) do -- column represents column name, value represents column value&lt;br /&gt;
	 outputChatBox(column..', '..value)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50891</id>
		<title>DbPoll</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DbPoll&amp;diff=50891"/>
		<updated>2017-05-07T22:07:21Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function checks the progress of a database query.&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 dbPoll ( handle queryHandle, int timeout[, bool multipleResults = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||queryHandle:poll}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]&lt;br /&gt;
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for an instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{New items|3.0160|1.5.2|&lt;br /&gt;
*'''multipleResults:''' Set to true to enable the return values from multiple statements&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
*''nil:'' Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call [[dbFree]])&lt;br /&gt;
*''false:'' Returns false if the query string contained an error, the connection has been lost or the query handle is incorrect. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns two extra values: (See the example on how the retrieve them)&lt;br /&gt;
***''int:'' error code&lt;br /&gt;
***''string'' error message&lt;br /&gt;
*''table:'' Returns a table when the query has successfully completed. This automatically frees the query handle, so you do not have to call [[dbFree]].&lt;br /&gt;
** This also returns extra values:&lt;br /&gt;
***''int:'' number of affected rows&lt;br /&gt;
***''int:'' last insert id&lt;br /&gt;
The table is of the format:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
{{Note|If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as &amp;quot;1&amp;quot; would be returned as 1.}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example waits until a result is ready:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows the possible return values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result == nil then&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll result not ready yet&amp;quot; )&lt;br /&gt;
elseif result == false then&lt;br /&gt;
    local error_code,error_msg = num_affected_rows,last_insert_id&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll failed. Error code: &amp;quot; .. tostring(error_code) .. &amp;quot;  Error message: &amp;quot; .. tostring(error_msg) )&lt;br /&gt;
else&lt;br /&gt;
    outputConsole( &amp;quot;dbPoll succeeded. Number of affected rows: &amp;quot; .. tostring(num_affected_rows) .. &amp;quot;  Last insert id: &amp;quot; .. tostring(last_insert_id) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how to handle the result if the query selected data:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = dbPoll ( qh, -1 )&lt;br /&gt;
&lt;br /&gt;
if result then&lt;br /&gt;
    for _, row in ipairs ( result ) do&lt;br /&gt;
&lt;br /&gt;
        -- by using a second loop (use it if you want to get the values of all columns the query selected):&lt;br /&gt;
        for column, value in pairs ( row ) do&lt;br /&gt;
            -- column = the mysql column of the table in the query&lt;br /&gt;
            -- value = the value of that column in this certain row&lt;br /&gt;
        end&lt;br /&gt;
		&lt;br /&gt;
        -- or without a second loop (use it if you want to handle every value in a special way):&lt;br /&gt;
        outputChatBox ( row[&amp;quot;column&amp;quot;] ) -- it will output the value of the column &amp;quot;column&amp;quot; in this certain row&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{New items|3.0153|1.5.2|&lt;br /&gt;
This example shows how to handle the result of a multiple statement query: (See [[dbConnect]] option '''multi_statements''')&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local multiResults = dbPoll ( qh, -1, true )&lt;br /&gt;
&lt;br /&gt;
if multiResults then&lt;br /&gt;
    for sidx, statementResult in ipairs ( multiResults ) do&lt;br /&gt;
        local resultRows, numAffectedRows, lastInsertId = unpack(statementResult)&lt;br /&gt;
        for ridx, row in ipairs ( resultRows ) do&lt;br /&gt;
            for column, value in pairs ( row ) do&lt;br /&gt;
                outputDebugString( &amp;quot;&amp;quot;&lt;br /&gt;
                        .. &amp;quot; statement#&amp;quot; .. sidx&lt;br /&gt;
                        .. &amp;quot; row#&amp;quot; .. ridx&lt;br /&gt;
                        .. &amp;quot; column:&amp;quot; .. tostring(column)&lt;br /&gt;
                        .. &amp;quot; value:&amp;quot; .. tostring(value)&lt;br /&gt;
                        )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|7972}}&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.1.1-9.03328|n/a}}&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.4-9.05862|Added 'last insert id' return value}}&lt;br /&gt;
{{ChangelogItem|1.5.2-9.07972|Added 'multipleResults' argument}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ExecuteSQLQuery&amp;diff=50878</id>
		<title>ExecuteSQLQuery</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ExecuteSQLQuery&amp;diff=50878"/>
		<updated>2017-05-07T21:18:56Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
&lt;br /&gt;
This function executes an arbitrary SQL query and returns the result rows if there are any. It allows parameter binding for security (SQL injection is rendered impossible).&lt;br /&gt;
&lt;br /&gt;
'''NOTE: This function only acts upon registry.db. Use dbQuery to query a custom SQL databse.'''&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 executeSQLQuery(string query [, var param1 [, var param2 ...]])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''query:''' An SQL query. Positions where parameter values will be inserted are marked with a &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''paramX:''' A variable number of parameters. These must be strings or numbers - it is important to make sure they are of the correct type. Also, the number of parameters passed must be equal to the number of &amp;quot;?&amp;quot; characters in the query string.&lt;br /&gt;
String parameters are automatically escaped by adding a backslash (\) before ' and \ characters.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table with the result of the query if it was a SELECT query, or ''false'' if otherwise. In case of a SELECT query the result table may be empty (if there are no result rows). The table is of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represents the next row.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Below are examples of equivalents for the deprecated executeSQL functions. Note that ` (backtick) can optionally be used to surround table and row names. It usually a good idea to do this to avoid name clashes with SQL reserved words.&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLCreateTable:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;CREATE TABLE IF NOT EXISTS players (clothes_head_texture TEXT, clothes_head_model TEXT, name TEXT)&amp;quot;)&lt;br /&gt;
executeSQLQuery(&amp;quot;CREATE TABLE IF NOT EXISTS `players` (`clothes_head_texture` TEXT, `clothes_head_model` TEXT, `name` TEXT)&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLDelete:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;DELETE FROM players WHERE name=?&amp;quot;, playerName)&lt;br /&gt;
executeSQLQuery(&amp;quot;DELETE FROM `players` WHERE `name`=?&amp;quot;, playerName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLDropTable:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;DROP TABLE players&amp;quot; )&lt;br /&gt;
executeSQLQuery(&amp;quot;DROP TABLE `players`&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLSelect:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;SELECT score,health FROM players WHERE name=?&amp;quot;, playerName )&lt;br /&gt;
executeSQLQuery(&amp;quot;SELECT `score`,`health` FROM `players` WHERE `name`=?&amp;quot;, playerName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLInsert:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;INSERT INTO players(name,color,sound) VALUES(?,?,?)&amp;quot;, playerName, colorName, soundName )&lt;br /&gt;
executeSQLQuery(&amp;quot;INSERT INTO `players`(`name`,`color`,`sound`) VALUES(?,?,?)&amp;quot;, playerName, colorName, soundName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLUpdate:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;UPDATE players SET color='green',sound='somehead' WHERE name=?&amp;quot;, playerName )&lt;br /&gt;
executeSQLQuery(&amp;quot;UPDATE players SET color=?,sound=? WHERE name=?&amp;quot;, colorName, soundName, playerName )&lt;br /&gt;
executeSQLQuery(&amp;quot;UPDATE `players` SET `color`=?,`sound`=? WHERE `name`=?&amp;quot;, colorName, soundName, playerName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example defines a console command that shows the ID's and names of all registered (stored in database) players that have more than the specified amount of money.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function listPlayersWithMoreMoneyThan(thePlayer, command, amount)&lt;br /&gt;
    local players = executeSQLQuery(&amp;quot;SELECT id, name FROM players WHERE money &amp;gt; ?&amp;quot;, tonumber(amount))&lt;br /&gt;
    outputConsole(&amp;quot;Players with more money than &amp;quot; .. amount .. &amp;quot;:&amp;quot;, thePlayer)&lt;br /&gt;
    for i, playerdata in ipairs(players) do&lt;br /&gt;
        outputConsole(playerdata.id .. &amp;quot;: &amp;quot; .. playerdata.name, thePlayer)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;richplayers&amp;quot;, listPlayersWithMoreMoneyThan)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example shows the amount of money a certain registered player has.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showPlayerMoney(thePlayer, command, playerName)&lt;br /&gt;
    local result = executeSQLQuery(&amp;quot;SELECT money FROM players WHERE name=?&amp;quot;, playerName)&lt;br /&gt;
    if(#result == 0) then&lt;br /&gt;
        outputConsole(&amp;quot;No player named &amp;quot; .. playerName .. &amp;quot; is registered.&amp;quot;, thePlayer)&lt;br /&gt;
    else&lt;br /&gt;
        outputConsole(&amp;quot;Money amount of player &amp;quot; .. playerName .. &amp;quot; is &amp;quot; .. result[1].money, thePlayer)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;playermoney&amp;quot;, showPlayerMoney)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the lack of single quotes around the &amp;quot;?&amp;quot; in this example, even though it represents a string. executeSQLQuery will see that the playerName variable is a string and take care of the correct execution of the query by itself.&lt;br /&gt;
&lt;br /&gt;
The advantage of using executeSQLQuery is that it is immune to users trying to exploit the query with an SQL injection attack. playerName may contain special characters like ', &amp;quot; or -- that will not influence the query, unlike the older approach where playerName would be concatenated into the query string.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ExecuteSQLQuery&amp;diff=50877</id>
		<title>ExecuteSQLQuery</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ExecuteSQLQuery&amp;diff=50877"/>
		<updated>2017-05-07T21:18:26Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Returns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
&lt;br /&gt;
This function executes an arbitrary SQL query and returns the result rows if there are any. It allows parameter binding for security (SQL injection is rendered impossible).&lt;br /&gt;
&lt;br /&gt;
'''NOTE: This function only acts upon registry.db. Use dbQuery to query a custom SQL databse.'''&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 executeSQLQuery(string query [, var param1 [, var param2 ...]])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''query:''' An SQL query. Positions where parameter values will be inserted are marked with a &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''paramX:''' A variable number of parameters. These must be strings or numbers - it is important to make sure they are of the correct type. Also, the number of parameters passed must be equal to the number of &amp;quot;?&amp;quot; characters in the query string.&lt;br /&gt;
String parameters are automatically escaped by adding a backslash (\) before ' and \ characters.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table with the result of the query if it was a SELECT query, or ''false'' if otherwise. In case of a SELECT query the result table may be empty (if there are no result rows). The table is of the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    { colname1=value1, colname2=value2, ... },&lt;br /&gt;
    { colname1=value3, colname2=value4, ... },&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
A subsequent table represent the next row.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Below are examples of equivalents for the deprecated executeSQL functions. Note that ` (backtick) can optionally be used to surround table and row names. It usually a good idea to do this to avoid name clashes with SQL reserved words.&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLCreateTable:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;CREATE TABLE IF NOT EXISTS players (clothes_head_texture TEXT, clothes_head_model TEXT, name TEXT)&amp;quot;)&lt;br /&gt;
executeSQLQuery(&amp;quot;CREATE TABLE IF NOT EXISTS `players` (`clothes_head_texture` TEXT, `clothes_head_model` TEXT, `name` TEXT)&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLDelete:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;DELETE FROM players WHERE name=?&amp;quot;, playerName)&lt;br /&gt;
executeSQLQuery(&amp;quot;DELETE FROM `players` WHERE `name`=?&amp;quot;, playerName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLDropTable:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;DROP TABLE players&amp;quot; )&lt;br /&gt;
executeSQLQuery(&amp;quot;DROP TABLE `players`&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLSelect:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;SELECT score,health FROM players WHERE name=?&amp;quot;, playerName )&lt;br /&gt;
executeSQLQuery(&amp;quot;SELECT `score`,`health` FROM `players` WHERE `name`=?&amp;quot;, playerName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLInsert:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;INSERT INTO players(name,color,sound) VALUES(?,?,?)&amp;quot;, playerName, colorName, soundName )&lt;br /&gt;
executeSQLQuery(&amp;quot;INSERT INTO `players`(`name`,`color`,`sound`) VALUES(?,?,?)&amp;quot;, playerName, colorName, soundName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example equivalents for executeSQLUpdate:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
executeSQLQuery(&amp;quot;UPDATE players SET color='green',sound='somehead' WHERE name=?&amp;quot;, playerName )&lt;br /&gt;
executeSQLQuery(&amp;quot;UPDATE players SET color=?,sound=? WHERE name=?&amp;quot;, colorName, soundName, playerName )&lt;br /&gt;
executeSQLQuery(&amp;quot;UPDATE `players` SET `color`=?,`sound`=? WHERE `name`=?&amp;quot;, colorName, soundName, playerName )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example defines a console command that shows the ID's and names of all registered (stored in database) players that have more than the specified amount of money.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function listPlayersWithMoreMoneyThan(thePlayer, command, amount)&lt;br /&gt;
    local players = executeSQLQuery(&amp;quot;SELECT id, name FROM players WHERE money &amp;gt; ?&amp;quot;, tonumber(amount))&lt;br /&gt;
    outputConsole(&amp;quot;Players with more money than &amp;quot; .. amount .. &amp;quot;:&amp;quot;, thePlayer)&lt;br /&gt;
    for i, playerdata in ipairs(players) do&lt;br /&gt;
        outputConsole(playerdata.id .. &amp;quot;: &amp;quot; .. playerdata.name, thePlayer)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;richplayers&amp;quot;, listPlayersWithMoreMoneyThan)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example shows the amount of money a certain registered player has.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showPlayerMoney(thePlayer, command, playerName)&lt;br /&gt;
    local result = executeSQLQuery(&amp;quot;SELECT money FROM players WHERE name=?&amp;quot;, playerName)&lt;br /&gt;
    if(#result == 0) then&lt;br /&gt;
        outputConsole(&amp;quot;No player named &amp;quot; .. playerName .. &amp;quot; is registered.&amp;quot;, thePlayer)&lt;br /&gt;
    else&lt;br /&gt;
        outputConsole(&amp;quot;Money amount of player &amp;quot; .. playerName .. &amp;quot; is &amp;quot; .. result[1].money, thePlayer)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;playermoney&amp;quot;, showPlayerMoney)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the lack of single quotes around the &amp;quot;?&amp;quot; in this example, even though it represents a string. executeSQLQuery will see that the playerName variable is a string and take care of the correct execution of the query by itself.&lt;br /&gt;
&lt;br /&gt;
The advantage of using executeSQLQuery is that it is immune to users trying to exploit the query with an SQL injection attack. playerName may contain special characters like ', &amp;quot; or -- that will not influence the query, unlike the older approach where playerName would be concatenated into the query string.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49896</id>
		<title>Meta.xml</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49896"/>
		<updated>2016-12-03T10:57:31Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ''meta.xml'' file presents MTA with a set of metadata, such as the resource's name, the scripts to include, and which files to precache for sending to clients among other things. It is also the scope of &amp;quot;elements&amp;quot;. It is written in XML, which is based on HTML and is the parent of XHTML.&lt;br /&gt;
&lt;br /&gt;
=Tags=&lt;br /&gt;
XML is a textual data format which is widely used for the representation of data. MTA uses an XML-based language to describe the metadata for resources by using the tags below:&lt;br /&gt;
&lt;br /&gt;
*'''&amp;lt;info /&amp;gt;''' Information about this resource, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):&lt;br /&gt;
** '''author:''' The author of this resource&lt;br /&gt;
** '''version:''' The version of this resource&lt;br /&gt;
** '''name:''' The name of this resource&lt;br /&gt;
** '''description:''' A brief description of this resource&lt;br /&gt;
** '''type:''' The type of this resource, that can be &amp;quot;gamemode&amp;quot;, &amp;quot;script&amp;quot;, &amp;quot;map&amp;quot; or &amp;quot;misc&amp;quot;.&lt;br /&gt;
** '''gamemodes:''' The gamemodes to be compatible with the resource. It must be the name of the gamemode resource, not the gamemode name. If you want it to be compatible with multiple gamemodes, it must be in a comma-separated list without spaces. (e.g. gamemodes=&amp;quot;test1,test2&amp;quot;). &lt;br /&gt;
*'''&amp;lt;script /&amp;gt;''' Source code for this resource, possible parameters are:&lt;br /&gt;
** '''src:''' The file name of the source code&lt;br /&gt;
** '''type:''' The type of source code: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; or &amp;quot;shared&amp;quot;.&lt;br /&gt;
**'''cache:''' When the script file type is &amp;quot;client&amp;quot;, this setting controls whether the file is saved on the clients' hard drive. Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean the file is not saved. ''(Note: cache=false files are started at the client first, so lua file load order might differ when mixing cache settings)''&lt;br /&gt;
**'''validate:''' If set to &amp;quot;false&amp;quot;, compatibility checks are skipped.&lt;br /&gt;
*'''&amp;lt;map /&amp;gt;''' The map for a gamemode, possible parameters are:&lt;br /&gt;
**'''src:''' .map file name (can be path too eg. &amp;quot;maps/filename.map&amp;quot;)&lt;br /&gt;
**'''dimension:''' Dimension in which the map will be loaded (optional)&lt;br /&gt;
*'''&amp;lt;file /&amp;gt;''' A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join)&lt;br /&gt;
**'''src:''' client-side file name (can be path too eg. &amp;quot;images/image.png&amp;quot;)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
**'''download:''' Whether or not to be sent to the client automatically (optional). Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean they are not sent on resource start but could later be used by [[downloadFile]] (from version 1.4)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
*'''&amp;lt;include /&amp;gt;''' Include resources that this resource will use&lt;br /&gt;
**'''resource:''' Resource name that you want to start with this resource&lt;br /&gt;
**'''minversion:''' Minimum version that '''resource''' needs to be (optional)&lt;br /&gt;
**'''maxversion:''' Maximum version that '''resource''' needs to be (optional)&lt;br /&gt;
*'''&amp;lt;config /&amp;gt;''' Config file (.xml) can be accessed by resource, possible parameters are:&lt;br /&gt;
**'''src:''' The file name of the config file&lt;br /&gt;
**'''type:''' The type of the config file: &amp;quot;client&amp;quot; or &amp;quot;server&amp;quot;&lt;br /&gt;
*'''&amp;lt;export /&amp;gt;''' This exports functions from this resource, so other resources can use them with [[call]]&lt;br /&gt;
**'''function:''' The function name&lt;br /&gt;
**'''type''' Whether function is exported server-side or client-side (valid values are: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; and &amp;quot;shared&amp;quot;)&lt;br /&gt;
**'''http:''' Can the function be called via HTTP (true/false)&lt;br /&gt;
*'''&amp;lt;html /&amp;gt;'''&lt;br /&gt;
**'''src:''' The filename for the HTTP file (can be a path)&lt;br /&gt;
**'''default:''' The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)&lt;br /&gt;
**'''raw:''' The html file is not parsed by the Lua interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)&lt;br /&gt;
*'''&amp;lt;settings&amp;gt; &amp;lt;setting name=&amp;quot;&amp;quot; value=&amp;quot;&amp;quot;/&amp;gt; &amp;lt;/settings&amp;gt;:''' Most gamemodes use [[settings system]] to let server admins to configure it how they like. For instance you could set round time and then use [[get]] and [[set]] to get the value or change it, respectively.&lt;br /&gt;
*'''&amp;lt;min_mta_version /&amp;gt;''' Minimum version requirements for this resource to run correctly. When authoring resources, the minimum version should usually be set to the current released version of MTA:SA (which at the moment is &amp;quot;{{Current Version|full}}&amp;quot;). See example for example.&lt;br /&gt;
**'''client:''' The minimum client version&lt;br /&gt;
**'''server:''' The minimum server version&lt;br /&gt;
*'''&amp;lt;aclrequest /&amp;gt;''' A list of [[Access_Control_List|ACL]] rights this resource will need.&lt;br /&gt;
{{New items|3.0132|1.3.1 r4141|&lt;br /&gt;
*'''&amp;lt;sync_map_element_data /&amp;gt;''' Controls whether map [[Element_data|element data]] such as &amp;quot;PosX&amp;quot; and &amp;quot;DoubleSided&amp;quot; are transferred to the client. This data is usually not required by most gamemodes or resources. (Map Editor and Interiors require this to be not set to false to work). When set in a gamemode meta.xml, the setting will apply to all maps loaded by that resource.&lt;br /&gt;
**'''false:''' Disable transfer of map element data for all resources. This can reduce map download times considerably.&lt;br /&gt;
**'''true:''' Enable transfer of map element data for all resources. (If '''false''' and '''true''' are set in different resources, true will have priority and all resources will transfer map element data)&lt;br /&gt;
}}&lt;br /&gt;
{{New items|3.0140|1.4.0 r5313|&lt;br /&gt;
*'''&amp;lt;oop/&amp;gt;''' OOP - Please refer to [[OOP]] for documentation.&lt;br /&gt;
**'''false:''' Disable OOP.&lt;br /&gt;
**'''true:''' Enable OOP.&lt;br /&gt;
}}&lt;br /&gt;
{{New feature/item|3.0150|1.5.0|7308|&lt;br /&gt;
*'''&amp;lt;download_priority_group/&amp;gt;''' If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Heres an example of a meta file using some of the tags mentioned:&lt;br /&gt;
{{#tag:syntaxhighlight |&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info author=&amp;quot;Slothman&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Stealth&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;config src=&amp;quot;help.xml&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;download_priority_group&amp;gt;0&amp;lt;/download_priority_group&amp;gt;&lt;br /&gt;
    &amp;lt;min_mta_version client=&amp;quot;{{Current Version|full}}&amp;quot; server=&amp;quot;{{Current Version|full}}&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;sync_map_element_data&amp;gt;false&amp;lt;/sync_map_element_data&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noiseblip.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;mission_timer.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_client.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_client.lua&amp;quot; type=&amp;quot;client&amp;quot; validate=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noisebar.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;spycam.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;riemann_z_demonstration.lua&amp;quot; type=&amp;quot;client&amp;quot; cache=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;map src=&amp;quot;base.map&amp;quot; dimension=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.txd&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.dff&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.col&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;armor.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;camera.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;cloak.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;goggles.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;mine.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;radar.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;shield.png&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;scoreboard&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;killmessages&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;maplimits&amp;quot; /&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport1&amp;quot; type=&amp;quot;server&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport2&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport3&amp;quot; type=&amp;quot;shared&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;settings&amp;gt;&lt;br /&gt;
         &amp;lt;setting name=&amp;quot;roundlimit&amp;quot; value=&amp;quot;[6]&amp;quot; /&amp;gt; &amp;lt;!-- round length in minutes --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teamdamage&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!-- 0 for team protection off, 1 for team protection on --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teambalance&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!--  difference limit of amount of players between teams --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;spazammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt; &amp;lt;!-- ammo amounts --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;m4ammo&amp;quot; value=&amp;quot;[100]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;shotgunammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;sniperammo&amp;quot; value=&amp;quot;[20]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;ak47ammo&amp;quot; value=&amp;quot;[120]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;rifleammo&amp;quot; value=&amp;quot;[40]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;deserteagleammo&amp;quot; value=&amp;quot;[45]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;pistolammo&amp;quot; value=&amp;quot;[132]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;uziammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;tec9ammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;silencedammo&amp;quot; value=&amp;quot;[65]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;grenadeammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;satchelammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teargasammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;molatovammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;isAllowedToShoot&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/settings&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     &amp;lt;aclrequest&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.startResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.stopResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.setPlayerMuted&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/aclrequest&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
|lang=&amp;quot;xml&amp;quot;}}&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[cs:Meta.xml]]&lt;br /&gt;
[[de:Meta.xml]]&lt;br /&gt;
[[es:Sobre el archivo &amp;quot;meta.xml&amp;quot;]]&lt;br /&gt;
[[it:Meta.xml]]&lt;br /&gt;
[[pl:Meta.xml]]&lt;br /&gt;
[[ru:Meta.xml]]&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49894</id>
		<title>Meta.xml</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49894"/>
		<updated>2016-12-02T09:32:18Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ''meta.xml'' file presents MTA with a set of metadata, such as the resource's name, the scripts to include, and which files to precache for sending to clients among other things. It is also the scope of &amp;quot;elements&amp;quot;. It is written in XML, which is based on HTML and is the parent of XHTML.&lt;br /&gt;
&lt;br /&gt;
=Tags=&lt;br /&gt;
XML is a textual data format which is widely used for the representation of data. MTA uses an XML-based language to describe the metadata for resources by using the tags below:&lt;br /&gt;
&lt;br /&gt;
*'''&amp;lt;info /&amp;gt;''' Information about this resource, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):&lt;br /&gt;
** '''author:''' The author of this resource&lt;br /&gt;
** '''version:''' The version of this resource&lt;br /&gt;
** '''name:''' The name of this resource&lt;br /&gt;
** '''description:''' A brief description of this resource&lt;br /&gt;
** '''type:''' The type of this resource, that can be &amp;quot;gamemode&amp;quot;, &amp;quot;script&amp;quot;, &amp;quot;map&amp;quot; or &amp;quot;misc&amp;quot;.&lt;br /&gt;
** '''gamemodes:''' The gamemodes to be compatible with the map (can only be used if type is set to &amp;quot;map&amp;quot;). It must be the name of the gamemode resource, not the gamemode name. If you want it to be compatible with multiple gamemodes, it must be in a comma-separated list without spaces. (e.g. gamemodes=&amp;quot;test1,test2&amp;quot;). &lt;br /&gt;
*'''&amp;lt;script /&amp;gt;''' Source code for this resource, possible parameters are:&lt;br /&gt;
** '''src:''' The file name of the source code&lt;br /&gt;
** '''type:''' The type of source code: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; or &amp;quot;shared&amp;quot;.&lt;br /&gt;
**'''cache:''' When the script file type is &amp;quot;client&amp;quot;, this setting controls whether the file is saved on the clients' hard drive. Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean the file is not saved. ''(Note: cache=false files are started at the client first, so lua file load order might differ when mixing cache settings)''&lt;br /&gt;
**'''validate:''' If set to &amp;quot;false&amp;quot;, compatibility checks are skipped.&lt;br /&gt;
*'''&amp;lt;map /&amp;gt;''' The map for a gamemode, possible parameters are:&lt;br /&gt;
**'''src:''' .map file name (can be path too eg. &amp;quot;maps/filename.map&amp;quot;)&lt;br /&gt;
**'''dimension:''' Dimension in which the map will be loaded (optional)&lt;br /&gt;
*'''&amp;lt;file /&amp;gt;''' A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join)&lt;br /&gt;
**'''src:''' client-side file name (can be path too eg. &amp;quot;images/image.png&amp;quot;)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
**'''download:''' Whether or not to be sent to the client automatically (optional). Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean they are not sent on resource start but could later be used by [[downloadFile]] (from version 1.4)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
*'''&amp;lt;include /&amp;gt;''' Include resources that this resource will use&lt;br /&gt;
**'''resource:''' Resource name that you want to start with this resource&lt;br /&gt;
**'''minversion:''' Minimum version that '''resource''' needs to be (optional)&lt;br /&gt;
**'''maxversion:''' Maximum version that '''resource''' needs to be (optional)&lt;br /&gt;
*'''&amp;lt;config /&amp;gt;''' Config file (.xml) can be accessed by resource, possible parameters are:&lt;br /&gt;
**'''src:''' The file name of the config file&lt;br /&gt;
**'''type:''' The type of the config file: &amp;quot;client&amp;quot; or &amp;quot;server&amp;quot;&lt;br /&gt;
*'''&amp;lt;export /&amp;gt;''' This exports functions from this resource, so other resources can use them with [[call]]&lt;br /&gt;
**'''function:''' The function name&lt;br /&gt;
**'''type''' Whether function is exported server-side or client-side (valid values are: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; and &amp;quot;shared&amp;quot;)&lt;br /&gt;
**'''http:''' Can the function be called via HTTP (true/false)&lt;br /&gt;
*'''&amp;lt;html /&amp;gt;'''&lt;br /&gt;
**'''src:''' The filename for the HTTP file (can be a path)&lt;br /&gt;
**'''default:''' The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)&lt;br /&gt;
**'''raw:''' The html file is not parsed by the Lua interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)&lt;br /&gt;
*'''&amp;lt;settings&amp;gt; &amp;lt;setting name=&amp;quot;&amp;quot; value=&amp;quot;&amp;quot;/&amp;gt; &amp;lt;/settings&amp;gt;:''' Most gamemodes use [[settings system]] to let server admins to configure it how they like. For instance you could set round time and then use [[get]] and [[set]] to get the value or change it, respectively.&lt;br /&gt;
*'''&amp;lt;min_mta_version /&amp;gt;''' Minimum version requirements for this resource to run correctly. When authoring resources, the minimum version should usually be set to the current released version of MTA:SA (which at the moment is &amp;quot;{{Current Version|full}}&amp;quot;). See example for example.&lt;br /&gt;
**'''client:''' The minimum client version&lt;br /&gt;
**'''server:''' The minimum server version&lt;br /&gt;
*'''&amp;lt;aclrequest /&amp;gt;''' A list of [[Access_Control_List|ACL]] rights this resource will need.&lt;br /&gt;
{{New items|3.0132|1.3.1 r4141|&lt;br /&gt;
*'''&amp;lt;sync_map_element_data /&amp;gt;''' Controls whether map [[Element_data|element data]] such as &amp;quot;PosX&amp;quot; and &amp;quot;DoubleSided&amp;quot; are transferred to the client. This data is usually not required by most gamemodes or resources. (Map Editor and Interiors require this to be not set to false to work). When set in a gamemode meta.xml, the setting will apply to all maps loaded by that resource.&lt;br /&gt;
**'''false:''' Disable transfer of map element data for all resources. This can reduce map download times considerably.&lt;br /&gt;
**'''true:''' Enable transfer of map element data for all resources. (If '''false''' and '''true''' are set in different resources, true will have priority and all resources will transfer map element data)&lt;br /&gt;
}}&lt;br /&gt;
{{New items|3.0140|1.4.0 r5313|&lt;br /&gt;
*'''&amp;lt;oop/&amp;gt;''' OOP - Please refer to [[OOP]] for documentation.&lt;br /&gt;
**'''false:''' Disable OOP.&lt;br /&gt;
**'''true:''' Enable OOP.&lt;br /&gt;
}}&lt;br /&gt;
{{New feature/item|3.0150|1.5.0|7308|&lt;br /&gt;
*'''&amp;lt;download_priority_group/&amp;gt;''' If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Heres an example of a meta file using some of the tags mentioned:&lt;br /&gt;
{{#tag:syntaxhighlight |&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info author=&amp;quot;Slothman&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Stealth&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;config src=&amp;quot;help.xml&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;download_priority_group&amp;gt;0&amp;lt;/download_priority_group&amp;gt;&lt;br /&gt;
    &amp;lt;min_mta_version client=&amp;quot;{{Current Version|full}}&amp;quot; server=&amp;quot;{{Current Version|full}}&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;sync_map_element_data&amp;gt;false&amp;lt;/sync_map_element_data&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noiseblip.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;mission_timer.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_client.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_client.lua&amp;quot; type=&amp;quot;client&amp;quot; validate=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noisebar.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;spycam.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;riemann_z_demonstration.lua&amp;quot; type=&amp;quot;client&amp;quot; cache=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;map src=&amp;quot;base.map&amp;quot; dimension=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.txd&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.dff&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.col&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;armor.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;camera.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;cloak.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;goggles.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;mine.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;radar.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;shield.png&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;scoreboard&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;killmessages&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;maplimits&amp;quot; /&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport1&amp;quot; type=&amp;quot;server&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport2&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport3&amp;quot; type=&amp;quot;shared&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;settings&amp;gt;&lt;br /&gt;
         &amp;lt;setting name=&amp;quot;roundlimit&amp;quot; value=&amp;quot;[6]&amp;quot; /&amp;gt; &amp;lt;!-- round length in minutes --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teamdamage&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!-- 0 for team protection off, 1 for team protection on --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teambalance&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!--  difference limit of amount of players between teams --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;spazammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt; &amp;lt;!-- ammo amounts --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;m4ammo&amp;quot; value=&amp;quot;[100]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;shotgunammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;sniperammo&amp;quot; value=&amp;quot;[20]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;ak47ammo&amp;quot; value=&amp;quot;[120]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;rifleammo&amp;quot; value=&amp;quot;[40]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;deserteagleammo&amp;quot; value=&amp;quot;[45]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;pistolammo&amp;quot; value=&amp;quot;[132]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;uziammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;tec9ammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;silencedammo&amp;quot; value=&amp;quot;[65]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;grenadeammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;satchelammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teargasammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;molatovammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;isAllowedToShoot&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/settings&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     &amp;lt;aclrequest&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.startResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.stopResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.setPlayerMuted&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/aclrequest&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
|lang=&amp;quot;xml&amp;quot;}}&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[cs:Meta.xml]]&lt;br /&gt;
[[de:Meta.xml]]&lt;br /&gt;
[[es:Sobre el archivo &amp;quot;meta.xml&amp;quot;]]&lt;br /&gt;
[[it:Meta.xml]]&lt;br /&gt;
[[pl:Meta.xml]]&lt;br /&gt;
[[ru:Meta.xml]]&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49893</id>
		<title>Meta.xml</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49893"/>
		<updated>2016-12-02T08:18:06Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ''meta.xml'' file presents MTA with a set of metadata, such as the resource's name, the scripts to include, and which files to precache for sending to clients among other things. It is also the scope of &amp;quot;elements&amp;quot;. It is written in XML, which is based on HTML and is the parent of XHTML.&lt;br /&gt;
&lt;br /&gt;
=Tags=&lt;br /&gt;
XML is a textual data format which is widely used for the representation of data. MTA uses an XML-based language to describe the metadata for resources by using the tags below:&lt;br /&gt;
&lt;br /&gt;
*'''&amp;lt;info /&amp;gt;''' Information about this resource, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):&lt;br /&gt;
** '''author:''' The author of this resource&lt;br /&gt;
** '''version:''' The version of this resource&lt;br /&gt;
** '''name:''' The name of this resource&lt;br /&gt;
** '''description:''' A brief description of this resource&lt;br /&gt;
** '''type:''' The type of this resource, that can be &amp;quot;gamemode&amp;quot;, &amp;quot;script&amp;quot;, &amp;quot;map&amp;quot; or &amp;quot;misc&amp;quot;.&lt;br /&gt;
** '''gamemodes:''' The gamemodes to be associated with the map (can only be used if type is set to &amp;quot;map&amp;quot;). It must be the name of the gamemode resource, not the gamemode name. If you want it to be associated with multiple gamemodes, it must be comma separated (e.g. gamemodes=&amp;quot;test1,test2&amp;quot;). &lt;br /&gt;
*'''&amp;lt;script /&amp;gt;''' Source code for this resource, possible parameters are:&lt;br /&gt;
** '''src:''' The file name of the source code&lt;br /&gt;
** '''type:''' The type of source code: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; or &amp;quot;shared&amp;quot;.&lt;br /&gt;
**'''cache:''' When the script file type is &amp;quot;client&amp;quot;, this setting controls whether the file is saved on the clients' hard drive. Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean the file is not saved. ''(Note: cache=false files are started at the client first, so lua file load order might differ when mixing cache settings)''&lt;br /&gt;
**'''validate:''' If set to &amp;quot;false&amp;quot;, compatibility checks are skipped.&lt;br /&gt;
*'''&amp;lt;map /&amp;gt;''' The map for a gamemode, possible parameters are:&lt;br /&gt;
**'''src:''' .map file name (can be path too eg. &amp;quot;maps/filename.map&amp;quot;)&lt;br /&gt;
**'''dimension:''' Dimension in which the map will be loaded (optional)&lt;br /&gt;
*'''&amp;lt;file /&amp;gt;''' A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join)&lt;br /&gt;
**'''src:''' client-side file name (can be path too eg. &amp;quot;images/image.png&amp;quot;)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
**'''download:''' Whether or not to be sent to the client automatically (optional). Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean they are not sent on resource start but could later be used by [[downloadFile]] (from version 1.4)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
*'''&amp;lt;include /&amp;gt;''' Include resources that this resource will use&lt;br /&gt;
**'''resource:''' Resource name that you want to start with this resource&lt;br /&gt;
**'''minversion:''' Minimum version that '''resource''' needs to be (optional)&lt;br /&gt;
**'''maxversion:''' Maximum version that '''resource''' needs to be (optional)&lt;br /&gt;
*'''&amp;lt;config /&amp;gt;''' Config file (.xml) can be accessed by resource, possible parameters are:&lt;br /&gt;
**'''src:''' The file name of the config file&lt;br /&gt;
**'''type:''' The type of the config file: &amp;quot;client&amp;quot; or &amp;quot;server&amp;quot;&lt;br /&gt;
*'''&amp;lt;export /&amp;gt;''' This exports functions from this resource, so other resources can use them with [[call]]&lt;br /&gt;
**'''function:''' The function name&lt;br /&gt;
**'''type''' Whether function is exported server-side or client-side (valid values are: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; and &amp;quot;shared&amp;quot;)&lt;br /&gt;
**'''http:''' Can the function be called via HTTP (true/false)&lt;br /&gt;
*'''&amp;lt;html /&amp;gt;'''&lt;br /&gt;
**'''src:''' The filename for the HTTP file (can be a path)&lt;br /&gt;
**'''default:''' The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)&lt;br /&gt;
**'''raw:''' The html file is not parsed by the Lua interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)&lt;br /&gt;
*'''&amp;lt;settings&amp;gt; &amp;lt;setting name=&amp;quot;&amp;quot; value=&amp;quot;&amp;quot;/&amp;gt; &amp;lt;/settings&amp;gt;:''' Most gamemodes use [[settings system]] to let server admins to configure it how they like. For instance you could set round time and then use [[get]] and [[set]] to get the value or change it, respectively.&lt;br /&gt;
*'''&amp;lt;min_mta_version /&amp;gt;''' Minimum version requirements for this resource to run correctly. When authoring resources, the minimum version should usually be set to the current released version of MTA:SA (which at the moment is &amp;quot;{{Current Version|full}}&amp;quot;). See example for example.&lt;br /&gt;
**'''client:''' The minimum client version&lt;br /&gt;
**'''server:''' The minimum server version&lt;br /&gt;
*'''&amp;lt;aclrequest /&amp;gt;''' A list of [[Access_Control_List|ACL]] rights this resource will need.&lt;br /&gt;
{{New items|3.0132|1.3.1 r4141|&lt;br /&gt;
*'''&amp;lt;sync_map_element_data /&amp;gt;''' Controls whether map [[Element_data|element data]] such as &amp;quot;PosX&amp;quot; and &amp;quot;DoubleSided&amp;quot; are transferred to the client. This data is usually not required by most gamemodes or resources. (Map Editor and Interiors require this to be not set to false to work). When set in a gamemode meta.xml, the setting will apply to all maps loaded by that resource.&lt;br /&gt;
**'''false:''' Disable transfer of map element data for all resources. This can reduce map download times considerably.&lt;br /&gt;
**'''true:''' Enable transfer of map element data for all resources. (If '''false''' and '''true''' are set in different resources, true will have priority and all resources will transfer map element data)&lt;br /&gt;
}}&lt;br /&gt;
{{New items|3.0140|1.4.0 r5313|&lt;br /&gt;
*'''&amp;lt;oop/&amp;gt;''' OOP - Please refer to [[OOP]] for documentation.&lt;br /&gt;
**'''false:''' Disable OOP.&lt;br /&gt;
**'''true:''' Enable OOP.&lt;br /&gt;
}}&lt;br /&gt;
{{New feature/item|3.0150|1.5.0|7308|&lt;br /&gt;
*'''&amp;lt;download_priority_group/&amp;gt;''' If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Heres an example of a meta file using some of the tags mentioned:&lt;br /&gt;
{{#tag:syntaxhighlight |&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info author=&amp;quot;Slothman&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Stealth&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;config src=&amp;quot;help.xml&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;download_priority_group&amp;gt;0&amp;lt;/download_priority_group&amp;gt;&lt;br /&gt;
    &amp;lt;min_mta_version client=&amp;quot;{{Current Version|full}}&amp;quot; server=&amp;quot;{{Current Version|full}}&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;sync_map_element_data&amp;gt;false&amp;lt;/sync_map_element_data&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noiseblip.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;mission_timer.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_client.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_client.lua&amp;quot; type=&amp;quot;client&amp;quot; validate=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noisebar.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;spycam.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;riemann_z_demonstration.lua&amp;quot; type=&amp;quot;client&amp;quot; cache=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;map src=&amp;quot;base.map&amp;quot; dimension=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.txd&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.dff&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.col&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;armor.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;camera.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;cloak.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;goggles.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;mine.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;radar.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;shield.png&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;scoreboard&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;killmessages&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;maplimits&amp;quot; /&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport1&amp;quot; type=&amp;quot;server&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport2&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport3&amp;quot; type=&amp;quot;shared&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;settings&amp;gt;&lt;br /&gt;
         &amp;lt;setting name=&amp;quot;roundlimit&amp;quot; value=&amp;quot;[6]&amp;quot; /&amp;gt; &amp;lt;!-- round length in minutes --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teamdamage&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!-- 0 for team protection off, 1 for team protection on --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teambalance&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!--  difference limit of amount of players between teams --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;spazammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt; &amp;lt;!-- ammo amounts --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;m4ammo&amp;quot; value=&amp;quot;[100]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;shotgunammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;sniperammo&amp;quot; value=&amp;quot;[20]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;ak47ammo&amp;quot; value=&amp;quot;[120]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;rifleammo&amp;quot; value=&amp;quot;[40]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;deserteagleammo&amp;quot; value=&amp;quot;[45]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;pistolammo&amp;quot; value=&amp;quot;[132]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;uziammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;tec9ammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;silencedammo&amp;quot; value=&amp;quot;[65]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;grenadeammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;satchelammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teargasammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;molatovammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;isAllowedToShoot&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/settings&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     &amp;lt;aclrequest&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.startResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.stopResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.setPlayerMuted&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/aclrequest&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
|lang=&amp;quot;xml&amp;quot;}}&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[cs:Meta.xml]]&lt;br /&gt;
[[de:Meta.xml]]&lt;br /&gt;
[[es:Sobre el archivo &amp;quot;meta.xml&amp;quot;]]&lt;br /&gt;
[[it:Meta.xml]]&lt;br /&gt;
[[pl:Meta.xml]]&lt;br /&gt;
[[ru:Meta.xml]]&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49892</id>
		<title>Meta.xml</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Meta.xml&amp;diff=49892"/>
		<updated>2016-12-02T08:16:39Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ''meta.xml'' file presents MTA with a set of metadata, such as the resource's name, the scripts to include, and which files to precache for sending to clients among other things. It is also the scope of &amp;quot;elements&amp;quot;. It is written in XML, which is based on HTML and is the parent of XHTML.&lt;br /&gt;
&lt;br /&gt;
=Tags=&lt;br /&gt;
XML is a textual data format which is widely used for the representation of data. MTA uses an XML-based language to describe the metadata for resources by using the tags below:&lt;br /&gt;
&lt;br /&gt;
*'''&amp;lt;info /&amp;gt;''' Information about this resource, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):&lt;br /&gt;
** '''author:''' The author of this resource&lt;br /&gt;
** '''version:''' The version of this resource&lt;br /&gt;
** '''name:''' The name of this resource&lt;br /&gt;
** '''description:''' A brief description of this resource&lt;br /&gt;
** '''type:''' The type of this resource, that can be &amp;quot;gamemode&amp;quot;, &amp;quot;script&amp;quot;, &amp;quot;map&amp;quot; or &amp;quot;misc&amp;quot;.&lt;br /&gt;
** '''gamemodes:''' The gamemodes to be associated with the map (can only be used if type is set to &amp;quot;map&amp;quot;). If you want it to be associated with multiple gamemodes, it must be comma separated (e.g. gamemodes=&amp;quot;test1,test2&amp;quot;). &lt;br /&gt;
*'''&amp;lt;script /&amp;gt;''' Source code for this resource, possible parameters are:&lt;br /&gt;
** '''src:''' The file name of the source code&lt;br /&gt;
** '''type:''' The type of source code: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; or &amp;quot;shared&amp;quot;.&lt;br /&gt;
**'''cache:''' When the script file type is &amp;quot;client&amp;quot;, this setting controls whether the file is saved on the clients' hard drive. Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean the file is not saved. ''(Note: cache=false files are started at the client first, so lua file load order might differ when mixing cache settings)''&lt;br /&gt;
**'''validate:''' If set to &amp;quot;false&amp;quot;, compatibility checks are skipped.&lt;br /&gt;
*'''&amp;lt;map /&amp;gt;''' The map for a gamemode, possible parameters are:&lt;br /&gt;
**'''src:''' .map file name (can be path too eg. &amp;quot;maps/filename.map&amp;quot;)&lt;br /&gt;
**'''dimension:''' Dimension in which the map will be loaded (optional)&lt;br /&gt;
*'''&amp;lt;file /&amp;gt;''' A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join)&lt;br /&gt;
**'''src:''' client-side file name (can be path too eg. &amp;quot;images/image.png&amp;quot;)&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
**'''download:''' Whether or not to be sent to the client automatically (optional). Default is &amp;quot;true&amp;quot;. Using &amp;quot;false&amp;quot; will mean they are not sent on resource start but could later be used by [[downloadFile]] (from version 1.4)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
*'''&amp;lt;include /&amp;gt;''' Include resources that this resource will use&lt;br /&gt;
**'''resource:''' Resource name that you want to start with this resource&lt;br /&gt;
**'''minversion:''' Minimum version that '''resource''' needs to be (optional)&lt;br /&gt;
**'''maxversion:''' Maximum version that '''resource''' needs to be (optional)&lt;br /&gt;
*'''&amp;lt;config /&amp;gt;''' Config file (.xml) can be accessed by resource, possible parameters are:&lt;br /&gt;
**'''src:''' The file name of the config file&lt;br /&gt;
**'''type:''' The type of the config file: &amp;quot;client&amp;quot; or &amp;quot;server&amp;quot;&lt;br /&gt;
*'''&amp;lt;export /&amp;gt;''' This exports functions from this resource, so other resources can use them with [[call]]&lt;br /&gt;
**'''function:''' The function name&lt;br /&gt;
**'''type''' Whether function is exported server-side or client-side (valid values are: &amp;quot;client&amp;quot;, &amp;quot;server&amp;quot; and &amp;quot;shared&amp;quot;)&lt;br /&gt;
**'''http:''' Can the function be called via HTTP (true/false)&lt;br /&gt;
*'''&amp;lt;html /&amp;gt;'''&lt;br /&gt;
**'''src:''' The filename for the HTTP file (can be a path)&lt;br /&gt;
**'''default:''' The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)&lt;br /&gt;
**'''raw:''' The html file is not parsed by the Lua interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)&lt;br /&gt;
*'''&amp;lt;settings&amp;gt; &amp;lt;setting name=&amp;quot;&amp;quot; value=&amp;quot;&amp;quot;/&amp;gt; &amp;lt;/settings&amp;gt;:''' Most gamemodes use [[settings system]] to let server admins to configure it how they like. For instance you could set round time and then use [[get]] and [[set]] to get the value or change it, respectively.&lt;br /&gt;
*'''&amp;lt;min_mta_version /&amp;gt;''' Minimum version requirements for this resource to run correctly. When authoring resources, the minimum version should usually be set to the current released version of MTA:SA (which at the moment is &amp;quot;{{Current Version|full}}&amp;quot;). See example for example.&lt;br /&gt;
**'''client:''' The minimum client version&lt;br /&gt;
**'''server:''' The minimum server version&lt;br /&gt;
*'''&amp;lt;aclrequest /&amp;gt;''' A list of [[Access_Control_List|ACL]] rights this resource will need.&lt;br /&gt;
{{New items|3.0132|1.3.1 r4141|&lt;br /&gt;
*'''&amp;lt;sync_map_element_data /&amp;gt;''' Controls whether map [[Element_data|element data]] such as &amp;quot;PosX&amp;quot; and &amp;quot;DoubleSided&amp;quot; are transferred to the client. This data is usually not required by most gamemodes or resources. (Map Editor and Interiors require this to be not set to false to work). When set in a gamemode meta.xml, the setting will apply to all maps loaded by that resource.&lt;br /&gt;
**'''false:''' Disable transfer of map element data for all resources. This can reduce map download times considerably.&lt;br /&gt;
**'''true:''' Enable transfer of map element data for all resources. (If '''false''' and '''true''' are set in different resources, true will have priority and all resources will transfer map element data)&lt;br /&gt;
}}&lt;br /&gt;
{{New items|3.0140|1.4.0 r5313|&lt;br /&gt;
*'''&amp;lt;oop/&amp;gt;''' OOP - Please refer to [[OOP]] for documentation.&lt;br /&gt;
**'''false:''' Disable OOP.&lt;br /&gt;
**'''true:''' Enable OOP.&lt;br /&gt;
}}&lt;br /&gt;
{{New feature/item|3.0150|1.5.0|7308|&lt;br /&gt;
*'''&amp;lt;download_priority_group/&amp;gt;''' If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Heres an example of a meta file using some of the tags mentioned:&lt;br /&gt;
{{#tag:syntaxhighlight |&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
    &amp;lt;info author=&amp;quot;Slothman&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;Stealth&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;config src=&amp;quot;help.xml&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;download_priority_group&amp;gt;0&amp;lt;/download_priority_group&amp;gt;&lt;br /&gt;
    &amp;lt;min_mta_version client=&amp;quot;{{Current Version|full}}&amp;quot; server=&amp;quot;{{Current Version|full}}&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;sync_map_element_data&amp;gt;false&amp;lt;/sync_map_element_data&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noiseblip.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;mission_timer.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_server.lua&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;gadgets_client.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;stealthmain_client.lua&amp;quot; type=&amp;quot;client&amp;quot; validate=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;noisebar.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;spycam.lua&amp;quot; type=&amp;quot;client&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;script src=&amp;quot;riemann_z_demonstration.lua&amp;quot; type=&amp;quot;client&amp;quot; cache=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;map src=&amp;quot;base.map&amp;quot; dimension=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.txd&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.dff&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;riot_shield.col&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;armor.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;camera.png&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;cloak.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;goggles.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;mine.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;radar.png&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;file src=&amp;quot;shield.png&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;scoreboard&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;killmessages&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;include resource=&amp;quot;maplimits&amp;quot; /&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport1&amp;quot; type=&amp;quot;server&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport2&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;export function=&amp;quot;exampleExport3&amp;quot; type=&amp;quot;shared&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;settings&amp;gt;&lt;br /&gt;
         &amp;lt;setting name=&amp;quot;roundlimit&amp;quot; value=&amp;quot;[6]&amp;quot; /&amp;gt; &amp;lt;!-- round length in minutes --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teamdamage&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!-- 0 for team protection off, 1 for team protection on --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teambalance&amp;quot; value=&amp;quot;[1]&amp;quot; /&amp;gt; &amp;lt;!--  difference limit of amount of players between teams --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;spazammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt; &amp;lt;!-- ammo amounts --&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;m4ammo&amp;quot; value=&amp;quot;[100]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;shotgunammo&amp;quot; value=&amp;quot;[25]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;sniperammo&amp;quot; value=&amp;quot;[20]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;ak47ammo&amp;quot; value=&amp;quot;[120]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;rifleammo&amp;quot; value=&amp;quot;[40]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;deserteagleammo&amp;quot; value=&amp;quot;[45]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;pistolammo&amp;quot; value=&amp;quot;[132]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;uziammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;tec9ammo&amp;quot; value=&amp;quot;[150]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;silencedammo&amp;quot; value=&amp;quot;[65]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;grenadeammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;satchelammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;teargasammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;molatovammo&amp;quot; value=&amp;quot;[4]&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;setting name=&amp;quot;isAllowedToShoot&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/settings&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     &amp;lt;aclrequest&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.startResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.stopResource&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
	 &amp;lt;right name=&amp;quot;function.setPlayerMuted&amp;quot; access=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;/aclrequest&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
|lang=&amp;quot;xml&amp;quot;}}&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[cs:Meta.xml]]&lt;br /&gt;
[[de:Meta.xml]]&lt;br /&gt;
[[es:Sobre el archivo &amp;quot;meta.xml&amp;quot;]]&lt;br /&gt;
[[it:Meta.xml]]&lt;br /&gt;
[[pl:Meta.xml]]&lt;br /&gt;
[[ru:Meta.xml]]&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource:Spawnmanager/createSpawnpoint&amp;diff=47410</id>
		<title>Resource:Spawnmanager/createSpawnpoint</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource:Spawnmanager/createSpawnpoint&amp;diff=47410"/>
		<updated>2016-04-19T00:58:08Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function creates a spawnpoint.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
spawnpoint createSpawnpoint ( float x, float y, float z, [ float rotation = 0, int skin = 0,  int interior = 0, int dimension = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&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;
*'''rotation:''' A floating point number representing the spawn's rotation about the Z axis in degrees.&lt;br /&gt;
*'''skin:''' An integer representing the skin ID (see [[Character_Skins|character skins]]).&lt;br /&gt;
*'''interior:''' An integer representing the interior in which the spawnpoint spawns players.&lt;br /&gt;
*'''dimension:''' An integer representing the diimension in which the spawnpoint spawns players.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the spawnpoint element if creation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This function lets the player create a new spawnpoint where he stands, with the skin of his choice.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local spawnpointsTable = { }&lt;br /&gt;
 &lt;br /&gt;
function createSpawnpointCmd(player,cmd,arg1)&lt;br /&gt;
    local x, y, z = getElementPosition(player)&lt;br /&gt;
    local rot = getPlayerRotation(player)&lt;br /&gt;
    local int = getElementInterior(player)&lt;br /&gt;
    local dim = getElementDimension(player)&lt;br /&gt;
    local skin = getElementModel(player)&lt;br /&gt;
   &lt;br /&gt;
    local spawnpoint = exports.spawnmanager:createSpawnpoint(x, y, z, rot, skin, int, dim)&lt;br /&gt;
   &lt;br /&gt;
    if spawnpoint then&lt;br /&gt;
        table.insert(spawnpointsTable, spawnpoint)&lt;br /&gt;
         outputChatBox(&amp;quot;Created Spawn Point&amp;quot;, player)&lt;br /&gt;
    else&lt;br /&gt;
         outputChatBox(&amp;quot;Failed to create Spawn Point&amp;quot;, player)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;mark&amp;quot;,createSpawnpointCmd)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Spawnmanager/createSpawnpoint&amp;diff=47409</id>
		<title>Spawnmanager/createSpawnpoint</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Spawnmanager/createSpawnpoint&amp;diff=47409"/>
		<updated>2016-04-19T00:42:21Z</updated>

		<summary type="html">&lt;p&gt;Backsage: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource:Spawnmanager/createSpawnpoint&amp;diff=47408</id>
		<title>Resource:Spawnmanager/createSpawnpoint</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource:Spawnmanager/createSpawnpoint&amp;diff=47408"/>
		<updated>2016-04-19T00:41:31Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Optional Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function creates a spawnpoint.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
spawnpoint createSpawnpoint ( float x, float y, float z, [ float rotation = 0, int skin = 0,  int interior = 0, int dimension = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&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;
*'''rotation:''' A floating point number representing the spawn's rotation about the Z axis in degrees.&lt;br /&gt;
*'''skin:''' An integer representing the skin ID (see [[Character_Skins|character skins]]).&lt;br /&gt;
*'''interior:''' An integer representing the interior in which the spawnpoint spawns players.&lt;br /&gt;
*'''dimension:''' An integer representing the diimension in which the spawnpoint spawns players.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the spawnpoint element if creation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This function lets the player create a new spawnpoint where he stands, with the skin of his choice.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createSP( source, command, skin )&lt;br /&gt;
      local x, y, z = getElementPosition( source ) --Get the players location&lt;br /&gt;
      local rot = getPlayerRotation( source ) --Get the players rotation&lt;br /&gt;
      local theSpawnpoint = call(getResourceFromName(&amp;quot;spawnmanager&amp;quot;), &amp;quot;createSpawnpoint&amp;quot;, x, y, z, rot, skin ) --Create the spawnpoint.&lt;br /&gt;
      if ( theSpawnpoint ) then&lt;br /&gt;
            outputConsole ( &amp;quot;Spawnpoint created.&amp;quot;, source ) --notify the player if it was successful&lt;br /&gt;
      end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;mark&amp;quot;, createSP )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Resource:Spawnmanager/createSpawnpoint&amp;diff=47407</id>
		<title>Resource:Spawnmanager/createSpawnpoint</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Resource:Spawnmanager/createSpawnpoint&amp;diff=47407"/>
		<updated>2016-04-19T00:41:05Z</updated>

		<summary type="html">&lt;p&gt;Backsage: /* Required Arguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function creates a spawnpoint.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
spawnpoint createSpawnpoint ( float x, float y, float z, [ float rotation = 0, int skin = 0,  int interior = 0, int dimension = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&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;
*'''rotation:''' A floating point number representing the spawn's rotation about the Z axis in degrees.&lt;br /&gt;
*'''skin:''' An integer representing the skin ID (see [[Character_Skins|character skins]]).&lt;br /&gt;
*'''interior:''' An integer representing the interior in which the spawnpoint spawns players.&lt;br /&gt;
*'''dimension:''' An integer representing the diimension in which the spawnpoint spawns players.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''rotation:''' A floating point number representing the spawn's rotation about the Z axis in degrees.&lt;br /&gt;
*'''skin:''' An integer representing the skin ID (see [[Character_Skins|character skins]]).&lt;br /&gt;
*'''interior:''' An integer representing the interior in which the spawnpoint spawns players.&lt;br /&gt;
*'''dimension:''' An integer representing the diimension in which the spawnpoint spawns players.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the spawnpoint element if creation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This function lets the player create a new spawnpoint where he stands, with the skin of his choice.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createSP( source, command, skin )&lt;br /&gt;
      local x, y, z = getElementPosition( source ) --Get the players location&lt;br /&gt;
      local rot = getPlayerRotation( source ) --Get the players rotation&lt;br /&gt;
      local theSpawnpoint = call(getResourceFromName(&amp;quot;spawnmanager&amp;quot;), &amp;quot;createSpawnpoint&amp;quot;, x, y, z, rot, skin ) --Create the spawnpoint.&lt;br /&gt;
      if ( theSpawnpoint ) then&lt;br /&gt;
            outputConsole ( &amp;quot;Spawnpoint created.&amp;quot;, source ) --notify the player if it was successful&lt;br /&gt;
      end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;mark&amp;quot;, createSP )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Spawnmanager/createSpawnpoint&amp;diff=47401</id>
		<title>Spawnmanager/createSpawnpoint</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Spawnmanager/createSpawnpoint&amp;diff=47401"/>
		<updated>2016-04-18T03:51:47Z</updated>

		<summary type="html">&lt;p&gt;Backsage: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Someone should update this because rotation, skin, interior, and dimension are actually required, not optional.&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Spawnmanager/createSpawnpoint&amp;diff=47400</id>
		<title>Spawnmanager/createSpawnpoint</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Spawnmanager/createSpawnpoint&amp;diff=47400"/>
		<updated>2016-04-17T21:22:21Z</updated>

		<summary type="html">&lt;p&gt;Backsage: Created page with &amp;quot;createSpawnpoint doesn't work.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;createSpawnpoint doesn't work.&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=47028</id>
		<title>Requested Functions and Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=47028"/>
		<updated>2016-03-27T01:14:30Z</updated>

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

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

		<summary type="html">&lt;p&gt;Backsage: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Does this even work? It doesn't look like it does because it will always return false as that timer will execute 3000ms after that function, not inside it. Also did you check if getElementVelocity on the object works? Maybe it does.&lt;br /&gt;
&lt;br /&gt;
--[[User:Arran Fortuna|Arran Fortuna]] 14:11, 7 October 2012 (UTC)&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
Arran you are partly right about &amp;quot;Does this even work?&amp;quot; it can return true but this only happens when there is movement on the X axis (it still returns false if there is only movement on the Y and or Z axis.&lt;br /&gt;
Also fyi getElementVelocity() does work on objects because an object is also an element.&lt;br /&gt;
&lt;br /&gt;
'''Things that should get changed (imo) are:'''&amp;lt;br/&amp;gt;&lt;br /&gt;
- isObjectMoving() should be changed to isElementMoving() (because you can use this function all elements not only objects)&amp;lt;br/&amp;gt;&lt;br /&gt;
- The function should not only check for the movement on the X axis but also on the Y and Z&lt;br /&gt;
&lt;br /&gt;
==It would look like this==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function isElementMoving(theElement)&lt;br /&gt;
	if isElement(theElement)then --First check if the given argument is an element&lt;br /&gt;
		local x, y, z = getElementVelocity(theElement) --Get the velocity of the element given in our argument&lt;br /&gt;
		if x == 0 and y == 0 and z == 0 then --When there is no movement on X, Y or Z return false because our element is not moving&lt;br /&gt;
			return false&lt;br /&gt;
		else&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I will change the page later today and also add some sample code!&amp;lt;br/&amp;gt;&lt;br /&gt;
[[User:CR=|CR=]] 11:35, 12 October 2012 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
It looks like this doesn't even work for objects that are being moved from moveObject.&lt;/div&gt;</summary>
		<author><name>Backsage</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=46880</id>
		<title>Requested Functions and Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Requested_Functions_and_Events&amp;diff=46880"/>
		<updated>2016-03-20T04:14:53Z</updated>

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

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

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