Skip to main content

Autopilot Settings

Drive mode speeds, permission gating, and the 17 driving behavior flags.

This section

Autopilot Settings

Three sections in shared/config.lua control autopilot:

  1. Config.AutoPilotPermissions — who can use autopilot
  2. Config.AutoPilotSpeeds — speed for each drive mode
  3. Config.AutoPilotSettings — the 17 driving behavior flags

Permissions

lua
Config.AutoPilotPermissions = {
jobs = {}, -- e.g. {"police", "ambulance"}
discordRoles = {}, -- e.g. {"123456789012345678"}
}

See Permission System. Default empty = everyone can use autopilot.

Speeds

lua
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.

ModeDefaultRecommended range
eco8060–100
sport120100–140
sport+180150–250

Driving Behavior Flags

Config.AutoPilotSettings is an array of flag definitions. Each entry becomes a toggle in the autopilot settings UI.

lua
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

FieldTypeDescription
idstringInternal identifier — referenced in saved settings
labelstringDisplayed label in the UI (translatable via locale system)
flagnumberBitmask value passed to TaskVehicleDriveToCoord
valuebooleanDefault 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 positionFlag valueConstant
01DF_STOP_FOR_CARS
12DF_STOP_FOR_PEDS
24DF_SWERVE_AROUND_ALL_CARS
38DF_STEER_AROUND_STATIONARY
416DF_STEER_AROUND_PEDS
532DF_STEER_AROUND_OBJECTS
664DF_DONT_STEER_AROUND_PLAYER
7128DF_STOP_AT_LIGHTS
8256DF_GO_OFF_ROAD_AVOIDING
9512DF_ONCOMING_TRAFFIC
101024DF_DRIVE_IN_REVERSE
112048DF_WANDER_FALLBACK
124096DF_AVOID_RESTRICTED
1416384DF_ADJUST_SPEED_ROAD
18262144DF_USE_SHORT_CUT
19524288DF_CHANGE_LANES
29536870912DF_AVOID_HIGHWAYS

Setting Sensible Defaults

Recommended defaults for realistic city driving (set value = true on these):

  • DF_STOP_FOR_CARS
  • DF_STOP_FOR_PEDS
  • DF_STOP_AT_LIGHTS
  • DF_STEER_AROUND_PEDS
  • DF_CHANGE_LANES
  • DF_ADJUST_SPEED_ROAD

For rally / shortcut runs:

  • DF_USE_SHORT_CUT
  • DF_GO_OFF_ROAD_AVOIDING
  • DF_AVOID_HIGHWAYS

Adding Custom Flags

You can add other FiveM driving flags by appending to the array:

lua
{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

OptionDefaultDescription
Config.Modules.AutoPilottrueShow the autopilot module at all