<?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=Jpx</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=Jpx"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Jpx"/>
	<updated>2026-04-25T20:18:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetGarageBoundingBox&amp;diff=31935</id>
		<title>GetGarageBoundingBox</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetGarageBoundingBox&amp;diff=31935"/>
		<updated>2012-07-17T20:43:19Z</updated>

		<summary type="html">&lt;p&gt;Jpx: added example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{client function}}&lt;br /&gt;
This function outputs the bounding box of a garage. &lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float, float getGarageBoundingBox ( int garageID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''garageID:''' The [[Garage|garage ID]] that represents the garage door that is being checked.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns four ''float''s indicating the bounding box of the garage.&lt;br /&gt;
''Western X position, Eastern X position, Southern Y position, Northern Y position.''&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Checks if the player is inside the bounding box of the garage and outputs the result to the chat&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function garageCheck ( command, garageID )&lt;br /&gt;
	if not garageID then&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local west, east, south, north = getGarageBoundingBox ( garageID ) --get the bounding box of the specified garage&lt;br /&gt;
	local x, y, z = getElementPosition ( getLocalPlayer ( ) ) --get the position of the player&lt;br /&gt;
	&lt;br /&gt;
	if x &amp;gt; west and x &amp;lt; east and y &amp;gt; south and y &amp;lt; north then --check if the player is inside the bounding box&lt;br /&gt;
		outputChatBox ( &amp;quot;You are inside the garage&amp;quot; )&lt;br /&gt;
	else&lt;br /&gt;
		outputChatBox ( &amp;quot;You are outside the garage&amp;quot; )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler ( &amp;quot;garagecheck&amp;quot;, garageCheck )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{World functions}}&lt;/div&gt;</summary>
		<author><name>Jpx</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=ExecuteSQLSelect&amp;diff=31914</id>
		<title>ExecuteSQLSelect</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=ExecuteSQLSelect&amp;diff=31914"/>
		<updated>2012-07-15T19:33:23Z</updated>

		<summary type="html">&lt;p&gt;Jpx: fixed a typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
This function retrieves rows from a table in the database, if they exist. If you pass the table name, along with the columns you want to retrieve (and any conditions for the row) this function will return a table containing the corresponding values.&lt;br /&gt;
&lt;br /&gt;
The SQLite database contains globally stored data and can be used by scripts to store and retrieve data in a structured manner.&lt;br /&gt;
&lt;br /&gt;
The executed SQL query is the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;[sql]SELECT &amp;lt;fields&amp;gt; FROM &amp;lt;tables&amp;gt; WHERE &amp;lt;conditions&amp;gt; LIMIT &amp;lt;limit&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table executeSQLSelect ( string tableName, string fields, [ string conditions, int limit ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''tableName:''' The table you want to query. No spaces allowed.&lt;br /&gt;
*'''fields:''' The fields you want to query. No spaces allowed. Multiple fields should be separated by a comma (,). Wildcard (*) allowed to query all fields in the table. If you use wildcards, please pay attention to the order in which you'll have to retrieve your values from the table.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''conditions:''' The conditions for the query. Multiple conditions should be separated by logical operators (AND, OR).&lt;br /&gt;
*'''limit:''' Maximum amount of rows to return.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a 2-dimensional table where the results are stored as table [row_index] [column_name]. Please note that table may be empty.&lt;br /&gt;
&lt;br /&gt;
If invalid arguments were passed, returns ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example creates a SQL table when a map loads, and stores info about a player to that database when he spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onMapLoad ()&lt;br /&gt;
	-- create our table, if it doesn't already exist&lt;br /&gt;
	executeSQLCreateTable ( &amp;quot;players&amp;quot;, &amp;quot;clothes_head_texture TEXT, clothes_head_model TEXT, player TEXT&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onGamemodeMapStart&amp;quot;, getRootElement(), onMapLoad )&lt;br /&gt;
&lt;br /&gt;
function addInfoToSQL( theSpawnpoint, theTeam )	&lt;br /&gt;
	sourcename = getPlayerName ( source )	-- get the player's name&lt;br /&gt;
	&lt;br /&gt;
	-- try to retrieve the player data from the db&lt;br /&gt;
	result = executeSQLSelect ( &amp;quot;players&amp;quot;, &amp;quot;player&amp;quot;, &amp;quot;player = '&amp;quot; .. sourcename .. &amp;quot;'&amp;quot; )&lt;br /&gt;
	if ( type( result ) == &amp;quot;table&amp;quot; and #result == 0 ) or not result then -- see if any data was found at all&lt;br /&gt;
		outputChatBox ( &amp;quot;This is your first time here! Welcome &amp;quot; .. sourcename .. &amp;quot;!&amp;quot;, source )&lt;br /&gt;
		executeSQLInsert ( &amp;quot;players&amp;quot;, &amp;quot;'none', 'none', '&amp;quot; .. sourcename .. &amp;quot;'&amp;quot; )&lt;br /&gt;
	else&lt;br /&gt;
		outputChatBox ( &amp;quot;Welcome back &amp;quot; .. sourcename .. &amp;quot;!&amp;quot;, source )&lt;br /&gt;
		executeSQLUpdate ( &amp;quot;players&amp;quot;, &amp;quot;clothes_head_texture = 'hairgreen', clothes_head_model = 'somehead'&amp;quot;,&lt;br /&gt;
		&amp;quot;player = '&amp;quot; .. sourcename .. &amp;quot;'&amp;quot; )&lt;br /&gt;
	end	&lt;br /&gt;
	&lt;br /&gt;
	-- get the clothes data for the player&lt;br /&gt;
	result = executeSQLSelect ( &amp;quot;players&amp;quot;, &amp;quot;clothes_head_texture, clothes_head_model&amp;quot;, &amp;quot;player = '&amp;quot; .. sourcename .. &amp;quot;'&amp;quot; )&lt;br /&gt;
	outputChatBox ( &amp;quot;Your head texture is &amp;quot; .. result[1].clothes_head_texture )&lt;br /&gt;
	outputChatBox ( &amp;quot;Your head model is &amp;quot; .. result[1]['clothes_head_model'] )	&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, getRootElement(), addInfoToSQL )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Registry_functions}}&lt;br /&gt;
[[ru:executeSQLSelect]]&lt;/div&gt;</summary>
		<author><name>Jpx</name></author>
	</entry>
</feed>