-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshared.lua
More file actions
73 lines (71 loc) · 1.85 KB
/
Copy pathshared.lua
File metadata and controls
73 lines (71 loc) · 1.85 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
CurrentResourceName = GetCurrentResourceName()
Resources = {}
local data = LoadResourceFile(CurrentResourceName,'config.lua')
local Config = assert(load(data))()
local d_registered = false
---@param ... any
function Debug(...)
if Config.Debug then
if IsDuplicityVersion() then
print('[^5DEBUG^0]',...)
else
TriggerServerEvent('fg:addon:debug', ...)
end
end
end
if Config.Debug and not d_registered then
RegisterNetEvent('fg:addon:debug', function(...)
print('[^5DEBUG-CLIENT^0]', source, ...)
end)
d_registered = true
end
---@param ... any
function Error(...)
print('[^1ERROR^0]^1',...,'^0')
end
---@param ... any
function Warn(...)
print('[^3WARN^0]', ...,'^0')
end
---@param ... any
function Info(...)
print('[^2INFO^0]', ...,'^0')
end
local pros = promise.new()
Citizen.CreateThread(function()
local attempts = 0
local found = nil
while attempts < 5 and not found do
local resources = GetNumResources()
for i = 0, resources - 1 do
local resource = GetResourceByFindIndex(i)
Resources[resource] = true
local files = GetNumResourceMetadata(resource, 'ac')
for j = 0, files - 1 do
local x = GetResourceMetadata(resource, 'ac', j)
if x:find('fg') then
found = resource
end
end
end
if not found then
attempts = attempts + 1
Citizen.Wait(0)
end
end
if found then
pros:resolve(found)
else
pros:reject('Fiveguard not found! Get it on https://discord.gg/gpXNsFe2PE (Fiveguard Italy)')
end
end)
do
local success, result = pcall(function()
return Citizen.Await(pros)
end)
if success then
Fiveguard = result
else
Error(result)
end
end