Closed linus-jansson closed 2 years ago
I found the problem. GTA treats underscores as a space. Therefore when checking ownership before storing it thinks the licenseplate is HQK 111
instead of HQK_111
which is stored in the database.. I need to store the licenceplate with a space in the database.
changing the generate plate function to this solves the issue
local function GeneratePlate()
local plate = QBCore.Shared.RandomStr(3) .. ' ' .. QBCore.Shared.RandomInt(3)
-- local plate = QBCore.Shared.RandomInt(1) .. QBCore.Shared.RandomStr(2) .. QBCore.Shared.RandomInt(3) .. QBCore.Shared.RandomStr(2)
local result = MySQL.scalar.await('SELECT plate FROM player_vehicles WHERE plate = ?', {plate})
if result then
return GeneratePlate()
else
return plate:upper()
end
end
Describe the bug The qb-vehicleshop has a
generatePlate()
function. I changed that to get Swedish format on the licence plateThe changed plates work when buying a vehicle however, when trying to store it in
qb-garages
it says "This vehicle can't be stored" (thenot_owned
error)To Reproduce Steps to reproduce the behavior:
Expected behavior You should be able to store the vehicle no matter what licenceplate format you have
Questions (please complete the following information):
qb-
to something custom? noAdditional context I have also remove the check for a specific garage when a player takes out a vehicle to make the garages global which shouldn't affect this issue.