mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Implemented unregisterStatus and fixed restarting script midgame
This commit is contained in:
+18
-2
@@ -1,5 +1,12 @@
|
||||
local Status = {}
|
||||
local isPaused = false
|
||||
ESX = nil
|
||||
local Status, isPaused = {}, false
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
|
||||
function GetStatusData(minimal)
|
||||
local status = {}
|
||||
@@ -31,6 +38,15 @@ AddEventHandler('esx_status:registerStatus', function(name, default, color, visi
|
||||
table.insert(Status, status)
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_status:unregisterStatus', function(name)
|
||||
for k,v in ipairs(Status) do
|
||||
if v.name == name then
|
||||
table.remove(Status, k)
|
||||
break
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_status:load')
|
||||
AddEventHandler('esx_status:load', function(status)
|
||||
for i=1, #Status, 1 do
|
||||
|
||||
Reference in New Issue
Block a user