Repository navigation
Expand file tree
/
Copy pathinit.lua
More file actions
98 lines (81 loc) · 3.26 KB
/
Copy pathinit.lua
File metadata and controls
98 lines (81 loc) · 3.26 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
if not lib.loadJson or not lib.checkDependency('ox_lib', "3.19.2") then
print("ox_lib is outdated, this resource will not work")
print("please update ox_lib")
print("ox_lib is outdated, this resource will not work")
print("please update ox_lib")
print("ox_lib is outdated, this resource will not work")
print("please update ox_lib")
print("ox_lib is outdated, this resource will not work")
print("please update ox_lib")
error("ox_lib is outdated, this resource will not work")
end
--[[ Timer Start ]]
local start_timer = GetGameTimer()
FrameworkObj, QBCore, ESX = nil, nil, nil
CurrentFramework = nil
---@class Luxu
local Luxu = {
utils = {},
}
_ENV.Luxu = Luxu
ResourceName = GetCurrentResourceName()
local LoadResourceFile = LoadResourceFile
local context = IsDuplicityVersion() and 'server' or 'client'
function IsResourceRunning(resource)
return GetResourceState(resource) == 'started'
end
-- Dont Duplicate LuxuModules Config
if ResourceName ~= "LuxuModules" then
--[[ Load Config ]]
require '@LuxuModules.config'
end
--[[ Load Shared ]]
Luxu.utils = require '@LuxuModules.shared.utils'
--[[ error(("Error loading utils %s"):format(err), 3) ]]
--[[ Load Framework ]]
FrameworkObj = require '@LuxuModules.shared.framework'
QBCore = FrameworkObj
ESX = FrameworkObj
--[[ Refresh Framework Object ]]
RegisterNetEvent('QBCore:Client:UpdateObject', function()
FrameworkObj = require '@LuxuModules.shared.framework'
QBCore = FrameworkObj
end)
RegisterNetEvent('QBCore:Server:UpdateObject', function()
if source ~= '' then return false end
FrameworkObj = require '@LuxuModules.shared.framework'
QBCore = FrameworkObj
end)
--[[ error(("Error loading framework %s"):format(err), 3) ]]
--[[ Load Client and Server ]]
if context == 'client' then
local list = { 'client.lua', 'cl_utils.lua' }
for _, v in ipairs(list) do
local file = LoadResourceFile('LuxuModules', ('client/%s'):format(v))
if file then
local chunk = load(file)
if chunk then pcall(chunk) else error(("Error Loading Chunk %s"):format(v)) end
end
end
elseif context == 'server' then
local list = { 'server.lua', 'sv_utils.lua' }
for _, v in ipairs(list) do
local file = LoadResourceFile('LuxuModules', ('server/%s'):format(v))
if file then
local chunk = load(file)
if chunk then pcall(chunk) else error(("Error Loading Chunk %s"):format(v)) end
end
end
--[[ Check for Onesync ]]
if Config.OnesyncInfity_Checker or Config.OnesyncInfinityChecker then
local "false")
if 'false' then
error('onesync is not enabled, please enable it to use this script.')
elseif 'legacy' then
error('onesync legacy detected, please enable onesync infinity')
else
print("Onesync Infinity is enabled!")
end
end
end
print(('[%s] initialized LuxuModules in %s ms!'):format(ResourceName, GetGameTimer() - start_timer))