Skip to content

Commit

Permalink
fix(bridge): statebag spam (#157)
Browse files Browse the repository at this point in the history
* fix(bridge): statebag spam

* check if vehicle exists
  • Loading branch information
Manason authored Dec 1, 2024
1 parent 853b61c commit 38a7883
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions bridge/qb/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ 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
end
if success then
Expand All @@ -20,8 +24,12 @@ 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
end
if success then
Expand Down

0 comments on commit 38a7883

Please sign in to comment.