Skip to content

A3D_GetVehiclePartPosition

imshooter edited this page Oct 17, 2026 · 1 revision

Find where a part of a vehicle lies in the world, such as the boot for a player to open it or the petrol cap to refuel.

Parts come from the size of the model and the places the game gives for its seats, wheels and petrol cap. Bumpers lie at the ends of the box at the height the game gives them, doors on its sides at the height of the seats, and the driver sits on the left.

native bool:A3D_GetVehiclePartPosition(vehicleid, A3D_PART:part, &Float:x, &Float:y, &Float:z);

Parameters

Parameter Description
vehicleid Vehicle to read.
A3D_PART:part Part to find.
&Float:x Position of the part on the X axis.
&Float:y Position on the Y axis.
&Float:z Position on the Z axis.

Returns

  • true when the position was written.
  • false when there is no such vehicle, or its model lacks the part.

Remarks

The places come from the data the game gives each model: its size, the places of the front and rear seats, of the wheels and of the petrol cap, and the heights of the bumpers. Vehicle parts tells how each part is placed.

A model without the part returns false, such as a vehicle with no rear seats, no middle wheels or no petrol cap.

Example

Lets a player refuel only next to the petrol cap.

stock bool:IsAtPetrolCap(playerid, vehicleid) {
    new
        Float:x,
        Float:y,
        Float:z
    ;

    if (!A3D_GetVehiclePartPosition(vehicleid, A3D_PART_PETROL_CAP, x, y, z)) {
        return false;
    }

    return GetPlayerDistanceFromPoint(playerid, x, y, z) < 1.5;
}

Related

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Routes
Route display
Walking
Callbacks

Clone this wiki locally