ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getPlayerWaypointRoute

Function

getPlayerWaypointRoute

ClientBlipsTrilogy Hub only

Returns the game's GPS route to the waypoint, the line shown on the radar, as a list of points and a length in metres. The game computes a road route only while the player is in a vehicle.

Syntax

table getPlayerWaypointRoute([bool withZ = false])

Arguments

withZbool, optional = false
true = every point also gets z (ground height).

Returns

points, length: a table of {x = , y = [, z = ]} and the length in metres; false if there is no route.

Example

The GPS route drawn in the world.

local route = false
addEventHandler("onClientWaypointRouteUpdate", localPlayer, function(hasRoute)
    route = hasRoute and getPlayerWaypointRoute(true) or false
end)

addEventHandler("onClientRender", root, function()
    if not route then return end
    for i = 2, #route do
        local a, b = route[i - 1], route[i]
        dxDrawLine3D(a.x, a.y, a.z + 0.5, b.x, b.y, b.z + 0.5, tocolor(80, 160, 255), 6)
    end
end)

Notes

There may be gaps between parts of the route - then draw lines only between neighbouring points, as in the example.

See also