Skip to content

A3D_OnRouteAdvanced

imshooter edited this page Oct 23, 2026 · 1 revision

A player moved along the route shown to them: the next turn or the distance to it changed.

It comes at most five times a second, when the next turn changes or the distance to it passes a multiple of ten metres, and not while the player is away from the route. It suits a text that tells the next turn without a timer.

public A3D_OnRouteAdvanced(
    playerid,
    Route:routeid,
    Float:remaining,
    A3D_TURN:turn,
    Float:turnDistance
)

Parameters

Parameter Description
playerid Player shown the route.
Route:routeid Route they follow.
Float:remaining Distance left to the end of the route, in metres.
A3D_TURN:turn The next turn, or A3D_TURN_NONE when the end comes next.
Float:turnDistance Distance to the next turn, or to the end when none is left.

Remarks

The component checks five times a second and calls it when the next turn changes or the distance to it passes a multiple of ten metres, so a text with the next turn needs no timer. The first call comes at the first check after the route is shown, and none comes while the player is away from the route. It is called in the script that found the route, and its return value is not used.

Example

Writes the next turn in a textdraw of the player.

static PlayerText:gTurnText[MAX_PLAYERS];

static const gTurnName[A3D_TURN][] = {
    "Arrive",
    "Keep left",
    "Turn left",
    "Sharp left",
    "Keep right",
    "Turn right",
    "Sharp right",
    "Turn back"
};

public A3D_OnRouteAdvanced(playerid, Route:routeid, Float:remaining, A3D_TURN:turn, Float:turnDistance) {
    new
        text[64]
    ;

    format(text, sizeof (text), "%s in %i m~n~%.1f km to go", gTurnName[turn], floatround(turnDistance), remaining / 1000.0);
    PlayerTextDrawSetString(playerid, gTurnText[playerid], text);

    return 1;
}

Related

  • A3D_ShowRouteForPlayer: Show a route on the radar and the map of a player as a line, which moves on as they go.
  • A3D_GetRouteProgress: Find where a point is along a route: the distance left, the distance from the route and the next turn.
  • A3D_OnRouteLeft: A player strayed from the route shown to them.

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