mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
refactor(client/vehicleProperties): check for tutorial session
This commit is contained in:
@@ -102,12 +102,15 @@ end)
|
|||||||
AddStateBagChangeHandler('ox_lib:setVehicleProperties', '', function(bagName, _, value)
|
AddStateBagChangeHandler('ox_lib:setVehicleProperties', '', function(bagName, _, value)
|
||||||
if not value or not GetEntityFromStateBagName then return end
|
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)
|
local entity = GetEntityFromStateBagName(bagName)
|
||||||
|
|
||||||
if entity > 0 then return entity end
|
if entity > 0 then return entity end
|
||||||
end)
|
end, '', 10000)
|
||||||
|
|
||||||
|
if not entityExists then return end
|
||||||
|
|
||||||
lib.setVehicleProperties(entity, value)
|
lib.setVehicleProperties(entity, value)
|
||||||
Wait(200)
|
Wait(200)
|
||||||
|
|||||||
Reference in New Issue
Block a user