FAQ
Frequently Asked Questions
Changing license plate text
There are some minor problems when updating a vehicle's plate. In order to fix those, you will need to exchange the function SetVehicleNumberPlateText with the following function:
exports["AdvancedParking"]:UpdatePlateThe variables in the parenthesis at the end should stay the same! Do not remove them! Example:
SetVehicleNumberPlateText(vehicle, "TEST1234")
-- into this:
exports["AdvancedParking"]:UpdatePlate(vehicle, "TEST1234")qb-vehiclekeys
Issue
qb-vehiclekeys doesn't properly recognize owned vehicles after a server restart. You cannot (un)lock them.
Solution
Add the following snippet at the bottom of your qb-vehiclekeys/server/main.lua and restart your server.
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function()
local playerId = source
local citizenid = QBCore.Functions.GetPlayer(playerId).PlayerData.citizenid
exports.oxmysql:execute("SELECT `plate` FROM `player_vehicles` WHERE `citizenid` = ?", { citizenid }, function(result)
for i = 1, #result do
local plate = result[i].plate
if not VehicleList[plate] then
VehicleList[plate] = {}
end
VehicleList[plate][citizenid] = true
TriggerClientEvent("qb-vehiclekeys:client:AddKeys", playerId, plate)
end
end)
end)okokGarage keys
Issue
Same as qb-vehiclekeys. It doesn't properly recognize owned vehicles after a server restart. You cannot (un)lock them.
Solution (for ESX)
Add the following snippet at the bottom of the sv_utils.lua inside okokGarage.
RegisterNetEvent('okok:server:CheckOwnerExt', function()
local src = source
local xPlayer = ESX.GetPlayerFromId(src)
local APExports = exports["AdvancedParking"]
MySQLfetchAll('SELECT owner, plate FROM owned_vehicles WHERE owner = ? OR owner = ?', {xPlayer.identifier, xPlayer.job.name}, function(result)
for i = 1, #result do
if (APExports:GetVehiclePosition(result[i].plate)) then
TriggerEvent('okokGarage:GiveKeys', result[i].plate, src)
end
end
end)
end)And add the following snippet at the bottom of the cl_utils.lua inside okokGarage.
AddEventHandler('esx:onPlayerSpawn', function()
TriggerServerEvent('okok:server:CheckOwnerExt')
end)Solution (for QB)
Add the following snippet at the bottom of the sv_utils.lua inside okokGarage.
RegisterNetEvent('okok:server:CheckOwnerExt', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local APExports = exports["AdvancedParking"]
exports.oxmysql:execute('SELECT citizenid, plate FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid}, function(result)
for i = 1, #result do
if (APExports:GetVehiclePosition(result[i].plate)) then
TriggerEvent('okokGarage:GiveKeys', result[i].plate, tonumber(src))
end
end
end)
end)And add the following snippet at the bottom of the cl_utils.lua inside okokGarage.
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
TriggerServerEvent('okok:server:CheckOwnerExt')
end)okokGarage outside vehicle detection
Issue
After a server restart vehicles that are still outside will be shown as parked and can be gotten out of a garage multiple times.
Solution
Make sure to disable okokGarage's config option called: Config.SetVehicleImpoundAfter
Then find the function takeOutVehicle inside okokGarage's sv_utils.lua and add the following code as the first line:
if (exports["AdvancedParking"]:GetVehiclePosition(vehicle_plate)) then
TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_isnt_stored').title, _L('vehicle_isnt_stored').text, _L('vehicle_isnt_stored').time, _L('vehicle_isnt_stored').type)
return
endcd_garage DeleteVehicle
Issue
cd_garage uses a weird function to delete vehicles. Because of that, the usual fix will not work for this script.
Solution
Make sure to disable cd_garage's built-in persistence feature in their config.
Add a Wait(1000) in between lines 113/114 inside AdvancedParking/client/client.lua.
Find the function CD_DeleteVehicle inside cd_garage/client/functions.lua and add the following code right after the first line:
if (GetResourceState("AdvancedParking") == "started") then
exports["AdvancedParking"]:DeleteVehicle(vehicle)
return
endJG Advanced Garages
Issue
When enabling Cleanup.storeVehicles vehicles won't be stored properly.
Solution
Add the missing columns to the query inside AdvancedParking/server/storage/oxmysql.lua and change "YOUR_GARAGE_NAME" to the name of the garage.
You can simply replace Storage.StoreVehicleInGarage with the following:
Storage.StoreVehicleInGarage = function(params)
params = { "Legion Square", params[1], params[2] }
oxmysql:update(([[
UPDATE `%s` SET `%s` = 1, `in_garage` = 1, `garage_id` = ?
WHERE `plate` = ? OR `plate` = ?;
]]):format(GetOwnedVehiclesTableName(), GetStoredColumnName()), params)
endJG Garage + qb-vehiclekeys
Issue
When using qb-vehiclekeys in tandem with JG's garage, players will lose their keys to job-owned vehicles after a server restart.
Solution
A slightly different version of this fix. This should be added at the bottom of qb-vehiclekeys/server/main.lua:
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function()
local playerId = source
local playerData = QBCore.Functions.GetPlayer(playerId).PlayerData
local citizenid = playerData.citizenid
local job = playerData.job.name
exports.oxmysql:execute("SELECT `plate` FROM `player_vehicles` WHERE `citizenid` = ? OR `citizenid` = ?;", {
citizenid,
job
}, function(result)
for i = 1, #result do
local plate = result[i].plate
if not VehicleList[plate] then
VehicleList[plate] = {}
end
VehicleList[plate][citizenid] = true
TriggerClientEvent("qb-vehiclekeys:client:AddKeys", playerId, plate)
end
end)
end)GG Garage Job
Issue
It uses a specific function to delete vehicles. Because of that, the usual fix will not work for this script.
Solution
Find the function gg.vehicleManager.removeVehicle inside its files and add the following code right after the first line:
if (GetResourceState("AdvancedParking") == "started") then
exports["AdvancedParking"]:DeleteVehicle(entity)
return
endJaksam vehicle_keys
Issue
Missing keys after a server restart.
Solution
Add the following code to AdvancedParking/client/cl_integrations.lua:
AddEventHandler("esx:onPlayerSpawn",function(xPlayer, isNew, skin)
TriggerServerEvent("AP:checkKeys")
end)And this to AdvancedParking/server/sv_integrations.lua:
RegisterNetEvent("AP:checkKeys", function()
local ESX = exports["es_extended"]:getSharedObject()
local AP = exports["AdvancedParking"]
local src = source
local playerData = ESX.GetPlayerFromId(src)
local identifier = playerData.identifier
local job = playerData.getJob().name
exports["oxmysql"]:query([[
SELECT `plate`
FROM `owned_vehicles`
WHERE `owner` = ? OR `owner` = ?;
]], { identifier, job }, function(results)
for i, row in ipairs(results) do
if (AP:GetVehiclePosition(row.plate)) then
exports["vehicles_keys"]:giveVehicleKeysToIdentifier(identifier, row.plate, "temporary")
end
end
end)
end)Last updated