Skip to main content

Autopilot

GPS-driven autonomous driving with three speed modes and 17 driving behavior flags.

This section

Autopilot

GPS-guided autonomous driving system. Set a destination on the map, choose a drive mode and behavior flags, and the vehicle drives itself there using FiveM's TaskVehicleDriveToCoord native.

Speed Modes

Speeds are fully configurable via Config.AutoPilotSpeeds:

ModeDefault SpeedUse Case
Eco80 km/hCasual city driving
Sport120 km/hFaster highway driving
Sport+180 km/hMaximum speed driving
lua
Config.AutoPilotSpeeds = {
eco = 80.0,
sport = 120.0,
["sport+"] = 180.0,
}

How It Works

  1. Open the Map app
  2. Pick a destination (search, favorites, recents, or tap on the map)
  3. Tap Autopilot
  4. Select a speed mode (Eco / Sport / Sport+)
  5. Toggle any of the 17 driving behavior flags
  6. Press Go
  7. The vehicle drives itself, with a live navigation HUD showing remaining distance and turn information
  8. Autopilot automatically disengages on arrival

You can also press Stop at any point to take back manual control.

While autopilot is engaged (or any waypoint is set), a navigation HUD widget can show on the dashboard:

  • Remaining distance (with km / m units, localized)
  • Current drive mode
  • Quick stop button

Driving Behavior Flags

17 flags from the FiveM TaskVehicleDriveToCoord native are exposed in Config.AutoPilotSettings. Each is a row that the player can toggle on/off in the autopilot settings panel.

FlagDecimal valueDescriptionDefault
DF_STOP_FOR_CARS1Stops before vehiclesfalse
DF_STOP_FOR_PEDS2Stops before pedestriansfalse
DF_SWERVE_AROUND_ALL_CARS4Avoids vehiclesfalse
DF_STEER_AROUND_STATIONARY8Avoids parked / stopped vehiclesfalse
DF_STEER_AROUND_PEDS16Avoids pedestriansfalse
DF_STEER_AROUND_OBJECTS32Avoids objectsfalse
DF_DONT_STEER_AROUND_PLAYER64Will not avoid player pedfalse
DF_STOP_AT_LIGHTS128Stops at traffic lightsfalse
DF_GO_OFF_ROAD_AVOIDING256Allow off-road when avoidingfalse
DF_ONCOMING_TRAFFIC512Drives wrong way if lane is fullfalse
DF_DRIVE_IN_REVERSE1024Drives in reverse gearfalse
DF_WANDER_FALLBACK2048Cruise randomly if pathfinding failsfalse
DF_AVOID_RESTRICTED4096Avoid restricted areasfalse
DF_ADJUST_SPEED_ROAD16384Follow road speed limitfalse
DF_USE_SHORT_CUT262144Take shortest path, uses dirt roadsfalse
DF_CHANGE_LANES524288Changes lanes around obstructionsfalse
DF_AVOID_HIGHWAYS536870912Avoid highways unless necessaryfalse

The script ORs all enabled flag values into a single bitmask before passing it to the native. To customize defaults, change the value = false field in each row of Config.AutoPilotSettings.

Permissions

Autopilot is gated by Config.AutoPilotPermissions:

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

See Permission System for how the OR-logic works.

Module Toggle

OptionDefaultDescription
Config.Modules.AutoPilottrueShow the autopilot module at all