Config
Check out the default ESX and QBCore config file.
config.lua
Config = {}
-- === VERSION 3.0 ===
-- === DEBUG ===
Config.Debug = false
-- === GENERAL ===
Config.OpenCommand = 'carplay' -- Console command to open the NUI
Config.OpenKey = 'k'
Config.OpenRearCameraCommand = 'trunk-camera' -- Console command to open the NUI
Config.OpenRearCameraKey = 'f7' -- Open or close
Config.ReportsDuration = 18000 -- Seconds before the signaled report vanish
-- === CARPLAY INSTALLATION ===
Config.RequireInstallation = true -- Without installation, you won't have the carplay display object inside the car
Config.InstallationCommand = 'carplay-install'
Config.RequireMechanic = true
Config.MechanicJobName = {
'mechanic',
}
Config.InstallTime = 10000 -- milliseconds
-- === PHONE ===
Config.DisablePhone = false -- Won't search for contacts on database
Config.PhoneType = 'gcphone' -- Select your phone script from the list below
-- gcphone | qbphone | quasar-pro | gksphone | gksphone2 | dphone | highphone | chezza | npwd | roadphone | lbphone
-- custom (if you use a custom phone, you need to implement the function SendMessageCustomPhone and SendMessageCustomPhoneS)
-- === NAVIGATOR ===
Config.EnableNavigator = true
Config.NavigatorAnySeat = true -- Allow any passenger of the vehicle to use the navigator
-- === MUSIC ===
Config.XSoundDistanceOpen = 15 -- Distance to hear the music if the car doors are open
Config.XSoundDistanceClose = 3 -- Distance to hear the music if the car doors are closed
-- === TEXT ===
Config.Text = {
['no_carplay'] = "Carplay is not installed in this vehicle",
['not_registered'] = "This vehicle is not registered",
['already_registered'] = "This vehicle is already registered",
['installing_carplay'] = "Installing Carplay...",
['carplay_installed'] = "Carplay installed",
['carplay_open'] = "Carplay is already used by another passenger",
['not_mechanic'] = "You are not a mechanic",
}
function OnTrunkCameraOpen()
if GetResourceState('complete_hud') == 'started' then
exports['complete_hud']:hideHud()
end
end
function OnTrunkCameraClose()
if GetResourceState('complete_hud') == 'started' then
exports['complete_hud']:showHud()
end
end
framework/esx/
client.lua
if GetResourceState('es_extended') ~= 'started' then return end
ESX = exports.es_extended:getSharedObject()
function Notify(text, type)
ESX.ShowNotification(text, type, 3000)
end
function GetJobName()
local xPlayer = ESX.GetPlayerData()
return xPlayer.job.name
end
function IsVehicleLocked(veh)
local status = GetVehicleDoorLockStatus(veh)
local result = status < 2 and true or false
return result
end
function ToggleVehicleLock(lock)
if lock then
SetVehicleDoorsLocked(veh, 2)
else
SetVehicleDoorsLocked(veh, 1)
end
end
-- If Config.PhoneType is set to custom
function SendMessageCustomPhone(receiver, message)
-- Implement your custom phone message sending logic here
return
end
server.lua
if GetResourceState('es_extended') ~= 'started' then return end
ESX = exports.es_extended:getSharedObject()
ESX.RegisterUsableItem('carplay', function(playerId)
TriggerClientEvent('complete_vision:client:InstallCarplay', playerId)
end)
function GetCarLicense(plate)
local vehicle = MySQL.query.await('SELECT owner FROM owned_vehicles WHERE plate = ?', { plate })
if vehicle[1] ~= nil then
return vehicle[1].owner
else
return nil
end
end
function GetCarplayId(plate)
local vehicle = MySQL.query.await('SELECT carplayid FROM owned_vehicles WHERE plate = ?', { plate })
if vehicle[1] ~= nil then
if Config.Debug then print('^1[DEBUG]^3 GetCarplayId ID: ', json.encode(vehicle[1]), json.encode(vehicle[1].carplayid)) end
return vehicle[1].carplayid
else
return nil
end
end
function SetCarplayId(plate, carplayid)
MySQL.Async.execute('UPDATE owned_vehicles SET carplayid = @carplayid WHERE plate = @plate', {
['@plate'] = plate,
['@carplayid'] = carplayid
})
end
-- If Config.PhoneType is set to custom
function GetContactsCustomPhone(source, license)
-- Implement your custom phone message sending logic here
return
end
-- If Config.PhoneType is set to custom
function SendMessageCustomPhone(source, receiver, message)
-- Implement your custom phone message sending logic here
return
end
framework/qbcore/
client.lua
if GetResourceState('qb-core') ~= 'started' then return end
QBCore = exports['qb-core']:GetCoreObject()
function Notify(text, type)
QBCore.Functions.Notify(text, type, 3000)
end
function GetJobName()
local xPlayer = QBCore.Functions.GetPlayerData()
local job = xPlayer.job and xPlayer.job.name or 'Unemployed'
return job
end
function IsVehicleLocked(veh)
local status = GetVehicleDoorLockStatus(veh)
local result = status < 2 and true or false
return result
end
function ToggleVehicleLock(lock)
if lock then
SetVehicleDoorsLocked(veh, 2)
else
SetVehicleDoorsLocked(veh, 1)
end
end
function SendMessageQbPhone(receiver, message)
lib.callback('complete_carplay:server:GetDate', false, function(date)
lib.callback('complete_carplay:server:GetTime', false, function(time)
exports["qb-phone"]:SendMessage(message, date, receiver, time, "message")
end)
end)
end
-- If Config.PhoneType is set to custom
function SendMessageCustomPhone(receiver, message)
-- Implement your custom phone message sending logic here
return
end
server.lua
if GetResourceState('qb-core') ~= 'started' then return end
QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.CreateUseableItem('carplay', function(source, item)
TriggerClientEvent('complete_vision:client:InstallCarplay', source)
end)
function GetCitizenid(source)
local Player = QBCore.Functions.GetPlayer(source)
return Player.PlayerData.citizenid
end
function GetCarLicense(plate)
local vehicle = MySQL.query.await('SELECT license FROM player_vehicles WHERE plate = ?', { plate })
if vehicle[1] ~= nil then
return vehicle[1].license
else
return nil
end
end
function GetCarplayId(plate)
local vehicle = MySQL.query.await('SELECT carplayid FROM player_vehicles WHERE plate = ?', { plate })
if vehicle[1] ~= nil then
if Config.Debug then print('^1[DEBUG]^3 GetCarplayId ID: ', json.encode(vehicle[1]), json.encode(vehicle[1].carplayid)) end
return vehicle[1].carplayid
else
return nil
end
end
function SetCarplayId(plate, carplayid)
MySQL.Async.execute('UPDATE player_vehicles SET carplayid = @carplayid WHERE plate = @plate', {
['@plate'] = plate,
['@carplayid'] = carplayid
})
end
-- If Config.PhoneType is set to custom
function GetContactsCustomPhone(source, license)
-- Implement your custom phone message sending logic here
return
end
-- If Config.PhoneType is set to custom
function SendMessageCustomPhone(source, receiver, message)
-- Implement your custom phone message sending logic here
return
end
framework/custom/
client.lua
if GetResourceState('es_extended') == 'started' then return end
if GetResourceState('qb-core') == 'started' then return end
function Notify(text)
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(text)
EndTextCommandThefeedPostTicker(true, true)
end
function GetJobName()
return Config.MechanicJobName[1]
end
function IsVehicleLocked(veh)
local status = GetVehicleDoorLockStatus(veh)
local result = status < 2 and true or false
return result
end
function ToggleVehicleLock(lock)
if lock then
SetVehicleDoorsLocked(veh, 2)
else
SetVehicleDoorsLocked(veh, 1)
end
end
-- If Config.PhoneType is set to custom
function SendMessageCustomPhone(receiver, message)
-- Implement your custom phone message sending logic here
return
end
server.lua
if GetResourceState('es_extended') == 'started' then return end
if GetResourceState('qb-core') == 'started' then return end
-- For other infos please open a ticket in the Complete Scripts discord server
-- Use your system to make the item usable, use the following code to trigger the client event:
-- TriggerClientEvent('complete_vision:client:InstallCarplay', source)
local function GetPlayerLicense(source)
for k,v in pairs(GetPlayerIdentifiers(source))do
if string.sub(v, 1, string.len("license:")) == "license:" then
license = v
end
end
return license
end
function GetCarLicense(plate)
-- Return the license of the owner of the vehicle from the plate
-- You should get this information from the table of your vehicle shop script
--[[ local vehicle = MySQL.query.await('SELECT citizenid FROM player_vehicles WHERE WHERE plate = ?', { plate })
if vehicle[1] ~= nil then
return vehicle[1].citizenid
else
return nil
end ]]
return nil
end
function GetCarplayId(plate)
-- Return the carplayid column of the selected vehicle from the plate
-- You should get this information from the table of your vehicle shop script
--[[ local vehicle = MySQL.query.await('SELECT carplayid FROM player_vehicles WHERE plate = ?', { plate })
if vehicle[1] ~= nil then
if Config.Debug then print('^1[DEBUG]^3 GetCarplayId ID: ', json.encode(vehicle[1]), json.encode(vehicle[1].carplayid)) end
return vehicle[1].carplayid
else
return nil
end ]]
return nil
end
function SetCarplayId(plate, carplayid)
-- Set the carplayid column of the selected vehicle from the plate
-- You should set this information from the table of your vehicle shop script
--[[ MySQL.Async.execute('UPDATE player_vehicles SET carplayid = @carplayid WHERE plate = @plate', {
['@plate'] = plate,
['@carplayid'] = carplayid
}) ]]
end
-- If Config.PhoneType is set to custom
function GetContactsCustomPhone(source, license)
-- Implement your custom phone message sending logic here
return
end
-- If Config.PhoneType is set to custom
function SendMessageCustomPhone(source, receiver, message)
-- Implement your custom phone message sending logic here
return
end
html/config.js
var Config = {
Apps: {
messages: true,
map: true,
music: true,
commands: true,
health: true,
camera: true,
},
waypoints: [
{
name: 'Vanilla Bar',
x: -1278.583,
y: 126.135,
icon: 'https://docs.fivem.net/blips/radar_strip_club.png',
color: '#c084fc',
street: 'Strawberry Ave'
},
{
name: 'Blaine County Savings Bank',
x: 6464.035,
y: -109.299,
icon: 'https://docs.fivem.net/blips/radar_financier_strand.png',
color: '#4ade80',
street: 'Paleto Blvd'
},
{
name: 'Police Station',
x: -982.172,
y: 436.491,
icon: 'https://docs.fivem.net/blips/radar_police_station.png',
color: '#60a5fa',
street: 'Mission Row'
},
{
name: 'North Yankton Bank',
x: 5309.519,
y: -5212.375,
icon: 'https://docs.fivem.net/blips/radar_financier_strand.png',
color: '#4ade80',
street: 'North Rockford Dr'
},
{
name: 'Ammunation Gun Range',
x: -1072.854,
y: 22.153,
icon: 'https://docs.fivem.net/blips/radar_supplies.png',
color: '#fbbf24',
street: 'Hawick Ave'
},
{
name: 'Pacific Standard Bank Vault',
x: 217.030,
y: 255.851,
icon: 'https://docs.fivem.net/blips/radar_financier_strand.png',
color: '#4ade80',
street: 'Vinewood Blvd'
},
],
cayoWaypoints: [
{
name: 'Cayo Bar',
x: 5140.25830078125,
y: -4713.51123046875,
icon: 'https://docs.fivem.net/blips/radar_strip_club.png',
color: '#c084fc',
street: 'Strawberry Ave'
},
{
name: 'Cayo Bar',
x: 4764.8251953125,
y: -4779.2421875,
icon: 'https://docs.fivem.net/blips/radar_player_boat.png',
color: '#c084fc',
street: 'Strawberry Ave'
},
{
name: 'Cayo Bar',
x: 5264.8,
y: -5429.2,
icon: 'https://docs.fivem.net/blips/radar_strip_club.png',
color: '#c084fc',
street: 'Strawberry Ave'
},
{
name: 'Cayo Store',
x: 4881.8,
y: -5397.2,
icon: 'https://docs.fivem.net/blips/radar_heist.png',
color: '#c084fc',
street: 'Strawberry Ave'
},
{
name: 'Cayo Bar',
x: 5088.8,
y: -5724.2,
icon: 'https://docs.fivem.net/blips/radar_bar.png',
color: '#c084fc',
street: 'Strawberry Ave'
},
],
BlackListSongs: ['https://youtu.be/93M1QtYDtpU'],
NavigatorPosition: 'top-left',
// 'top-left', 'top-middle', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right'
DisableCayoMap: false,
DisableHeadlightsColor: false,
pmaIcons: true,
}
export default Config;
Last updated
Was this helpful?