MojiaGarages
MojiaGarages copied to clipboard
Lose keys after tsunami (new qb-vehiclekeys)
So the cars stay after tsunami but the players lose their keys, its fine when they quit or dc but not after tsunami
Same here, any cars that are parked outside the garage, they are unable to access as they don't have the key.
no fix anyone?
I've got the same issue too
Add this (anywhere) to your qb-vehiclekeys/server.lua
RegisterNetEvent('vehiclekeys:server:CheckOwnerExt')
AddEventHandler('vehiclekeys:server:CheckOwnerExt', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
exports.oxmysql:execute('SELECT citizenid, plate FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid}, function(result)
if #result > 0 then
for i = 1, #result do
TriggerClientEvent('vehiclekeys:client:SetOwner', src, result[i].plate)
end
end
end)
end)
And add this at the beginning of qb-vehiclekeys/client.lua
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
local Player = QBCore.Functions.GetPlayerData()
TriggerServerEvent('vehiclekeys:server:CheckOwnerExt')
end)
This was kindly provided by a user!
The only issue I had was that when you load into the city, you get a notification that you received keys for every vehicle you owned. I removed the notify event for that so it wouldn't happen.
cheers for the fix JustMeGaming .... any chance you could tell a noob like myself how to turn notifications for keys off i like to have alot of cars lol @JustMeGaming