Skip to content

A3D_MeasureRoute

imshooter edited this page Oct 23, 2026 · 1 revision

Measure the best route between two points without keeping it, which is faster than finding it.

native bool:A3D_MeasureRoute(
    Float:fromX,
    Float:fromY,
    Float:fromZ,
    Float:toX,
    Float:toY,
    Float:toZ,
    &Float:length,
    &Float:time,
    A3D_ROUTE:type = A3D_ROUTE_FASTEST,
    Float:heading = -1.0,
    Float:reach = 300.0
);

Parameters

Parameter Description Default
Float:fromX Start on the X axis.
Float:fromY Start on the Y axis.
Float:fromZ Start on the Z axis.
Float:toX End on the X axis.
Float:toY End on the Y axis.
Float:toZ End on the Z axis.
&Float:length Length of the route, in metres.
&Float:time Time the route takes, in seconds.
A3D_ROUTE:type How the route weighs the paths. A3D_ROUTE_FASTEST
Float:heading Direction the vehicle faces at the start, or -1.0 for none. -1.0
Float:reach How far from each end to look for a path, in metres. 300.0

Returns

  • true when a route was found.
  • false when no path is within reach, or the ends are not connected.

Remarks

It finds the route as A3D_FindRoute does, but keeps no points, which makes it about three times faster. It suits prices, rankings and checks that need only a number.

Example

Tells the price and the time of a taxi ride before it starts.

stock QuoteFare(playerid, Float:x, Float:y, Float:z) {
    new
        Float:fromX,
        Float:fromY,
        Float:fromZ,
        Float:length,
        Float:time,
        message[80]
    ;

    GetPlayerPos(playerid, fromX, fromY, fromZ);

    if (!A3D_MeasureRoute(fromX, fromY, fromZ, x, y, z, length, time)) {
        SendClientMessage(playerid, -1, "No road leads there.");

        return;
    }

    format(message, sizeof (message), "The ride costs $%i and takes about %i minutes.", 50 + floatround(length / 20.0), floatround(time / 60.0, floatround_ceil));
    SendClientMessage(playerid, -1, message);
}

Related

  • A3D_FindRoute: Find the best route between two points along the paths of the game.
  • A3D_FindNearestByRoute: Find which of several points the best route from a point reaches first, such as the nearest hospital by road rather than in a straight line.
  • A3D_GetRouteLength: Length of a route, in metres.

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