<?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=Alberto+Alonso</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=Alberto+Alonso"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Alberto_Alonso"/>
	<updated>2026-04-26T04:32:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnPlayerScreenShot&amp;diff=29069</id>
		<title>OnPlayerScreenShot</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnPlayerScreenShot&amp;diff=29069"/>
		<updated>2012-01-20T16:47:07Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when the screen capture requested by [[takePlayerScreenShot]] has completed.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
resource theResource, string status, string imageData, int timestamp, string tag&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''theResource''': The resource which called [[takePlayerScreenShot]]&lt;br /&gt;
*'''status''': The status of the event which can be one of three values:&lt;br /&gt;
**''&amp;quot;ok&amp;quot;'' - The image capture was successful and imageData will contain a JPEG image.&lt;br /&gt;
**''&amp;quot;disabled&amp;quot;'' - The image capture failed because the player has disabled screen uploads.&lt;br /&gt;
**''&amp;quot;minimized&amp;quot;'' - The image capture failed because the player has minimized the screen. (i.e. alt-tabbed)&lt;br /&gt;
*'''imageData''': A string which contains the JPEG image data. This can be saved with the file functions, or sent to players with triggerClientEvent or even -oh my god- uploaded to a web site.&lt;br /&gt;
*'''timestamp''': The server tick count when the capture was taken.&lt;br /&gt;
*'''tag''': The tag string passed to [[takePlayerScreenShot]].&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[player]]&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example captures the screen of a random player every 2 seconds and shows it to everyone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--------------------------------------------------&lt;br /&gt;
-- Take screen shot every 2 seconds&lt;br /&gt;
function doTakeScreenShot()&lt;br /&gt;
    takePlayerScreenShot( getRandomPlayer(), 320, 200 )&lt;br /&gt;
end&lt;br /&gt;
setTimer(doTakeScreenShot, 2000, 0)&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------&lt;br /&gt;
-- Receive screen shot result&lt;br /&gt;
addEventHandler( &amp;quot;onPlayerScreenShot&amp;quot;, root,&lt;br /&gt;
    function ( theResource, status, imageData, timestamp, tag )&lt;br /&gt;
        triggerClientEvent( root, &amp;quot;onMyClientScreenShot&amp;quot;, resourceRoot, imageData  )  -- Relay to all players&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--------------------------------------------------&lt;br /&gt;
-- Turn image data into a texture at the client&lt;br /&gt;
addEvent(&amp;quot;onMyClientScreenShot&amp;quot;,true)&lt;br /&gt;
addEventHandler( &amp;quot;onMyClientScreenShot&amp;quot;, resourceRoot,&lt;br /&gt;
    function( imageData )&lt;br /&gt;
        local newFile = fileCreate(&amp;quot;temp.jpg&amp;quot;)&lt;br /&gt;
        fileWrite(newFile, imageData )            &lt;br /&gt;
        fileClose(newFile)&lt;br /&gt;
        if image then&lt;br /&gt;
            destroyElement(image)&lt;br /&gt;
        end&lt;br /&gt;
        image = dxCreateTexture( &amp;quot;temp.jpg&amp;quot; )&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------&lt;br /&gt;
-- Show image&lt;br /&gt;
addEventHandler( &amp;quot;onClientRender&amp;quot;, root,&lt;br /&gt;
    function()&lt;br /&gt;
        if image then&lt;br /&gt;
            dxDrawImage( 100, 250, 320, 200, image )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.3|n/a|}}&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Player events}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Server_functions&amp;diff=26605</id>
		<title>Template:Server functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Server_functions&amp;diff=26605"/>
		<updated>2011-08-05T09:57:05Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: Added setMaxPlayers to the list.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[addCommandHandler]]&lt;br /&gt;
*[[executeCommandHandler]]&lt;br /&gt;
*[[fromJSON]]&lt;br /&gt;
*[[getFPSLimit]]&lt;br /&gt;
*[[getMaxPlayers]]&lt;br /&gt;
*[[getServerHttpPort]]&lt;br /&gt;
*[[getServerName]]&lt;br /&gt;
*[[getServerPassword]]&lt;br /&gt;
*[[getServerPort]]&lt;br /&gt;
*[[getVersion]]&lt;br /&gt;
*[[isGlitchEnabled]]&lt;br /&gt;
*[[outputChatBox]]&lt;br /&gt;
*[[outputConsole]]&lt;br /&gt;
*[[outputDebugString]]&lt;br /&gt;
*[[outputServerLog]]&lt;br /&gt;
*[[removeCommandHandler]]&lt;br /&gt;
*[[setFPSLimit]]&lt;br /&gt;
*[[setGlitchEnabled]]&lt;br /&gt;
*[[setMaxPlayers]]&lt;br /&gt;
*[[setServerPassword]]&lt;br /&gt;
*[[showChat]]&lt;br /&gt;
*[[shutdown]]&lt;br /&gt;
*[[toJSON]]&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnVehicleStartExit&amp;diff=25975</id>
		<title>OnVehicleStartExit</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnVehicleStartExit&amp;diff=25975"/>
		<updated>2011-06-08T10:49:37Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: Introduced the new event parameter: door&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server event}}&lt;br /&gt;
This event is triggered when a player starts to exit a vehicle. This event can be used to cancel exit, if necessary.&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player exitingPlayer, int seat, player jacked, int door&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*'''exitingPlayer''': A player element representing the player who is starting to exit a vehicle&lt;br /&gt;
*'''seat''': An integer representing the seat in which the player is exiting from&lt;br /&gt;
*'''jacked''': A player element representing who is jacking&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
*'''door''': An integer representing the door that the player is using to leave.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the [[vehicle]] in which a player began to exit.&lt;br /&gt;
&lt;br /&gt;
===Canceling===&lt;br /&gt;
If this event is [[Event system #Canceling|canceled]], the player will not exit the vehicle.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example locks a player inside a police vehicle if he is a policeman.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
policeVehicles { [598]=true,[596]=true,[597]=true,[599]=true }&lt;br /&gt;
policeSkins { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true }&lt;br /&gt;
&lt;br /&gt;
function exitVehicle ( thePlayer, seat, jacked ) --when a player enters a vehicle&lt;br /&gt;
    if ( policeVehicles[getVehicleID ( source )] ) and ( policeSkins[getPlayerSkin ( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is a police skin&lt;br /&gt;
        cancelEvent()&lt;br /&gt;
        outputChatBox ( &amp;quot;You're the cop! Don't exit the car!&amp;quot;, thePlayer ) --and tell the player why&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onVehicleStartExit&amp;quot;, getRootElement(), exitVehicle ) -- add an event handler for onVehicleStartExit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{See also/Server event|Vehicle events}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientVehicleStartExit&amp;diff=25974</id>
		<title>OnClientVehicleStartExit</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientVehicleStartExit&amp;diff=25974"/>
		<updated>2011-06-08T10:48:56Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: Introduced the new event parameter: door&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Incomplete Event]]&lt;br /&gt;
{{Client event}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This event is triggered when a player starts exiting a vehicle. Once the exiting animation completes, [[onClientVehicleExit]] is triggered.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
player thePlayer, int seat, int door&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''thePlayer:''' the player who started exiting the vehicle.&lt;br /&gt;
*'''seat:''' the number of the seat that the player was sitting on.&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
*'''door:''' the number of the door that the player is using to leave.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The source of this event is the vehicle that the player started to exit.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===Client vehicle events===&lt;br /&gt;
{{Client_vehicle_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementMatrix&amp;diff=25437</id>
		<title>GetElementMatrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementMatrix&amp;diff=25437"/>
		<updated>2011-02-27T14:56:11Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This function gets an element's transform matrix. This contains 16 float values that multiplied to a point will give you the point transformed. It is most useful for matrix calculations such as calculating offsets. For further information, please refer to a tutorial of matrices in computer graphics programming.&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 getElementMatrix ( element theElement )       &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The element which you wish to retrieve the matrix for&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a multi-dimensional array containing a 4x4 matrix.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a utility function that gets the position that is in front of a specified player.  Note that it assumes you have the [http://lua-users.org/wiki/LuaMatrix Lua Matrix] library installed.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getPositionInFrontOfElement(element)&lt;br /&gt;
	--Get the position 5 units in front&lt;br /&gt;
	local transformed = matrix{0,5,0} * matrix(getElementMatrix(element))&lt;br /&gt;
	--Get our offset components&lt;br /&gt;
	local offX,offY,offZ = transformed[1][1],transformed[2][1],transformed[3][1]&lt;br /&gt;
	--Return the transformed point&lt;br /&gt;
	return offX, offY, offZ&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example is exactly the same as above, but without using the Lua Matrix library.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getPositionInFrontOfElement(element)&lt;br /&gt;
	-- Get the matrix&lt;br /&gt;
	local matrix = getElementMatrix ( element )&lt;br /&gt;
	-- Get the transformation of a point 5 units in front of the element&lt;br /&gt;
	local offX = 0 * matrix[1][1] + 5 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1]&lt;br /&gt;
	local offY = 0 * matrix[1][2] + 5 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2]&lt;br /&gt;
	local offZ = 0 * matrix[1][3] + 5 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3]&lt;br /&gt;
	--Return the transformed point&lt;br /&gt;
	return offX, offY, offZ&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_element_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleDoorOpenRatio&amp;diff=25206</id>
		<title>GetVehicleDoorOpenRatio</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleDoorOpenRatio&amp;diff=25206"/>
		<updated>2011-01-16T21:09:52Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: Created page with &amp;quot;__NOTOC__ {{Server client function}} This function gets the door open ratio on a vehicle.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; float getVehicleDoorOpenRatio ( vehicle theVehicle, int door )...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function gets the door open ratio on a vehicle.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getVehicleDoorOpenRatio ( vehicle theVehicle, int door )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''theVehicle:''' The [[vehicle]] that you wish to get the door open ratio of.&lt;br /&gt;
*'''door:''' An integer between 0 and 5 specifying the door you want to get the open ratio of.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns the door open ratio, or ''false'' if invalid arguments are passed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler ( &amp;quot;carshowoff&amp;quot;, function ( playerSource )&lt;br /&gt;
	local vehicle = getPedOccupiedVehicle ( playerSource )&lt;br /&gt;
	if vehicle then&lt;br /&gt;
		for i=0,5 do&lt;br /&gt;
			setVehicleDoorOpenRatio ( vehicle, i, 1 - getVehicleDoorOpenRatio ( vehicle, i ), 2500 )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleDoorOpenRatio&amp;diff=25205</id>
		<title>SetVehicleDoorOpenRatio</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleDoorOpenRatio&amp;diff=25205"/>
		<updated>2011-01-16T21:07:02Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: Created page with &amp;quot;__NOTOC__ {{Server client function}} This function sets the door open ratio on a vehicle.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool setVehicleDoorOpenRatio ( vehicle theVehicle, int door, f...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function sets the door open ratio on a vehicle.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setVehicleDoorOpenRatio ( vehicle theVehicle, int door, float ratio [, int time ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Required Arguments==&lt;br /&gt;
*'''theVehicle:''' The [[vehicle]] that you wish to change the door open ratio of.&lt;br /&gt;
*'''door:''' An integer between 0 and 5 specifying the door you want to change open ratio of.&lt;br /&gt;
*'''ratio:''' The ratio value, ranging from 0 (fully closed) to 1 (fully open).&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''time:''' The time that the change will take. A value of 0 will change the door open ratio inmediately.&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns ''true'' if the door open ratio was successfully set, ''false'' if invalid arguments are passed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler ( &amp;quot;carshowoff&amp;quot;, function ( playerSource )&lt;br /&gt;
	local vehicle = getPedOccupiedVehicle ( playerSource )&lt;br /&gt;
	if vehicle then&lt;br /&gt;
		for i=0,5 do&lt;br /&gt;
			setVehicleDoorOpenRatio ( vehicle, i, 1 - getVehicleDoorOpenRatio ( vehicle, i ), 2500 )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Client_vehicle_functions&amp;diff=25204</id>
		<title>Template:Client vehicle functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Client_vehicle_functions&amp;diff=25204"/>
		<updated>2011-01-16T21:00:02Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: get/setVehicleDoorOpenRatio&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[addVehicleUpgrade]]&lt;br /&gt;
*[[attachTrailerToVehicle]]&lt;br /&gt;
*[[blowVehicle]]&lt;br /&gt;
*[[createVehicle]]&lt;br /&gt;
*[[detachTrailerFromVehicle]]&lt;br /&gt;
*[[fixVehicle]]&lt;br /&gt;
*[[getVehicleAdjustableProperty]]&lt;br /&gt;
*[[getVehicleColor]]&lt;br /&gt;
*[[getVehicleCompatibleUpgrades]]&lt;br /&gt;
*[[getVehicleController]]&lt;br /&gt;
*[[getVehicleDoorState]]&lt;br /&gt;
*[[getVehicleEngineState]]&lt;br /&gt;
*[[getVehicleLandingGearDown]]&lt;br /&gt;
*[[getVehicleLightState]]&lt;br /&gt;
*[[getVehicleMaxPassengers]]&lt;br /&gt;
*[[getVehicleName]]&lt;br /&gt;
*[[getVehicleOccupant]]&lt;br /&gt;
*[[getVehicleOccupants]]&lt;br /&gt;
*[[getVehicleCurrentGear]]&lt;br /&gt;
*[[getVehicleOverrideLights]]&lt;br /&gt;
*[[getVehiclePaintjob]]&lt;br /&gt;
*[[getVehiclePanelState]]&lt;br /&gt;
*[[getVehiclePlateText]]&lt;br /&gt;
*[[getVehicleRotation]]&lt;br /&gt;
*[[getVehicleSirensOn]]&lt;br /&gt;
*[[getVehicleTowedByVehicle]]&lt;br /&gt;
*[[getVehicleTowingVehicle]]&lt;br /&gt;
*[[getVehicleTurnVelocity]]&lt;br /&gt;
*[[getVehicleTurretPosition]]&lt;br /&gt;
*[[getVehicleUpgradeOnSlot]]&lt;br /&gt;
*[[getVehicleUpgrades]]&lt;br /&gt;
*[[getVehicleUpgradeSlotName]]&lt;br /&gt;
*[[getVehicleWheelStates]]&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
*[[getVehicleDoorOpenRatio]]&lt;br /&gt;
}}&lt;br /&gt;
*[[isVehicleDamageProof]]&lt;br /&gt;
*[[isVehicleFrozen]]&lt;br /&gt;
*[[isVehicleFuelTankExplodable]]&lt;br /&gt;
*[[isVehicleLocked]]&lt;br /&gt;
*[[isVehicleOnGround]]&lt;br /&gt;
*[[removeVehicleUpgrade]]&lt;br /&gt;
*[[setVehicleAdjustableProperty]]&lt;br /&gt;
*[[setVehicleColor]]&lt;br /&gt;
*[[setVehicleDamageProof]]&lt;br /&gt;
*[[setVehicleDirtLevel]]&lt;br /&gt;
*[[setVehicleDoorState]]&lt;br /&gt;
*[[setVehicleDoorsUndamageable]]&lt;br /&gt;
*[[setVehicleEngineState]]&lt;br /&gt;
*[[setVehicleFrozen]]&lt;br /&gt;
*[[setVehicleFuelTankExplodable]]&lt;br /&gt;
*[[setVehicleLandingGearDown]]&lt;br /&gt;
*[[setVehicleLightState]]&lt;br /&gt;
*[[setVehicleLocked]]&lt;br /&gt;
*[[setVehicleOverrideLights]]&lt;br /&gt;
*[[setVehiclePaintjob]]&lt;br /&gt;
*[[setVehiclePanelState]]&lt;br /&gt;
*[[setVehicleRotation]]&lt;br /&gt;
*[[setVehicleSirensOn]]&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
*[[setVehicleTurretPosition]]&lt;br /&gt;
*[[setVehicleDoorOpenRatio]]&lt;br /&gt;
}}&lt;br /&gt;
*[[setVehicleTurnVelocity]]&lt;br /&gt;
*[[setVehicleWheelStates]]&lt;br /&gt;
*[[getHelicopterRotorSpeed]]&lt;br /&gt;
*[[getTrainDirection]]&lt;br /&gt;
*[[getTrainSpeed]]&lt;br /&gt;
*[[getVehicleGravity]]&lt;br /&gt;
*[[getVehicleHeadLightColor]]&lt;br /&gt;
*[[getVehicleModelFromName]]&lt;br /&gt;
*[[getVehicleNameFromModel]]&lt;br /&gt;
*[[getVehicleType]]&lt;br /&gt;
*[[isTrainDerailable]]&lt;br /&gt;
*[[isTrainDerailed]]&lt;br /&gt;
*[[isVehicleBlown]]&lt;br /&gt;
*[[isVehicleTaxiLightOn]]&lt;br /&gt;
*[[setHelicopterRotorSpeed]]&lt;br /&gt;
*[[setTrainDerailable]]&lt;br /&gt;
*[[setTrainDerailed]]&lt;br /&gt;
*[[setTrainDirection]]&lt;br /&gt;
*[[setTrainSpeed]]&lt;br /&gt;
*[[setVehicleGravity]]&lt;br /&gt;
*[[setVehicleHeadLightColor]]&lt;br /&gt;
*[[setVehicleTaxiLightOn]]&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Vehicle_functions&amp;diff=25203</id>
		<title>Template:Vehicle functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Vehicle_functions&amp;diff=25203"/>
		<updated>2011-01-16T20:59:12Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: get/setVehicleDoorOpenRatio&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[addVehicleUpgrade]]&lt;br /&gt;
*[[attachTrailerToVehicle]]&lt;br /&gt;
*[[blowVehicle]]&lt;br /&gt;
*[[createVehicle]]&lt;br /&gt;
*[[detachTrailerFromVehicle]]&lt;br /&gt;
*[[fixVehicle]]&lt;br /&gt;
*[[getVehicleColor ]]&lt;br /&gt;
*[[getVehicleCompatibleUpgrades]]&lt;br /&gt;
*[[getVehicleController]]&lt;br /&gt;
*[[getVehicleDoorState]]&lt;br /&gt;
*[[getVehicleEngineState]]&lt;br /&gt;
*[[getVehicleLandingGearDown]]&lt;br /&gt;
*[[getVehicleLightState]]&lt;br /&gt;
*[[getVehicleMaxPassengers]]&lt;br /&gt;
*[[getVehicleName]]&lt;br /&gt;
*[[getVehicleOccupant]]&lt;br /&gt;
*[[getVehicleOccupants]]&lt;br /&gt;
*[[getVehicleOverrideLights]]&lt;br /&gt;
*[[getVehiclePaintjob]]&lt;br /&gt;
*[[getVehiclePanelState]]&lt;br /&gt;
*[[getVehicleRotation]]&lt;br /&gt;
*[[getVehicleSirensOn]]&lt;br /&gt;
*[[getVehiclesOfType]]&lt;br /&gt;
*[[getVehicleTowedByVehicle]]&lt;br /&gt;
*[[getVehicleTowingVehicle]]&lt;br /&gt;
*[[getVehicleTurnVelocity]]&lt;br /&gt;
*[[getVehicleTurretPosition]]&lt;br /&gt;
*[[getVehicleType]]&lt;br /&gt;
*[[getVehicleUpgradeOnSlot]]&lt;br /&gt;
*[[getVehicleUpgrades]]&lt;br /&gt;
*[[getVehicleUpgradeSlotName]]&lt;br /&gt;
*[[getVehicleWheelStates]]&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
*[[getVehicleDoorOpenRatio]]&lt;br /&gt;
}}&lt;br /&gt;
*[[isVehicleDamageProof]]&lt;br /&gt;
*[[isVehicleFrozen]]&lt;br /&gt;
*[[isVehicleFuelTankExplodable]]&lt;br /&gt;
*[[isVehicleLocked]]&lt;br /&gt;
*[[isVehicleOnGround]]&lt;br /&gt;
*[[removeVehicleUpgrade]]&lt;br /&gt;
*[[resetVehicleExplosionTime]]&lt;br /&gt;
*[[resetVehicleIdleTime]]&lt;br /&gt;
*[[respawnVehicle]]&lt;br /&gt;
*[[setVehicleColor]]&lt;br /&gt;
*[[setVehicleDamageProof]]&lt;br /&gt;
*[[setVehicleDirtLevel]]&lt;br /&gt;
*[[setVehicleDoorState]]&lt;br /&gt;
*[[setVehicleDoorsUndamageable]]&lt;br /&gt;
*[[setVehicleEngineState]]&lt;br /&gt;
*[[setVehicleFrozen]]&lt;br /&gt;
*[[setVehicleFuelTankExplodable]]&lt;br /&gt;
*[[setVehicleIdleRespawnDelay]]&lt;br /&gt;
*[[setVehicleLandingGearDown]]&lt;br /&gt;
*[[setVehicleLightState]]&lt;br /&gt;
*[[setVehicleLocked]]&lt;br /&gt;
*[[setVehicleOverrideLights]]&lt;br /&gt;
*[[setVehiclePaintjob]]&lt;br /&gt;
*[[setVehiclePanelState]]&lt;br /&gt;
*[[setVehicleRespawnDelay]]&lt;br /&gt;
*[[setVehicleRespawnPosition]]&lt;br /&gt;
*[[setVehicleRotation]]&lt;br /&gt;
*[[setVehicleSirensOn]]&lt;br /&gt;
{{New feature|3.0110|1.1|&lt;br /&gt;
*[[setVehicleTurretPosition]]&lt;br /&gt;
*[[setVehicleDoorOpenRatio]]&lt;br /&gt;
}}&lt;br /&gt;
*[[setVehicleTurnVelocity]]&lt;br /&gt;
*[[setVehicleWheelStates]]&lt;br /&gt;
*[[spawnVehicle]]&lt;br /&gt;
*[[toggleVehicleRespawn]]&lt;br /&gt;
*[[getTrainDirection]]&lt;br /&gt;
*[[getTrainSpeed]]&lt;br /&gt;
*[[getVehicleHeadLightColor]]&lt;br /&gt;
*[[getVehicleModelFromName]]&lt;br /&gt;
*[[getVehicleNameFromModel]]&lt;br /&gt;
*[[getVehicleType]]&lt;br /&gt;
*[[isTrainDerailable]]&lt;br /&gt;
*[[isTrainDerailed]]&lt;br /&gt;
*[[isVehicleBlown]]&lt;br /&gt;
*[[isVehicleTaxiLightOn]]&lt;br /&gt;
*[[setTrainDerailable]]&lt;br /&gt;
*[[setTrainDerailed]]&lt;br /&gt;
*[[setTrainDirection]]&lt;br /&gt;
*[[setTrainSpeed]]&lt;br /&gt;
*[[setVehicleHeadLightColor]]&lt;br /&gt;
*[[setVehicleTaxiLightOn]]&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Alberto_Alonso&amp;diff=25088</id>
		<title>User:Alberto Alonso</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Alberto_Alonso&amp;diff=25088"/>
		<updated>2011-01-13T15:55:41Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{MTA Developer}}&lt;br /&gt;
&lt;br /&gt;
ryden's '''TODO''' list:&lt;br /&gt;
* Extend superman script to create Peter Petrelli script.&lt;br /&gt;
* &amp;lt;strike&amp;gt;Fix (rewrite) MTA wikibot.&amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;Pass all my exams&amp;lt;/strike&amp;gt;&lt;br /&gt;
* Get a girlfriend&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_null&amp;diff=24981</id>
		<title>Modules/MTA-MySQL/mysql null</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_null&amp;diff=24981"/>
		<updated>2011-01-05T18:08:28Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a MySQL null type. MySQL NULL and lua nil are different concepts, and a table row can contain NULL values. In this case, you must check the value comparing it to mysql_null.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
MySQLNullValue mysql_null ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A MySQL NULL type.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example checks if the name of an account is null.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT name FROM account WHERE id='1' LIMIT 1&amp;quot;) -- Execute the query&lt;br /&gt;
if (mysql_result(result, 1, 1) == mysql_null()) then&lt;br /&gt;
  outputDebugString(&amp;quot;The name of the account #1 is null&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
mysql_free_result(result) -- Free the result&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_free_result&amp;diff=24980</id>
		<title>Modules/MTA-MySQL/mysql free result</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_free_result&amp;diff=24980"/>
		<updated>2011-01-05T18:08:09Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Frees the last query result. This function should be called after every query, specially when these queries return any data.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mysql_free_result ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function doesn't return any value.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_result&amp;diff=24979</id>
		<title>Modules/MTA-MySQL/mysql result</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_result&amp;diff=24979"/>
		<updated>2011-01-05T18:07:55Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a string with the value of the given field with the given offsets, being these:&lt;br /&gt;
* '''row_offset''': An integer value between '''1''' and '''[[Modules/MTA-MySQL/mysql_num_rows|mysql_num_rows()]]'''&lt;br /&gt;
* '''field_offset''': An integer value between '''1''' and '''[[Modules/MTA-MySQL/mysql_num_fields|mysql_num_fields()]]'''&lt;br /&gt;
If the offset is invalid it returns nil.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_result ( MySQLResult result, int row_offset, int field_offset )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string with the data contained in the given offset.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_num_rows&amp;diff=24978</id>
		<title>Modules/MTA-MySQL/mysql num rows</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_num_rows&amp;diff=24978"/>
		<updated>2011-01-05T18:06:58Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the number of rows in the given query result.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_num_rows ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The number of rows in the given query result.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_num_fields&amp;diff=24977</id>
		<title>Modules/MTA-MySQL/mysql num fields</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_num_fields&amp;diff=24977"/>
		<updated>2011-01-05T18:06:46Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the number of fields in the given query result.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_num_fields ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The number of fields in the given query result.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_tell&amp;diff=24976</id>
		<title>Modules/MTA-MySQL/mysql field tell</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_tell&amp;diff=24976"/>
		<updated>2011-01-05T18:06:31Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the current field cursor position in the last executed 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;
int mysql_field_tell ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The current field cursor position.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_seek&amp;diff=24975</id>
		<title>Modules/MTA-MySQL/mysql field seek</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_seek&amp;diff=24975"/>
		<updated>2011-01-05T18:06:18Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Sets the field cursor of a result in the given field offset. The offset must be a value between '''1''' and '''[[Modules/MTA-MySQL/mysql_num_fields|mysql_num_fields()]]'''.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_field_seek ( MySQLResult result, int offset )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
* '''offset:''' A valid field offset&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The previous field cursor.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_name&amp;diff=24974</id>
		<title>Modules/MTA-MySQL/mysql field name</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_name&amp;diff=24974"/>
		<updated>2011-01-05T18:06:00Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the name of a given field in the last executed query. The offset of the field must be an integer between '''1''' and '''[[Modules/MTA-MySQL/mysql_num_rows/mysql_num_fields|mysql_num_fields()]]'''&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_field_name ( MySQLResult result, int offset )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
* '''offset:''' A valid offset&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The given field name.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT name FROM account WHERE id='1' LIMIT 1&amp;quot;) -- Execute the query&lt;br /&gt;
if (result) then&lt;br /&gt;
  local str = mysql_field_name(result, 1)&lt;br /&gt;
  outputDebugString(str) -- Will print 'name'&lt;br /&gt;
  mysql_free_result(result) -- Free the result&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_length&amp;diff=24973</id>
		<title>Modules/MTA-MySQL/mysql field length</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_field_length&amp;diff=24973"/>
		<updated>2011-01-05T18:05:43Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the length of a given field in the last retreived row. The offset of the field must be an integer between '''1''' and '''[[Modules/MTA-MySQL/mysql_num_fields|mysql_num_fields()]]'''&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_field_length ( MySQLResult result, int offset )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
* '''offset:''' A valid offset&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The given field data length.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT name FROM account WHERE id='1' LIMIT 1&amp;quot;) -- Execute the query&lt;br /&gt;
if (result) then&lt;br /&gt;
  local row = mysql_fetch_row(result)&lt;br /&gt;
  local length = mysql_field_length(result, 1)&lt;br /&gt;
  outputDebugString(&amp;quot;The length of &amp;quot; .. row[1] .. &amp;quot; is &amp;quot; .. length)&lt;br /&gt;
  mysql_free_result(result) -- Free the result&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_rows_assoc&amp;diff=24972</id>
		<title>Modules/MTA-MySQL/mysql rows assoc</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_rows_assoc&amp;diff=24972"/>
		<updated>2011-01-05T18:05:23Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Creates an iterator for the result associative rows. When this function is called, the row cursor is set to the first result row.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
iterator mysql_rows_assoc ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An iterator function to iterate all the result rows in associative tables.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example prints all the accounts names&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT * FROM account&amp;quot;) -- Execute the query&lt;br /&gt;
if (result) then&lt;br /&gt;
  for result,row in mysql_rows_assoc(result) do&lt;br /&gt;
    outputDebugString(row[&amp;quot;name&amp;quot;])&lt;br /&gt;
  end&lt;br /&gt;
  mysql_free_result(result) -- Free the result&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_assoc&amp;diff=24971</id>
		<title>Modules/MTA-MySQL/mysql fetch assoc</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_assoc&amp;diff=24971"/>
		<updated>2011-01-05T18:05:05Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns an associative table containing the current row of the last executed query. You can call this function repeatedly to retreive all the result rows. When there aren't more rows in the result it returns nil. You can go to a specific row calling [[Modules/MTA-MySQL/mysql_data_seek|mysql_data_seek()]]&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 mysql_fetch_assoc ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An associative table with the current row&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example shows the name of all the registered accounts&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT * FROM account&amp;quot;) -- Execute the query&lt;br /&gt;
if (result) then&lt;br /&gt;
  while true do&lt;br /&gt;
    local row = mysql_fetch_assoc(result)&lt;br /&gt;
    if (not row) then break end&lt;br /&gt;
&lt;br /&gt;
    outputDebugString(row[&amp;quot;name&amp;quot;])&lt;br /&gt;
  end&lt;br /&gt;
  mysql_free_result(result) -- Free the result&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_rows&amp;diff=24970</id>
		<title>Modules/MTA-MySQL/mysql rows</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_rows&amp;diff=24970"/>
		<updated>2011-01-05T18:04:36Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Creates an iterator for the result rows. When this function is called, the row cursor is set to the first result row.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
iterator mysql_rows ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An iterator function to iterate all the result rows.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example prints all the accounts names&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT name FROM account&amp;quot;) -- Execute the query&lt;br /&gt;
if (result) then&lt;br /&gt;
  for result,row in mysql_rows(result) do&lt;br /&gt;
    outputDebugString(row[1])&lt;br /&gt;
  end&lt;br /&gt;
  mysql_free_result(result) -- Free the result&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_row&amp;diff=24969</id>
		<title>Modules/MTA-MySQL/mysql fetch row</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_row&amp;diff=24969"/>
		<updated>2011-01-05T18:04:18Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a table containing the current row of the last executed query. You can call this function repeatedly to retreive all the result rows. When there aren't more rows in the result it returns nil. You can go to a specific row calling [[Modules/MTA-MySQL/mysql_data_seek|mysql_data_seek()]]&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 mysql_fetch_row ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A table with the current row&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example shows the name of all the registered accounts&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT name FROM account&amp;quot;) -- Execute the query&lt;br /&gt;
if (result) then&lt;br /&gt;
  while true do&lt;br /&gt;
    local row = mysql_fetch_row(result)&lt;br /&gt;
    if (not row) then break end&lt;br /&gt;
&lt;br /&gt;
    outputDebugString(row[1])&lt;br /&gt;
  end&lt;br /&gt;
  mysql_free_result(result) -- Free the result&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_lengths&amp;diff=24968</id>
		<title>Modules/MTA-MySQL/mysql fetch lengths</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_lengths&amp;diff=24968"/>
		<updated>2011-01-05T18:04:05Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a table containing the length of the values of the last retreived row. If you didn't retreive any row or you are in the end of the result set, it returns nil.&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 mysql_fetch_lengths ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A table with the length of the values of the last retreived row.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example shows the length of an account name&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT name FROM account WHERE id='1' LIMIT 1&amp;quot;) -- Execute the query&lt;br /&gt;
if (result) then&lt;br /&gt;
  local row = mysql_fetch_row(result) -- Return the resulting row&lt;br /&gt;
  local lengths = mysql_fetch_lengths(result) -- Retreive the lengths of the result fields&lt;br /&gt;
  outputDebugString(&amp;quot;The length of &amp;quot; .. row[1] .. &amp;quot; is &amp;quot; .. lengths[1])&lt;br /&gt;
  mysql_free_result(result) -- Free the result&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fields&amp;diff=24967</id>
		<title>Modules/MTA-MySQL/mysql fields</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fields&amp;diff=24967"/>
		<updated>2011-01-05T18:03:42Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: Oh god, not again.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Creates an iterator for the result fields. When this function is called, the field cursor is set to the first field.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
iterator mysql_fields ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An iterator function to iterate all the result fields.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example shows how to print the rows of a result set showing the field name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT * FROM account&amp;quot;) -- Execute the query&lt;br /&gt;
for result,row in mysql_rows(result) do -- Iterate through all the result rows&lt;br /&gt;
  local i = 1&lt;br /&gt;
  for result,field in mysql_fields(result) do&lt;br /&gt;
    if (row[i] ~= mysql_null()) then&lt;br /&gt;
      outputDebugString(&amp;quot;row[&amp;quot; .. field[&amp;quot;name&amp;quot;] .. &amp;quot;] = &amp;quot; .. row[i])&lt;br /&gt;
    else&lt;br /&gt;
      outputDebugString(&amp;quot;row[&amp;quot; .. field[&amp;quot;name&amp;quot;] .. &amp;quot;] = NULL&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    i = i + 1&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
mysql_free_result(result) -- Free the result&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fields&amp;diff=24966</id>
		<title>Modules/MTA-MySQL/mysql fields</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fields&amp;diff=24966"/>
		<updated>2011-01-05T18:02:47Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Creates an iterator for the result fields. When this function is called, the field cursor is set to the first field.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
iterator mysql_fields ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An iterator function to iterate all the result fields.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example shows how to print the rows of a result set showing the field name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT * FROM account&amp;quot;) -- Execute the query&lt;br /&gt;
for result,row in mysql_rows(result) do -- Iterate through all the result rows&lt;br /&gt;
  local i = 1&lt;br /&gt;
  for result,field in mysql_fields(result) do&lt;br /&gt;
    if (row[i] ~= mysql_null()) then&lt;br /&gt;
      outputDebugString(&amp;quot;row[&amp;quot; .. field[&amp;quot;name&amp;quot;] .. &amp;quot;] = &amp;quot; .. row[i])&lt;br /&gt;
    else&lt;br /&gt;
      outputDebugString(&amp;quot;row[&amp;quot; .. field[&amp;quot;name&amp;quot;] .. &amp;quot;] = NULL&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    i = i + 1&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
mysql_free_result(result) -- Free the result&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;br /&gt;
'''Bold text'''&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_field&amp;diff=24965</id>
		<title>Modules/MTA-MySQL/mysql fetch field</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_fetch_field&amp;diff=24965"/>
		<updated>2011-01-05T18:02:22Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a table with information about a field in a query result. You can call repeatedly this function to return all the result fields, and when it reaches the end returns nil. You can also go to a specific field using [[Modules/MTA-MySQL/mysql_field_seek|mysql_field_seek()]].&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 mysql_fetch_field ( MySQLResult result )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A table with information about a field with the following keys:&lt;br /&gt;
* '''name:''' The name of this field.&lt;br /&gt;
* '''org_name:''' If you used aliases in the query, the original name of the field.&lt;br /&gt;
* '''table:''' The table of this field.&lt;br /&gt;
* '''org_table:''' If you used aliases for the table, the original name of the table.&lt;br /&gt;
* '''length:''' The maximum length allowed by this field in the table definition.&lt;br /&gt;
* '''max_length:''' The maximum length of this field in all the result rows.&lt;br /&gt;
* '''not_null:''' True if the field can't be NULL (See [[Modules/MTA-MySQL/mysql_null|mysql_null()]]).&lt;br /&gt;
* '''primary_key:''' True if the field is the table primary key.&lt;br /&gt;
* '''unique_key:''' True if the field value is unique.&lt;br /&gt;
* '''multiple_key:''' True if the field is part of a key.&lt;br /&gt;
* '''numeric:''' True if the field is numeric.&lt;br /&gt;
* '''blob:''' True if the field is a BLOB.&lt;br /&gt;
* '''unsigned:''' True if the field is unsigned.&lt;br /&gt;
* '''zerofill:''' True if the field is zero filled.&lt;br /&gt;
* '''type:''' A string representing the type of this field.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
'''Example 1:''' This example shows how to print the rows of a result set showing the field name.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT * FROM account&amp;quot;) -- Execute the query&lt;br /&gt;
for result,row in mysql_rows(result) do -- Iterate through all the result rows&lt;br /&gt;
  mysql_field_seek(result, 1) -- Reset the field cursor to the first field&lt;br /&gt;
  for k,v in ipairs(row) do&lt;br /&gt;
    local field = mysql_fetch_field(result) -- Retreive the field data&lt;br /&gt;
    if (v ~= mysql_null()) then&lt;br /&gt;
      outputDebugString(&amp;quot;row[&amp;quot; .. field[&amp;quot;name&amp;quot;] .. &amp;quot;] = &amp;quot; .. v)&lt;br /&gt;
    else&lt;br /&gt;
      outputDebugString(&amp;quot;row[&amp;quot; .. field[&amp;quot;name&amp;quot;] .. &amp;quot;] = NULL&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
mysql_free_result(result) -- Free the result&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_data_seek&amp;diff=24964</id>
		<title>Modules/MTA-MySQL/mysql data seek</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_data_seek&amp;diff=24964"/>
		<updated>2011-01-05T18:02:01Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Sets the row cursor of a result in the given row offset. The offset must be a value between '''1''' and '''[[Modules/MTA-MySQL/mysql_num_rows|mysql_num_rows()]]'''.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mysql_data_seek ( MySQLResult result, int offset )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''result:''' A valid MySQL result&lt;br /&gt;
* '''offset:''' A valid row offset&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function doesn't return any value.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_warning_count&amp;diff=24963</id>
		<title>Modules/MTA-MySQL/mysql warning count</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_warning_count&amp;diff=24963"/>
		<updated>2011-01-05T18:00:28Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the last query number of warnings&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_warning_count ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An integer showing the number of warning of the last query&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_stat&amp;diff=24962</id>
		<title>Modules/MTA-MySQL/mysql stat</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_stat&amp;diff=24962"/>
		<updated>2011-01-05T17:59:55Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a string containing information about the MySQL server current status.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_stat ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string containing information about the MySQL server current status.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_set_character_set&amp;diff=24961</id>
		<title>Modules/MTA-MySQL/mysql set character set</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_set_character_set&amp;diff=24961"/>
		<updated>2011-01-05T17:59:26Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Changes the character set used for the current MySQL session.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool mysql_set_character_set ( MySQLConnection handler, string charset_name )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
* '''charset_name:''' The new character set name&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
It it succeeds returns true, in other case returns false.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
handler = mysql_connect(&amp;quot;localhost&amp;quot;, &amp;quot;user&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;mta_users&amp;quot;)&lt;br /&gt;
if (not handler) then&lt;br /&gt;
  outputDebugString(&amp;quot;Unable to connect to the MySQL server&amp;quot;)&lt;br /&gt;
elseif (not mysql_set_character_set(handler, &amp;quot;utf8&amp;quot;)) then -- Change the charset to UTF-8&lt;br /&gt;
  outputDebugString(&amp;quot;Unable to change the connection character set to utf8: (&amp;quot;&lt;br /&gt;
                    .. mysql_errno(handler) .. &amp;quot;)&amp;quot; .. mysql_error(handler))&lt;br /&gt;
  mysql_close(handler) -- Close the connection afther the error&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_unbuffered_query&amp;diff=24960</id>
		<title>Modules/MTA-MySQL/mysql unbuffered query</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_unbuffered_query&amp;diff=24960"/>
		<updated>2011-01-05T17:59:03Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Executes an unbuffered query in the server and retreives the result.&lt;br /&gt;
&lt;br /&gt;
 '''IMPORTANT:''' It is '''strongly''' recommended to call [[Modules/MTA-MySQL/mysql_free_result|mysql_free_result]] after a query,&lt;br /&gt;
 specially if it returns some data. Query results can be automatically deleted&lt;br /&gt;
 by the lua garbage collector, so if you '''forget''' to free a result it will be&lt;br /&gt;
 freed at some time in the future, but it doesn't know the real result data size&lt;br /&gt;
 in memory so it can delay the memory destroying more than it should.&lt;br /&gt;
&lt;br /&gt;
 '''IMPORTANT:''' Unbuffered queries are to iterate a set of results improving the&lt;br /&gt;
 performance since they are not pre-loaded in memory, so if you execute an unbuffered&lt;br /&gt;
 query you '''must''' iterate all the result rows. For more information about unbuffered&lt;br /&gt;
 queries visit http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
MySQLResult mysql_unbuffered_query ( MySQLConnection handler, string query )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
* '''query:''' The executing query&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
In case of error this function returns nil. IF not, a MySQLResult handler. Check the MySQL result managing functions to see how to retreive the data from it.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_unbuffered_query(handler, &amp;quot;SELECT * FROM some_table&amp;quot;)&lt;br /&gt;
if (not result) then&lt;br /&gt;
  outputDebugString(&amp;quot;Error executing the query: (&amp;quot; .. mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler))&lt;br /&gt;
else&lt;br /&gt;
  local numrows = 0&lt;br /&gt;
  for result,row in mysql_rows(result) do -- We MUST iterate all the query resulting rows&lt;br /&gt;
    numrows = numrows + 1&lt;br /&gt;
  end&lt;br /&gt;
  outputDebugString(&amp;quot;The query returned a total of &amp;quot; .. numrows .. &amp;quot; rows&amp;quot;)&lt;br /&gt;
  mysql_free_result(result) -- Freeing the result is IMPORTANT&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
===Result managing functions===&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;br /&gt;
===MySQL handler functions===&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_query&amp;diff=24959</id>
		<title>Modules/MTA-MySQL/mysql query</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_query&amp;diff=24959"/>
		<updated>2011-01-05T17:45:37Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Executes a query in the server and retreives the result.&lt;br /&gt;
&lt;br /&gt;
 '''IMPORTANT:''' It is '''strongly''' recommended to call [[Modules/MTA-MySQL/mysql_free_result|mysql_free_result]] after a query,&lt;br /&gt;
 specially if it returns some data. Query results can be automatically deleted&lt;br /&gt;
 by the lua garbage collector, so if you '''forget''' to free a result it will be&lt;br /&gt;
 freed at some time in the future, but it doesn't know the real result data size&lt;br /&gt;
 in memory so it can delay the memory destroying more than it should.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
MySQLResult mysql_query ( MySQLConnection handler, string query )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
* '''query:''' The executing query&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
In case of error this function returns nil. IF not, a MySQLResult handler. Check the MySQL result managing functions to see how to retreive the data from it.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local result = mysql_query(handler, &amp;quot;SELECT * FROM some_table&amp;quot;)&lt;br /&gt;
if (not result) then&lt;br /&gt;
  outputDebugString(&amp;quot;Error executing the query: (&amp;quot; .. mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler))&lt;br /&gt;
else&lt;br /&gt;
  mysql_free_result(result) -- Freeing the result is IMPORTANT&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
===Result managing functions===&lt;br /&gt;
{{Modules/MTA-MySQL/Result_functions}}&lt;br /&gt;
===MySQL handler functions===&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_insert_id&amp;diff=24958</id>
		<title>Modules/MTA-MySQL/mysql insert id</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_insert_id&amp;diff=24958"/>
		<updated>2011-01-05T17:44:59Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the value generated for an AUTO_INCREMENT field in the last query.&lt;br /&gt;
&lt;br /&gt;
For more information about when is this value updated visit http://dev.mysql.com/doc/refman/5.0/en/mysql-insert-id.html&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_insert_id ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The value generated for an AUTO_INCREMENT field in the last query.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example creates an account for a player when they use /register, and tells them their database id.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function RegisterPlayer(playerSource, commandName, _password)&lt;br /&gt;
  local name = mysql_escape_string(handler, getPlayerName(playerSource)) -- Escape the strings to avoid SQL-Injection&lt;br /&gt;
  local password = mysql_escape_string(handler, _password)&lt;br /&gt;
  local query = &amp;quot;INSERT INTO account SET name='&amp;quot; .. name .. &amp;quot;', password=MD5('&amp;quot; .. password .. &amp;quot;')&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  if (mysql_query(handler, query)) then&lt;br /&gt;
    outputChatBox(&amp;quot;Account created successfuly with id #&amp;quot; .. mysql_insert_id(handler), playerSource)&lt;br /&gt;
  else&lt;br /&gt;
    outputChatBox(&amp;quot;An error has occured when trying to create your account.&amp;quot;, playerSource)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;register&amp;quot;, RegisterPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_info&amp;diff=24957</id>
		<title>Modules/MTA-MySQL/mysql info</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_info&amp;diff=24957"/>
		<updated>2011-01-05T17:44:41Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a string with information of the last executed query.&lt;br /&gt;
&lt;br /&gt;
For more information about the possible returned values please visit http://dev.mysql.com/doc/refman/5.0/en/mysql-info.html&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_info ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string with the last executed query information.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_hex_string&amp;diff=24956</id>
		<title>Modules/MTA-MySQL/mysql hex string</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_hex_string&amp;diff=24956"/>
		<updated>2011-01-05T17:44:23Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Converts a string to an hexadecimal representation of it. It is useful to insert binary data in blob fields, or to retreive and show it in your resources. It doesn't append '0x' or 'X' to the retreived string, the programmer must add it.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_hex_string ( string theString )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''theString:''' The string to convert&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An hexadecimal formatted string.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This function receives a string with a binary file content and stores it in a blob field of the database.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function savePlayerAvatar(playerName, imgRawData)&lt;br /&gt;
  local imgHexData = mysql_hex_string(imgRawData)&lt;br /&gt;
  mysql_query(handler, &amp;quot;UPDATE account SET avatar='0x&amp;quot; .. imgHexData .. &amp;quot;' WHERE name='&amp;quot; .. playerName .. &amp;quot;'&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_server_version&amp;diff=24955</id>
		<title>Modules/MTA-MySQL/mysql get server version</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_server_version&amp;diff=24955"/>
		<updated>2011-01-05T17:44:07Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a number that represents the MySQL server version in this format:&lt;br /&gt;
 major_version*10000 + minor_version *100 + sub_version&lt;br /&gt;
For example, 5.0.12 is returned as 50012.&lt;br /&gt;
&lt;br /&gt;
This function is useful in client programs for quickly determining whether some version-specific server capability exists. &lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_get_server_version( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An integer representing the MySQL server version.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_server_info&amp;diff=24954</id>
		<title>Modules/MTA-MySQL/mysql get server info</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_server_info&amp;diff=24954"/>
		<updated>2011-01-05T17:43:52Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a string that represents the server version number.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_get_server_info ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string that represents the server version number.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_proto_info&amp;diff=24953</id>
		<title>Modules/MTA-MySQL/mysql get proto info</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_proto_info&amp;diff=24953"/>
		<updated>2011-01-05T17:43:33Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns an integer representing the protocol version used by current connection.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_get_proto_info ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The protocol version used by current connection.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_host_info&amp;diff=24952</id>
		<title>Modules/MTA-MySQL/mysql get host info</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_host_info&amp;diff=24952"/>
		<updated>2011-01-05T17:43:15Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a string describing the type of connection in use, including the server hostname.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_get_host_info ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string describing the type of connection in use, including the server hostname.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_client_version&amp;diff=24951</id>
		<title>Modules/MTA-MySQL/mysql get client version</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_client_version&amp;diff=24951"/>
		<updated>2011-01-05T17:42:54Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns an integer that represents the client library version. The value has the format XYYZZ where X is the major version, YY  is the release level, and ZZ is the version number within the release level. For example, a value of 40102 represents a client library version of 4.1.2.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_get_client_version ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
An integer representing the client version.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_client_info&amp;diff=24950</id>
		<title>Modules/MTA-MySQL/mysql get client info</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_client_info&amp;diff=24950"/>
		<updated>2011-01-05T17:42:37Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns a string representing the client library version&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_get_client_info ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A string with the client library version&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_character_set_info&amp;diff=24949</id>
		<title>Modules/MTA-MySQL/mysql get character set info</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_get_character_set_info&amp;diff=24949"/>
		<updated>2011-01-05T17:42:14Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Retreives information about a character set&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string, string, string, string, int, int mysql_get_character_set_info ( MySQLConnection handler, string character_set_name )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
* '''character_set_name:''' The character set name&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The character set information:&lt;br /&gt;
* The charset name&lt;br /&gt;
* The charset collation&lt;br /&gt;
* The charset comment&lt;br /&gt;
* The charset directory&lt;br /&gt;
* Multi byte character min. length&lt;br /&gt;
* Multi byte character max. length&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local name, collation, comment, directory, mbminlen, mbmaxlen =&lt;br /&gt;
      mysql_get_character_set_info(handler, &amp;quot;utf8&amp;quot;) -- We will return information about the charset &amp;quot;utf8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
outputDebugString(&amp;quot;UTF-8 charset information:\n&amp;quot; ..&lt;br /&gt;
                  &amp;quot;name: &amp;quot; .. name .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
                  &amp;quot;collation: &amp;quot; .. collation .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
                  &amp;quot;comment: &amp;quot; .. comment .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
                  &amp;quot;directory: &amp;quot; .. directory .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
                  &amp;quot;mbminlen: &amp;quot; .. mbminlen .. &amp;quot;\n&amp;quot; ..&lt;br /&gt;
                  &amp;quot;mbmaxlen: &amp;quot; .. mbmaxlen)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_change_user&amp;diff=24948</id>
		<title>Modules/MTA-MySQL/mysql change user</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_change_user&amp;diff=24948"/>
		<updated>2011-01-05T17:41:54Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Changes the current MySQL session authentication.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool mysql_change_user ( MySQLConnection handler, string new_username, string new_password [, string new_database ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
* '''new_username:''' The new username&lt;br /&gt;
* '''new_password:''' The new username password&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''new_database:''' Start the new session using a new default database&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
It it succeeds returns true, in other case returns false&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function resourceStart ( resource )&lt;br /&gt;
  if (resouce == getThisResource()) then&lt;br /&gt;
    myhandler = mysql_connect(&amp;quot;localhost&amp;quot;, &amp;quot;writer_user&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;mta_users&amp;quot;) -- Start with a read-write username&lt;br /&gt;
    if (not myhandler) then&lt;br /&gt;
      outputDebugString(&amp;quot;Unable to connect to the database: (&amp;quot; .. mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler))&lt;br /&gt;
    else&lt;br /&gt;
      -- Apply some changes to the database here&lt;br /&gt;
      if (not mysql_change_user(myhandler, &amp;quot;localhost&amp;quot;, &amp;quot;reader_user&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;mta_users&amp;quot;)) then -- Change to a read-only user&lt;br /&gt;
        outputDebugString(&amp;quot;Unable to set the database read-only user: (&amp;quot; ..&lt;br /&gt;
                           mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler))&lt;br /&gt;
        mysql_close(myhandler) -- Close the MySQL connection&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;, getRootElement(), resourceStart)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_affected_rows&amp;diff=24947</id>
		<title>Modules/MTA-MySQL/mysql affected rows</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_affected_rows&amp;diff=24947"/>
		<updated>2011-01-05T17:41:29Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the number of changed rows (for UPDATE), inserted rows (for INSERT) or deleted rows (for DELETE) in the last query. For SELECT statements it works like [[Modules/MTA-MySQL/mysql_num_rows|mysql_num_rows]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_affected_rows ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The number of affected rows in the last query.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example shows the number of deleted rows after deleting all accounts starting with 'A'&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
mysql_query(handler, &amp;quot;DELETE FROM account WHERE name LIKE 'A%'&amp;quot;)&lt;br /&gt;
outputDebugString(&amp;quot;We deleted a total of &amp;quot; .. mysql_affected_rows(handle) .. &amp;quot; accounts starting with 'A'&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_escape_string&amp;diff=24946</id>
		<title>Modules/MTA-MySQL/mysql escape string</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_escape_string&amp;diff=24946"/>
		<updated>2011-01-05T17:41:09Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Escapes a query string to avoid sql injection attacks. This function should be used for every executed query that uses any data given by the players.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_escape_string( MySQLConnection handler, string theString )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
* '''theString:''' The string to escape&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The escaped string&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example returns some offline player cash getting it from the database&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function checkOfflineMoney(playerSource, commandName, targetName)&lt;br /&gt;
  local escapedName = mysql_escape_string(handler, targetName) -- Escape the string to avoid security holes&lt;br /&gt;
  local result = mysql_query(handler, &amp;quot;SELECT money FROM account WHERE name='&amp;quot; .. escapedName .. &amp;quot;'&amp;quot;)&lt;br /&gt;
  if (not result) then&lt;br /&gt;
    outputDebugString(&amp;quot;mysql_query failed: (&amp;quot; .. mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler)) -- Some error occurred&lt;br /&gt;
  else&lt;br /&gt;
    if (mysql_num_rows(result) == 0) then outputChatBox(&amp;quot;Account not found&amp;quot;, playerSource) -- We haven't results with that name&lt;br /&gt;
    else outputChatBox(&amp;quot;The player has &amp;quot; .. mysql_result(result, 1, 1) .. &amp;quot;$&amp;quot;, playerSource) end -- Send the money information&lt;br /&gt;
    mysql_free_result(result) -- Free the query result&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;offlinecash&amp;quot;, checkOfflineMoney)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_select_db&amp;diff=24945</id>
		<title>Modules/MTA-MySQL/mysql select db</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_select_db&amp;diff=24945"/>
		<updated>2011-01-05T17:40:50Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Changes the current default database.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool mysql_select_db ( MySQLConnection handler, string database )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
* '''database:''' The new database name&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
It it succeeds returns true, in other case returns false&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example changes the current default database to another one&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handler = mysql_connect(&amp;quot;localhost&amp;quot;, &amp;quot;user&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;mta_users&amp;quot;)&lt;br /&gt;
if ( not mysql_select_db(handler, &amp;quot;another_database&amp;quot;) ) then&lt;br /&gt;
  outputDebugString(&amp;quot;Unable to change default database: (&amp;quot; .. mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler))&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_ping&amp;diff=24944</id>
		<title>Modules/MTA-MySQL/mysql ping</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_ping&amp;diff=24944"/>
		<updated>2011-01-05T17:40:33Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Checks if the given MySQL connection is still alive.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool mysql_ping ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
true is the connection is still alive, false if not.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example checks if the MySQL connection is still alive when a player connects, to be able to fetch their data.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
myhandler = mysql_connect(&amp;quot;localhost&amp;quot;, &amp;quot;user&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;mta_users&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
function checkMySQLConnection ( )&lt;br /&gt;
  if (mysql_ping(myhandler) == false) then -- We lost the connection to the MySQL server&lt;br /&gt;
    outputDebugString(&amp;quot;Lost connection to the MySQL server, reconnecting ...&amp;quot;)&lt;br /&gt;
    mysql_close(myhandler)&lt;br /&gt;
    myhandler = mysql_connect(&amp;quot;localhost&amp;quot;, &amp;quot;user&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;mta_users&amp;quot;) -- Reconnect to the MySQL server&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), checkMySQLConnection)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_error&amp;diff=24943</id>
		<title>Modules/MTA-MySQL/mysql error</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_error&amp;diff=24943"/>
		<updated>2011-01-05T17:39:51Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the last error string of a MySQL connection.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string mysql_error ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The last error string. Visit http://dev.mysql.com/doc/refman/5.0/en/error-handling.html for a list of error codes.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example sends a query to the server and if it fails, shows the reason.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
result = mysql_query(handler, &amp;quot;SELECT FROM table&amp;quot;) -- We have a syntax error in the query&lt;br /&gt;
if (not result) then -- The query failed&lt;br /&gt;
  outputDebugString(&amp;quot;mysql_query failed: (&amp;quot; .. mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler)) -- Show the reason&lt;br /&gt;
else&lt;br /&gt;
  mysql_free_result(result) -- Free the last query result data&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_errno&amp;diff=24942</id>
		<title>Modules/MTA-MySQL/mysql errno</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Modules/MTA-MySQL/mysql_errno&amp;diff=24942"/>
		<updated>2011-01-05T17:39:29Z</updated>

		<summary type="html">&lt;p&gt;Alberto Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;#AA7592&amp;quot; subcaption=&amp;quot;MTA-MySQL Module&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{ModuleFunction|MTA-MySQL}}&lt;br /&gt;
Returns the last error number of a MySQL connection.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int mysql_errno ( MySQLConnection handler )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''handler:''' A valid MySQL link&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
The last error number, zero if nothing failed. Visit http://dev.mysql.com/doc/refman/5.0/en/error-handling.html for a list of error codes.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example sends a query to the server and if it fails, shows the reason.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
result = mysql_query(handler, &amp;quot;SELECT FROM table&amp;quot;) -- We have a syntax error in the query&lt;br /&gt;
if (not result) then -- The query failed&lt;br /&gt;
  outputDebugString(&amp;quot;mysql_query failed: (&amp;quot; .. mysql_errno(handler) .. &amp;quot;) &amp;quot; .. mysql_error(handler)) -- Show the reason&lt;br /&gt;
else&lt;br /&gt;
  mysql_free_result(result) -- Free the last query result data&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Modules/MTA-MySQL/Handler_functions}}&lt;/div&gt;</summary>
		<author><name>Alberto Alonso</name></author>
	</entry>
</feed>