Skip to content

Commit

Permalink
refactor(client/vehicleProperties): check for tutorial session
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Jul 14, 2024
1 parent c45aa0d commit e0f6f47
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions resource/vehicleProperties/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,15 @@ end)
AddStateBagChangeHandler('ox_lib:setVehicleProperties', '', function(bagName, _, value)
if not value or not GetEntityFromStateBagName then return end

local entity = lib.waitFor(function()
while NetworkIsInTutorialSession() do Wait(0) end

local entityExists, entity = pcall(lib.waitFor, function()
local entity = GetEntityFromStateBagName(bagName)

if entity > 0 then return entity end
end)
end, '', 10000)

if not entityExists then return end

lib.setVehicleProperties(entity, value)
Wait(200)
Expand Down

0 comments on commit e0f6f47

Please sign in to comment.