From 12b30c30d6ba020e1f9bf668e7bd996adfadbf5b Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Fri, 2 Dec 2022 21:49:18 +0100 Subject: [PATCH] tweak: check for inventory --- fxmanifest.lua | 2 +- server/main.lua | 8 ++------ shared/main.lua | 7 ++++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 7f1bbee..5ba6baa 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -34,4 +34,4 @@ server_exports { "GetCoreObject" } -dependency "oxmysql" +dependency "oxmysql" \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 3110bb9..2f18d62 100644 --- a/server/main.lua +++ b/server/main.lua @@ -25,14 +25,10 @@ CreateThread(function() end end) -AddEventHandler("onResourceStart", function(resourceName) - Wait(3000) - if resourceName ~= "ox_inventory" then return end +isResourceStarted("ox_inventory", function(started) + if not started then return end SetConvarReplicated("inventory:framework", "nd") end) -if GetResourceState("ox_inventory") == "started" then - SetConvarReplicated("inventory:framework", "nd") -end for _, roleid in pairs(config.adminRoles) do ExecuteCommand("add_principal identifier.discord:" .. roleid .. " group.admin") diff --git a/shared/main.lua b/shared/main.lua index 41b8772..948dd79 100644 --- a/shared/main.lua +++ b/shared/main.lua @@ -18,7 +18,12 @@ end) function isResourceStarted(resourceName, cb) local started = GetResourceState(resourceName) == "started" startedResources[resourceName] = started - callbacks[resourceName] = cb + + if cb then + callbacks[resourceName] = cb + cb(started) + end + return started end