Configuration
Server Configuration
Server owners can configure general behavior in the config.lua file. These settings apply server-wide.
Configuration File Structure
Location: config.lua
Config = {}
Config.Command = 'autopilot'
Config.DistanceCheckInterval = 500
Config.KeyCheckInterval = 0
Config.EnableNotifications = true
Config.BlockedVehicleClasses = { ... }General Settings
Config.Command
Config.Command = 'autopilot'Description: The chat command used to open/close the autopilot UI panel.
Type: string
Default: 'autopilot'
Players type /autopilot in chat (or bind it to a key) to toggle the panel.
Performance Settings
Config.DistanceCheckInterval
Config.DistanceCheckInterval = 500Description: How often (in milliseconds) the script checks the distance to the destination.
Type: number
Default: 500
Higher values reduce CPU usage but make arrival detection less precise.
Config.KeyCheckInterval
Config.KeyCheckInterval = 0Description: How often (in milliseconds) the script checks for brake/handbrake key presses.
Type: number
Default: 0 (every frame)
Setting this above 0 will add delay to cancel responsiveness. The default of 0 is recommended.
Notification Settings
Config.EnableNotifications
Config.EnableNotifications = trueDescription: Whether to show ox_lib notification messages when autopilot starts, stops, or encounters errors.
Type: boolean
Default: true
| Value | Behavior |
|---|---|
true | Notifications shown for all autopilot events |
false | No notifications, silent operation |
Vehicle Restrictions
Config.BlockedVehicleClasses
Config.BlockedVehicleClasses = {
-- 8, -- Motorcycles
13, -- Cycles (bicycles)
14, -- Boats
15, -- Helicopters
16, -- Planes
21, -- Trains
}Description: Vehicle classes that cannot use autopilot. Players in these vehicles will see an error when trying to start.
Type: table (array of vehicle class IDs)
Default: Blocks bicycles, boats, helicopters, planes, and trains
| Class ID | Vehicle Type |
|---|---|
| 0 | Compacts |
| 1 | Sedans |
| 2 | SUVs |
| 3 | Coupes |
| 4 | Muscle |
| 5 | Sports Classics |
| 6 | Sports |
| 7 | Super |
| 8 | Motorcycles |
| 9 | Off-road |
| 10 | Industrial |
| 11 | Utility |
| 12 | Vans |
| 13 | Cycles |
| 14 | Boats |
| 15 | Helicopters |
| 16 | Planes |
| 17 | Service |
| 18 | Emergency |
| 19 | Military |
| 20 | Commercial |
| 21 | Trains |
| 22 | Open Wheel |
Motorcycles (class 8) are commented out by default. Uncomment the line if you experience issues with autopilot on motorcycles.
Player Settings (In-Game UI)
Driving style, max speed, and stopping distance are no longer configured in config.lua. Each player controls these settings through the in-game autopilot UI panel, and their preferences are automatically saved between sessions.
When a player opens the autopilot panel (/autopilot), they can adjust the following settings:
Driving Style
Players choose between three driving styles via a dropdown in the UI:
| Style | Behavior |
|---|---|
| Normal | Obeys traffic laws, stops at red lights |
| Rushed | Fast driving, avoids vehicles and pedestrians |
| Aggressive | Ignores traffic rules, avoids only vehicles and peds |
Max Speed
Players set their maximum driving speed using a slider ranging from 20 to 160 km/h (12 to 99 mph).
Stopping Distance
Players configure how close (in meters) the vehicle stops to the waypoint using a slider ranging from 2m to 20m.
How Settings Are Saved
Player settings are persisted using FiveM's Key-Value Pair (KVP) system under the key legends_autopilot:settings. Settings are saved automatically whenever a player changes them in the UI and are restored when the player reconnects. No server-side storage or database is required.
Default values for new players:
| Setting | Default |
|---|---|
| Max Speed | ~162 km/h (45.0 m/s) |
| Driving Style | Rushed |
| Stopping Distance | 5m |
Need Help?
Join our Discord for support: discord.gg/lgnds (opens in a new tab)