<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/FindEmptyCarSeat?action=history&amp;feed=atom</id>
	<title>FindEmptyCarSeat - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/FindEmptyCarSeat?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FindEmptyCarSeat&amp;action=history"/>
	<updated>2026-04-10T13:21:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FindEmptyCarSeat&amp;diff=64861&amp;oldid=prev</id>
		<title>Tails: Created page with &quot;{{Useful Function}} &lt;lowercasetitle&gt;&lt;/lowercasetitle&gt; __NOTOC__ This function allows you to find the first empty seat in a vehicle. Returns false if it did not find an empty s...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FindEmptyCarSeat&amp;diff=64861&amp;oldid=prev"/>
		<updated>2020-01-05T05:00:10Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Useful Function}} &amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt; __NOTOC__ This function allows you to find the first empty seat in a vehicle. Returns false if it did not find an empty s...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to find the first empty seat in a vehicle. Returns false if it did not find an empty seat.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;int findEmptyCarSeat( vehicle vehicle )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''vehicle''': a vehicle element&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns seat number if there is a seat available, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client/Server&amp;quot; class=&amp;quot;generic&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function findEmptyCarSeat(vehicle)&lt;br /&gt;
    local max = getVehicleMaxPassengers(vehicle)&lt;br /&gt;
    local pas = getVehicleOccupants(vehicle)&lt;br /&gt;
    for i=1, max do&lt;br /&gt;
        if not pas[i] then&lt;br /&gt;
            return i&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return false&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client/Server&amp;quot; class=&amp;quot;both&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;
local vehicle = getPedOccupiedVehicle(localPlayer)&lt;br /&gt;
local seat = findEmptyCarSeat(vehicle)&lt;br /&gt;
if seat then&lt;br /&gt;
    warpPedIntoVehicle(vehicle, seat)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Tails</name></author>
	</entry>
</feed>