mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-11-22 03:28:34 +00:00
revert, 2.0.0 is in new branch
This commit is contained in:
1 parent
593443cae5
commit
5389ae0962
13 files changed
+1265
-78
No files matched your search
@@ -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)
|
||||
Reference in new issue
Block a user