Exports & API

Exports & API

legends_autopilot does not expose any developer exports. The resource is controlled entirely through its UI panel and chat command.

Commands

/autopilot

Toggles the autopilot UI panel. When the panel is open, players can configure settings and start/stop autopilot.

Default Command: /autopilot

Usage: Type in chat or bind to a key via FiveM settings.

The command name can be changed in config.lua via Config.Command.


Cancel Controls

Autopilot can be cancelled at any time using:

InputControlBehavior
SVehicle BrakeCancels autopilot, applies brake
SPACEVehicle HandbrakeCancels autopilot, applies brake
/autopilotCommandOpens UI (autopilot continues until stopped via UI)

Player Settings Storage

Player settings (speed, driving style, stopping distance) are persisted using FiveM's Key-Value Pair (KVP) system.

KVP Key: legends_autopilot:settings

Format: JSON-encoded table

{
    maxSpeed = 45.0,
    drivingStyle = 1074528293,
    stoppingDistance = 5.0
}

Settings are saved automatically when changed in the UI and restored when the player reconnects.


NUI Actions

The resource communicates with its web UI using the following NUI message actions:

ActionDirectionDescription
openClient → NUIOpens the panel with current state
closeClient → NUICloses the panel
updateStateClient → NUIUpdates active/inactive status
closeNUI → ClientPlayer closed the panel
startAutopilotNUI → ClientStart with current settings
stopAutopilotNUI → ClientStop autopilot
saveSettingsNUI → ClientSave updated settings

Need Help?

Join our Discord for support: discord.gg/lgnds (opens in a new tab)


Legends Store - Premium FiveM Scripts