Configuration
Configuration guide of Auto Pilot Script.
Auto Pilot Script Configuration Guide
This guide provides detailed instructions for configuring the Auto Pilot Script for FiveM. The script allows players to enable autopilot for specific vehicles, providing a seamless and automated driving experience. Configuration options include framework detection, vehicle restrictions, notifications, and more.
Main Configuration
Config.Framework
Description: This setting determines which framework the script will utilize. The options are
"esx"
,"qb"
, or"auto"
. When set to"auto"
, the script automatically detects the active framework on the server. Use"auto"
for flexibility or manually set the framework based on your server setup.Example:
Config.Framework = "auto" -- auto, esx, or qb
Config.debug
Description: Enables or disables debug mode. When
true
, the script will output detailed information to the console, which can be helpful for troubleshooting during development or testing. Keep itfalse
for regular use to avoid unnecessary console messages.Example:
Config.debug = false -- Enable or disable debug mode
Config.hideCmd
Description: This setting allows you to define a custom command that players can use to hide the autopilot user interface. It can be helpful for players who prefer a cleaner HUD or only want to display the interface when needed.
Example:
Config.hideCmd = 'hideap' -- Command to hide the autopilot UI
Vehicle Access
Config.allCarsAllowed
Description: This option controls whether all vehicles are allowed to use autopilot. Set this to
true
if you want to enable autopilot for every vehicle. If set tofalse
, only the vehicles listed inallowedCars
will be able to use autopilot.Example:
Config.allCarsAllowed = false -- Set to true to allow all vehicles
Config.allowedCars
Description: If
Config.allCarsAllowed
is set tofalse
, this table defines which vehicles can use the autopilot system. You can list vehicle models by their spawn name, allowing autopilot only for specific cars.Example:
Config.allowedCars = {'t20', 'adder', 'neon'} -- List of allowed vehicles for autopilot
Locales
Config.Locales
Description: This section allows you to customize the messages displayed to players when autopilot is activated or deactivated. You can easily change the text to fit your server's language or tone.
Example:
Config.Locales = { autopilot_deactivated = 'Autopilot functions are now ~r~disabled~s~.', autopilot_activated = 'Autopilot functions are now ~g~enabled~s~.', }
Notifications
Config.Notify
Description: This setting allows you to choose between the default notification system or implementing a custom notification function. Set to
"default"
for standard notifications or"custom"
if you want to create your own.Example:
Config.Notify = 'default' -- Choose between default or custom notifications
Config.NotifyFunction
Description: If you choose
"custom"
forConfig.Notify
, this function allows you to define how the notifications are triggered. Insert your custom notification logic here to replace the default behavior.Example:
Config.NotifyFunction = function(msg) -- Your custom notify trigger here end
Framework Detection
getFramework()
Description: This function automatically detects and returns the active framework being used. It supports ESX, QBCore, or automatic detection. This ensures the script works seamlessly with the server's setup.
Example:
function getFramework() if Config.Framework == "esx" then return exports['es_extended']:getSharedObject(), "esx" elseif Config.Framework == "qb" then return exports["qb-core"]:GetCoreObject(), "qb" elseif Config.Framework == "auto" then if GetResourceState('qb-core') == 'started' then return exports["qb-core"]:GetCoreObject(), "qb" elseif GetResourceState('es_extended') == 'started' then return exports['es_extended']:getSharedObject(), "esx" end end end
Last updated