-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
36 lines (30 loc) · 1.23 KB
/
init.lua
File metadata and controls
36 lines (30 loc) · 1.23 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
local Init = {}
Init.__index = Init
--- Detect the framework and load the corresponding modules.
function Init:detectFramework()
if GetResourceState('es_extended') == 'started' then
self.framework = 'ESX'
self.ESX = exports['es_extended']:getSharedObject()
print('[Bridge] ESX framework detected.')
elseif GetResourceState('qb-core') == 'started' then
self.framework = 'QBCore'
self.QBCore = exports['qb-core']:GetCoreObject()
print('[Bridge] QBCore framework detected.')
else
self.framework = 'Standalone'
print('[Bridge] No supported framework detected. Running in standalone mode.')
end
end
--- Initialize the Init object and load the necessary modules.
function Init:new()
local self = setmetatable({}, Init)
self:detectFramework() -- Detect framework when initializing
-- Load individual modules and pass the self (the framework instance)
self.Player = require('modules.Player.player')(self)
self.Money = require('modules.Money.money')(self)
self.Notify = require('modules.Notification.notify')(self)
return self
end
-- Singleton instance to use the Init object across files
local frameworkInstance = Init:new()
return frameworkInstance