Autopilot
This is a step-by-step installation guide, configuration preview, and full explanation of all settings for legends_autopilot.
If you lack programming experience, ensure you read each step thoroughly without skipping, as all documentation is essential!
Before submitting a support ticket or following the guides in this documentation, please make sure that you are running the latest version of the resource.
What is legends_autopilot?
legends_autopilot is a vehicle autopilot system that allows players to automatically drive to their map waypoint. Players open a modern in-game UI panel to configure their driving style, max speed, and stopping distance, then engage autopilot with a single click. The vehicle will navigate to the destination, progressively slow down on approach, and stop automatically.
All driving preferences (speed, driving style, stopping distance) are controlled per-player through the in-game UI panel. No need to edit config files for these settings — players adjust them in real time and their preferences are saved automatically.
Key Features
- Modern UI Panel - Sleek holographic interface to configure and control autopilot
- Per-Player Settings - Each player controls their own driving style, speed, and stopping distance through the UI
- Multiple Driving Styles - Normal (obeys traffic), Rushed (fast, avoids obstacles), or Aggressive (ignores traffic)
- Adjustable Speed - Set max speed from 20 to 160 km/h via slider
- Stopping Distance - Configure how close to the waypoint the vehicle stops (2-20m)
- Progressive Slowdown - Vehicle smoothly decelerates as it approaches the destination
- Persistent Settings - Player preferences are saved between sessions automatically via KVP
- Vehicle Class Blocking - Block autopilot on specific vehicle types (bikes, boats, aircraft, etc.)
- Cancel Anytime - Press brake (S), handbrake (SPACE), or use the command to cancel
- Lightweight - Only requires ox_lib, works with any framework
Need help? Join our Discord (opens in a new tab) for support!
FAQ
How do I change the autopilot keybind or command name?
Open config.lua and edit Config.Keybind for the toggle key or Config.Command for the chat command. Both accept any standard FiveM input name. Players can also remap the key from the FiveM keybinds menu at runtime because the resource registers its control via RegisterKeyMapping.
How do I tune driving style per preset (Aggressive vs Rushed vs Normal)?
Each driving style lives in Config.DrivingStyles as a bitmask plus a top-speed cap. Build your own style with SetDriveTaskDrivingStyle flags (avoid traffic, stop at lights, overtake, etc.) and assign it a name. The UI picks it up automatically from the table keys.
Can I disable autopilot in specific map areas (airports, military zones)?
Yes. Add coordinate spheres or polygons to Config.RestrictedZones. The client checks the player's vehicle position every tick and automatically cancels autopilot when entering a restricted zone, showing a notification explaining why.
How do I stop autopilot from external resources (pursuit scripts, anti-cheat)?
Call exports.legends_autopilot:Cancel(playerId) from any server script or TriggerClientEvent('legends_autopilot:cancel', playerId) from the client. The resource also exposes IsAutopilotActive(playerId) so you can check state before performing overrides.
What happens if another script changes the ped's driving task while autopilot is running?
legends_autopilot detects external ClearPedTasks calls and re-applies its task automatically for two retry cycles; if the external script wins it surrenders cleanly and notifies the player. You can lower Config.Resiliency to zero to let other scripts always win the race.