Repository navigation
A3D_OnRouteAdvanced
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
)| 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. |
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.
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;
}- 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.
3DAndreas 0.7.1 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Physics objects
- Model settings
- World queries
- The screen
- Routes
- Navigation mesh
- Map database
- Coming from ColAndreas
- Performance
Reference
Functions