Skip to content

Client Exports

Advanced Bus Job v1.2.0 does not expose a stable public gameplay API. Its network events and ox_lib callbacks are internal, server-validated mission messages and are not supported integration points.

IsPathBaking() exists for the internal route-art development tool:

local active = exports['lx-busjob']:IsPathBaking()

Do not build production resources around it; it may change between releases.

local framework = exports['lx-lib']:GetFramework()
-- 'qbx' | 'qb' | 'esx' | nil
local inventory = exports['lx-lib']:GetInventory()
-- 'ox_inventory' | 'qb-inventory' | nil
exports['lx-lib']:Notify('Shift started', 'success', 5000)

Parameters: message: string, type?: string, duration?: number. Uses ox_lib notify when available and falls back to a native GTA notification.

exports['lx-lib']:OnPlayerLoaded(function()
print('The local character is ready')
end)

Registers a persistent callback. It normalizes Qbox, QB-Core, and ESX character-loaded events, fires once per character-ready cycle, resets on character unload, and fires again after the next login. Late registration is supported (runs on the next tick if already ready). After a resource restart, lx-lib checks for an already-loaded character for up to 15 seconds. Callback errors are isolated with pcall.

All navigation exports are client-side only.

Treat lx-navigation as one active player-facing route at a time. Multiple session IDs can exist in the registry, but GPS blip and HUD presentation are singleton — starting or stopping one visual route can replace or clear another route’s blip/HUD.

local routeId = exports['lx-navigation']:StartRoute({
profile = 'bus',
label = 'Metro Link',
routeNumber = 'LST-01',
stops = {
{ coords = vec3(303.9, -765.2, 28.3), label = 'Power Street', heading = 71.7 },
{ coords = vec3(115.4, -781.3, 30.4), label = 'Pillbox', heading = -20.0 },
},
displayStopIndex = 1,
displayStopCount = 2,
gpsColour = 5,
hud = true,
onStatus = function(status, data)
-- only fires for accepted recalculation enter/exit in v2.0.0
print(status, data.distToDest)
end,
})

Returns a numeric session ID. Raises an error if neither a non-empty stops array nor destination is provided.

Important options:

Option Type Meaning
profile string Named thresholds from config (bus default; unknown → vehicle)
stops table[] vector3, vector4, or { coords, label, heading } stops
destination vector3/table Single destination alternative
label / routeName string HUD route label
routeNumber string HUD route number
stopIndex number Initial stop index
displayStopIndex number HUD display index (can differ from internal stop index)
displayStopCount number HUD display stop count
gpsColour number Per-route GPS / blip colour override
hud boolean Set false to hide the navigation HUD
holding boolean Start with route progression held
blacklist table[] Spatial exclusion zones { coords, radius } for pathing
maxPoints / simplifyMeters number Per-route path overrides
destinationArriveMeters / waypointArriveMeters / offRouteMeters number Per-route threshold overrides
stuckMs / recalcCooldownMs / firstRecoveryMs / recalcFailRetryMs / recalcVisualGapMs number Per-route recovery/recalc timing overrides
onStatus function See below — not an all-status observer

mode is not a supported option. Even if a caller passes mode = 'guide', the runtime always sets mode = 'guide' internally and ignores the argument.

onStatus is called with ('recalculating', status) when entering recalculation and later ('following', status) when returning after an accepted recalculation. It is not called on initial following, arrived, complete, holding changes, or route stop.

local status = exports['lx-navigation']:Tick(routeId)

Required. Updates route projection, arrival, and rerouting. The internal guidance loop (≈150 ms) only refreshes turn instructions / HUD presentation — it does not progress the route. Soft-limited by the configured minimum tick interval. Returns the same status table as GetStatus, or nil for an unknown session.

local status = exports['lx-navigation']:GetStatus(routeId)

Returns nil for an unknown session, otherwise:

{
id = 1,
status = 'following', -- normally following | recalculating | arrived | complete
mode = 'guide',
index = 0, -- path cursor index
pathLen = 64,
pathLength = 1200.5,
pathRemain = 982.1,
distToDest = 125.4,
label = 'Power Street',
destination = vector3(...),
stopIndex = 1,
stopCount = 2,
lastRecalcReason = nil,
upcoming = {}, -- current maneuver payload (shape varies by guidance source)
guidanceSource = '...',
nativeDirectionCode = nil,
routeLabel = 'Metro Link',
routeNumber = 'LST-01',
holding = false,
}

Observable statuses are normally following, recalculating, arrived, and complete. routing is an internal construction state in v2.0.0 — path generation finishes before the session is registered, so callers almost never observe it.

local accepted = exports['lx-navigation']:Recalculate(routeId, 'manual') -- boolean: request accepted, not completed
local advanced = exports['lx-navigation']:AdvanceStop(routeId) -- boolean
exports['lx-navigation']:SetDestination(routeId, vec3(...)) -- no return
exports['lx-navigation']:SetHolding(routeId, true) -- no return
exports['lx-navigation']:StopRoute(routeId) -- no return

Behavior notes:

  • Holding pauses Tick progression and also pauses fast guidance refresh. Arrival clears holding. Successful recalculation clears holding.
  • Arrival does not advance stops automatically. While arrived, the session stays locked until the player leaves ~1.35× arrival radius or exceeds ~6 m/s.
  • AdvanceStop: unknown session → false; on the final stop → sets status to complete then returns false; otherwise advances and returns whether recalculation to the next stop was accepted.
  • Recalculate is asynchronous; the boolean means the request was accepted, not that a new path is ready.
local maneuver = exports['lx-navigation']:GetUpcomingManeuver(routeId) -- table | nil
local progress = exports['lx-navigation']:GetTripProgress(routeId) -- table | nil

GetTripProgress returns { index, label, state } entries where state is done, current, or upcoming.

local result = exports['lx-navigation']:calculatePath(startPos, endPos, {
maxPoints = 64,
simplifyMeters = 12.0,
candidateCount = 8,
nodeFlags = nil,
destinationArriveMeters = 18.0,
blacklist = {
{ coords = vec3(...), radius = 25.0 },
},
})
print(result.length)
for _, point in ipairs(result.path) do
print(point)
end
local length = exports['lx-navigation']:calculatePathLength(startPos, endPos, opts)

Path calculation uses GTA vehicle nodes and returns { path: vector3[], length: number }. calculatePathLength accepts the same optional opts and delegates to the same calculator.

exports['lx-navigation']:SetDebug(true) -- no return

For development only. Do not leave debug drawing enabled in production.