M MY Multiplayer: Wiki
Side
Kind

getElementComponentPosition

Client

Returns the position of a vehicle's or object's component.

float, float, float|false getElementComponentPosition(vehicle|object element, string component [, string base = "root"])

Parameters

NameTypeDescription
elementvehicle|objectThe vehicle or object.
componentstringThe component's name, as getElementComponents lists it.
basestringRelative to what: "world", "root" (the element itself) or "parent" (the component's parent frame). Case does not matter.default "root"

Returns

Three numbers x, y, z, or false if the component does not exist.

Example

local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
    local x, y, z = getElementComponentPosition(vehicle, "bonnet_dummy", "world")
    if x then
        outputDebugString(("Bonnet at %.1f, %.1f, %.1f"):format(x, y, z))
    end
end
Coming from MTAThe same as MTA's getVehicleComponentPosition, but it also works on objects.

See also