-
Notifications
You must be signed in to change notification settings - Fork 29
/
imports.lua
44 lines (40 loc) · 1.5 KB
/
imports.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
ESX = exports['es_extended']:getSharedObject()
------------------------------------------------------------------------
-- SHARED
------------------------------------------------------------------------
local Intervals = {}
SetInterval = function(id, msec, callback, onclear)
if Intervals[id] and msec then
Intervals[id] = msec
else
CreateThread(function()
Intervals[id] = msec
repeat
Wait(Intervals[id])
callback(Intervals[id])
until Intervals[id] == -1 and (onclear and onclear() or true)
Intervals[id] = nil
end)
end
end
ClearInterval = function(id)
if Intervals[id] then Intervals[id] = -1 end
end
------------------------------------------------------------------------
if IsDuplicityVersion() then
------------------------------------------------------------------------
-- Clear out unneccesary garbage that gets copied over
ESX.Items, ESX.Jobs, ESX.UsableItemsCallbacks = {}, {}, {}
ESX.ServerCallbacks, ESX.CancelledTimeouts, ESX.RegisteredCommands = nil, nil, nil
------------------------------------------------------------------------
else -- CLIENT
------------------------------------------------------------------------
AddEventHandler('esx:setPlayerData', function(key, val, last)
if GetInvokingResource() == 'es_extended' then
ESX.PlayerData[key] = val
if OnPlayerData ~= nil then OnPlayerData(key, val, last) end
end
end)
------------------------------------------------------------------------
end
------------------------------------------------------------------------