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:
| Input | Control | Behavior |
|---|---|---|
| S | Vehicle Brake | Cancels autopilot, applies brake |
| SPACE | Vehicle Handbrake | Cancels autopilot, applies brake |
/autopilot | Command | Opens 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:
| Action | Direction | Description |
|---|---|---|
open | Client → NUI | Opens the panel with current state |
close | Client → NUI | Closes the panel |
updateState | Client → NUI | Updates active/inactive status |
close | NUI → Client | Player closed the panel |
startAutopilot | NUI → Client | Start with current settings |
stopAutopilot | NUI → Client | Stop autopilot |
saveSettings | NUI → Client | Save updated settings |
Need Help?
Join our Discord for support: discord.gg/lgnds (opens in a new tab)