<?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=Qystishere</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=Qystishere"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Qystishere"/>
	<updated>2026-04-20T13:12:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=80672</id>
		<title>GetVehicleEntryPoints</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleEntryPoints&amp;diff=80672"/>
		<updated>2024-10-11T06:43:29Z</updated>

		<summary type="html">&lt;p&gt;Qystishere: Added the argument name for the vehicle to the function syntax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}} &lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0161|1.6.0|22649| &lt;br /&gt;
This function returns a table containing the positions to 4 possible entry points to a vehicle. This function can be used alongside [[setPedEnterVehicle]] to make a ped enter a specific seat by first moving the ped to a entry point retrieved through '''getVehicleEntryPoints''' and then using [[setPedEnterVehicle]] to make them enter.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This does not directly relate to the amount of doors a vehicle has as vehicles with two doors can have multiple entry points to the same door.}}&lt;br /&gt;
{{Note|The vehicle needs to be streamed in for this function to work.}}&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 getVehicleEntryPoints ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{{OOP||[[vehicle]]:getEntryPoints}}&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''vehicle''': The vehicle from which we want to get entry points.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
If the vehicle has entry points, it returns a table containing the positions of the 4 possible entry points to the vehicle, otherwise it returns ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
'''Example 1''': This example renders 3D (''text &amp;amp; circle'') on each '''streamed-in''' vehicle entry point&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;, root, function()&lt;br /&gt;
    for _, vehicle in pairs(getElementsByType(&amp;quot;vehicle&amp;quot;, root, true)) do&lt;br /&gt;
        local entryX, entryY, entryZ = getElementPosition(vehicle) &lt;br /&gt;
        for index, position in pairs(getVehicleEntryPoints(vehicle)) do&lt;br /&gt;
            local drawX, drawY, distance = getScreenFromWorldPosition(&lt;br /&gt;
                position[1], position[2], position[3], 100&lt;br /&gt;
            )&lt;br /&gt;
&lt;br /&gt;
            if (drawX ~= false) then&lt;br /&gt;
                local cameraX, cameraY, cameraZ = getCameraMatrix()&lt;br /&gt;
&lt;br /&gt;
                dxDrawCircle(drawX, drawY, 8 / (distance * 0.1), 0, 360, tocolor(255, 0, 0, 255))&lt;br /&gt;
                dxDrawText(tostring(index), drawX, drawY + ((8 / (distance * 0.1)) / 2) + ((2 / (distance * 0.1)) + 0.5), 0, 0, tocolor(255, 0, 0, 255),&lt;br /&gt;
                    3 / (distance * 0.1), &amp;quot;default-bold&amp;quot;)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2''': This example checks if the player is near the vehicle door to ''enter''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientVehicleStartEnter&amp;quot;, root, function(thePlayer, seat, door)&lt;br /&gt;
    if thePlayer == localPlayer then&lt;br /&gt;
        local entryPoints = getVehicleEntryPoints(source)&lt;br /&gt;
        if entryPoints then&lt;br /&gt;
            local entryPoint = entryPoints[door + 1]&lt;br /&gt;
            if entryPoint then&lt;br /&gt;
                local distance = getDistanceBetweenPoints3D(Vector3(getElementPosition(localPlayer)), unpack(entryPoint))&lt;br /&gt;
                if distance &amp;gt; 2.5 then&lt;br /&gt;
                    outputChatBox(&amp;quot;You are too far away from the door to enter this vehicle!&amp;quot;)&lt;br /&gt;
                    cancelEvent()&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Qystishere</name></author>
	</entry>
</feed>