Skip to content

Commit

Permalink
check if vehicle exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Manason committed Dec 1, 2024
1 parent c77e334 commit ee4e46a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions bridge/qb/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ local function giveKeys(source, plate)
local vehicles = plate and GetVehiclesFromPlate(plate) or {GetVehiclePedIsIn(GetPlayerPed(source), false)}
local success = false
for i = 1, #vehicles do
if GiveKeys(source, vehicles[i], true) then
success = true
local vehicle = vehicles[i]
if DoesEntityExist(vehicle) then
if GiveKeys(source, vehicles[i], true) then
success = true
end
Wait(20)
end
Wait(20)
end
if success then
exports.qbx_core:Notify(source, locale('notify.keys_taken'))
Expand All @@ -21,10 +24,13 @@ local function removeKeys(source, plate)
local vehicles = GetVehiclesFromPlate(plate)
local success = false
for i = 1, #vehicles do
if RemoveKeys(source, vehicles[i], true) then
success = true
local vehicle = vehicles[i]
if DoesEntityExist(vehicle) then
if RemoveKeys(source, vehicle, true) then
success = true
end
Wait(20)
end
Wait(20)
end
if success then
exports.qbx_core:Notify(source, locale('notify.keys_removed'))
Expand Down

0 comments on commit ee4e46a

Please sign in to comment.