getVehicleEntryPoints | Multi Theft Auto: Wiki Skip to content

getVehicleEntryPoints

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


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.

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.

Note

The vehicle needs to be streamed in for this function to work.

Syntax

getVehicleEntryPoints ( )

Code Examples

client

Example 1: This example renders 3D (text & circle) on eachstreamed-invehicle entry point

addEventHandler("onClientRender", root, function()
for _, vehicle in pairs(getElementsByType("vehicle", root, true)) do
local entryX, entryY, entryZ = getElementPosition(vehicle)
for index, position in pairs(getVehicleEntryPoints(vehicle)) do
local drawX, drawY, distance = getScreenFromWorldPosition(
position[1], position[2], position[3], 100
)
if (drawX ~= false) then
local cameraX, cameraY, cameraZ = getCameraMatrix()
dxDrawCircle(drawX, drawY, 8 / (distance * 0.1), 0, 360, tocolor(255, 0, 0, 255))
dxDrawText(tostring(index), drawX, drawY + ((8 / (distance * 0.1)) / 2) + ((2 / (distance * 0.1)) + 0.5), 0, 0, tocolor(255, 0, 0, 255),
3 / (distance * 0.1), "default-bold")
end
end
end
end)

See Also

Vehicle Functions