Skip to content

A3D_OnRouteLeft

imshooter edited this page Oct 23, 2026 · 2 revisions

A player strayed from the route shown to them.

A player strays when they are 30 metres farther from the route than the nearest they have been to it, so a route shown to a player who is away from it, as in a car park beside the road, waits until they move off. It is not called again until they come back within 15 metres of that distance.

public A3D_OnRouteLeft(playerid, Route:routeid, Float:distance)

Parameters

Parameter Description
playerid Player who strayed.
Route:routeid Route they left.
Float:distance Distance from the player to the route.

Remarks

The component checks five times a second. The callback comes once when the player is 30 metres farther from the route than the nearest they have been to it, and not again until they come back within 15 metres of that distance. So a route shown to a player who is away from it, as in a car park beside the road, waits until they move off instead of calling it at once. A new route from where the player is, as a GPS finds, brings them back. It is called in the script that found the route.

Example

Finds the way again from where the player strayed.

static Float:gDestination[MAX_PLAYERS][3];

public A3D_OnRouteLeft(playerid, Route:routeid, Float:distance) {
    new
        Float:x,
        Float:y,
        Float:z,
        Route:found
    ;

    GetPlayerPos(playerid, x, y, z);
    found = A3D_FindRoute(x, y, z, gDestination[playerid][0], gDestination[playerid][1], gDestination[playerid][2]);

    if (found == INVALID_ROUTE_ID) {
        return 1;
    }

    A3D_ShowRouteForPlayer(playerid, found);
    A3D_DestroyRoute(routeid);

    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_OnRouteArrived: A player reached the end of the route shown to them. The route stays on the map until it is hidden or destroyed.
  • A3D_FindRoute: Find the best route between two points along the paths of the game.

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