Autopilot Settings
Three sections in shared/config.lua control autopilot:
Config.AutoPilotPermissions— who can use autopilotConfig.AutoPilotSpeeds— speed for each drive modeConfig.AutoPilotSettings— the 17 driving behavior flags
Permissions
Config.AutoPilotPermissions = {
jobs = {}, -- e.g. {"police", "ambulance"}
discordRoles = {}, -- e.g. {"123456789012345678"}
}
See Permission System. Default empty = everyone can use autopilot.
Speeds
Config.AutoPilotSpeeds = {
eco = 80.0,
sport = 120.0,
["sport+"] = 180.0,
}
Speeds are in km/h. The keys (eco, sport, sport+) are referenced by the React UI — do not rename them, only change values.
| Mode | Default | Recommended range |
|---|---|---|
eco | 80 | 60–100 |
sport | 120 | 100–140 |
sport+ | 180 | 150–250 |
Driving Behavior Flags
Config.AutoPilotSettings is an array of flag definitions. Each entry becomes a toggle in the autopilot settings UI.
Config.AutoPilotSettings = {
{id = "DF_STOP_FOR_CARS", label = "Stops before vehicles.", flag = 1, value = false},
{id = "DF_STOP_FOR_PEDS", label = "Stops before peds.", flag = 2, value = false},
{id = "DF_SWERVE_AROUND_ALL_CARS", label = "Avoids vehicles.", flag = 4, value = false},
{id = "DF_STEER_AROUND_STATIONARY", label = "Avoids empty vehicles.", flag = 8, value = false},
{id = "DF_STEER_AROUND_PEDS", label = "Avoids peds.", flag = 16, value = false},
{id = "DF_STEER_AROUND_OBJECTS", label = "Avoids objects.", flag = 32, value = false},
{id = "DF_DONT_STEER_AROUND_PLAYER", label = "Will not avoid player ped.", flag = 64, value = false},
{id = "DF_STOP_AT_LIGHTS", label = "Stops at traffic lights.", flag = 128, value = false},
{id = "DF_GO_OFF_ROAD_AVOIDING", label = "Allow going off road when avoiding.", flag = 256, value = false},
{id = "DF_ONCOMING_TRAFFIC", label = "Drives wrong way if lane is full.", flag = 512, value = false},
{id = "DF_DRIVE_IN_REVERSE", label = "Drives in reverse gear.", flag = 1024, value = false},
{id = "DF_WANDER_FALLBACK", label = "Cruise randomly if pathfinding fails.",flag = 2048, value = false},
{id = "DF_AVOID_RESTRICTED", label = "Avoid restricted areas.", flag = 4096, value = false},
{id = "DF_ADJUST_SPEED_ROAD", label = "Follow road speed limit.", flag = 16384, value = false},
{id = "DF_USE_SHORT_CUT", label = "Takes shortest path, uses dirt roads.",flag = 262144, value = false},
{id = "DF_CHANGE_LANES", label = "Changes lanes to avoid obstacles.", flag = 524288, value = false},
{id = "DF_AVOID_HIGHWAYS", label = "Avoid highways unless necessary.", flag = 536870912, value = false},
}
Per-Entry Fields
| Field | Type | Description |
|---|---|---|
id | string | Internal identifier — referenced in saved settings |
label | string | Displayed label in the UI (translatable via locale system) |
flag | number | Bitmask value passed to TaskVehicleDriveToCoord |
value | boolean | Default state (true = enabled by default for new players) |
How the Bitmask Is Built
The script ORs together every flag value where the player has enabled the toggle:
finalFlags = 0
for each setting in AutoPilotSettings:
if player has it enabled:
finalFlags = finalFlags | setting.flag
TaskVehicleDriveToCoord(ped, vehicle, x, y, z, speed, ..., finalFlags, ...)
Flag Reference
These flags are FiveM TaskVehicleDriveToCoord driving flags. The decimal values are bit positions:
| Bit position | Flag value | Constant |
|---|---|---|
| 0 | 1 | DF_STOP_FOR_CARS |
| 1 | 2 | DF_STOP_FOR_PEDS |
| 2 | 4 | DF_SWERVE_AROUND_ALL_CARS |
| 3 | 8 | DF_STEER_AROUND_STATIONARY |
| 4 | 16 | DF_STEER_AROUND_PEDS |
| 5 | 32 | DF_STEER_AROUND_OBJECTS |
| 6 | 64 | DF_DONT_STEER_AROUND_PLAYER |
| 7 | 128 | DF_STOP_AT_LIGHTS |
| 8 | 256 | DF_GO_OFF_ROAD_AVOIDING |
| 9 | 512 | DF_ONCOMING_TRAFFIC |
| 10 | 1024 | DF_DRIVE_IN_REVERSE |
| 11 | 2048 | DF_WANDER_FALLBACK |
| 12 | 4096 | DF_AVOID_RESTRICTED |
| 14 | 16384 | DF_ADJUST_SPEED_ROAD |
| 18 | 262144 | DF_USE_SHORT_CUT |
| 19 | 524288 | DF_CHANGE_LANES |
| 29 | 536870912 | DF_AVOID_HIGHWAYS |
Setting Sensible Defaults
Recommended defaults for realistic city driving (set value = true on these):
DF_STOP_FOR_CARSDF_STOP_FOR_PEDSDF_STOP_AT_LIGHTSDF_STEER_AROUND_PEDSDF_CHANGE_LANESDF_ADJUST_SPEED_ROAD
For rally / shortcut runs:
DF_USE_SHORT_CUTDF_GO_OFF_ROAD_AVOIDINGDF_AVOID_HIGHWAYS
Adding Custom Flags
You can add other FiveM driving flags by appending to the array:
{id = "DF_USE_STRINGPULLING_AT_JUNCTIONS", label = "Use string pulling at junctions.", flag = 67108864, value = false},
The full FiveM driving flag reference is in their documentation.
Module Toggle
| Option | Default | Description |
|---|---|---|
Config.Modules.AutoPilot | true | Show the autopilot module at all |
