From e0f6f47cc70d15234e45fcc1fabca47a35e3e7f6 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sun, 14 Jul 2024 16:35:27 +1000 Subject: [PATCH] refactor(client/vehicleProperties): check for tutorial session --- resource/vehicleProperties/client.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resource/vehicleProperties/client.lua b/resource/vehicleProperties/client.lua index b2a0aba..9e15060 100644 --- a/resource/vehicleProperties/client.lua +++ b/resource/vehicleProperties/client.lua @@ -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)