revert, 2.0.0 is in new branch

This commit is contained in:
Andyyy7666
2023-07-10 02:40:39 +02:00
parent 593443cae5
commit 5389ae0962
13 changed files with 1265 additions and 78 deletions

30
shared/main.lua Normal file
View File

@@ -0,0 +1,30 @@
local startedResources = {}
local callbacks = {}
AddEventHandler("onResourceStart", function(resourceName)
startedResources[resourceName] = true
local callback = callbacks[resourceName]
if not callback then return end
callback(true)
end)
AddEventHandler("onResourceStop", function(resourceName)
startedResources[resourceName] = nil
local callback = callbacks[resourceName]
if not callback then return end
callback(false)
end)
function isResourceStarted(resourceName, cb)
local started = GetResourceState(resourceName) == "started"
startedResources[resourceName] = started
if cb then
callbacks[resourceName] = cb
cb(started)
end
return started
end
exports("isResourceStarted", isResourceStarted)