2025-04-07 20:52:59 +01:00
|
|
|
gameName = not IsDuplicityVersion() and GetCurrentGameName()
|
|
|
|
|
|
2025-03-01 12:58:43 +00:00
|
|
|
Exports = {
|
|
|
|
|
QBExport = "qb-core",
|
|
|
|
|
QBXExport = "qbx_core",
|
|
|
|
|
ESXExport = "es_extended",
|
|
|
|
|
OXCoreExport = "ox_core",
|
|
|
|
|
|
|
|
|
|
OXInv = "ox_inventory",
|
|
|
|
|
QBInv = "qb-inventory",
|
|
|
|
|
PSInv = "ps-inventory",
|
|
|
|
|
QSInv = "qs-inventory",
|
|
|
|
|
CoreInv = "core_inventory",
|
|
|
|
|
CodeMInv = "codem-inventory",
|
|
|
|
|
OrigenInv = "origen_inventory",
|
2025-04-30 17:53:26 +01:00
|
|
|
TgiannInv = "tgiann-inventory",
|
2025-06-13 23:25:32 +01:00
|
|
|
JPRInv = "jpr-inventory",
|
2025-03-01 12:58:43 +00:00
|
|
|
|
|
|
|
|
OXLibExport = "ox_lib",
|
|
|
|
|
|
|
|
|
|
QBMenuExport = "qb-menu",
|
|
|
|
|
|
|
|
|
|
QBTargetExport = "qb-target",
|
2025-04-07 20:52:59 +01:00
|
|
|
OXTargetExport = "ox_target",
|
|
|
|
|
|
|
|
|
|
-- REDM
|
|
|
|
|
RSGExport = "rsg-core",
|
|
|
|
|
RSGInv = "rsg-inventory"
|
2025-03-01 12:58:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Required variables
|
|
|
|
|
debugMode = Config.System.Debug
|
|
|
|
|
|
2025-05-01 20:05:00 +01:00
|
|
|
QBInvNew = true
|
2025-05-01 17:08:21 +01:00
|
|
|
|
|
|
|
|
InventoryWeight = 120000
|
|
|
|
|
|
|
|
|
|
-- [[ Server.Cfg Convar Check ]]--
|
|
|
|
|
-- Check server convars for hard set defaults, otherwise it uses per script configurations
|
2025-04-20 01:22:32 +01:00
|
|
|
if Config and Config.System then
|
|
|
|
|
if Config.System.Debug then
|
2025-04-20 19:17:16 +01:00
|
|
|
if GetConvar("jim_DisableDebug", "false") == "true" then
|
|
|
|
|
debugMode = false
|
|
|
|
|
end
|
|
|
|
|
if GetConvar("jim_DisableEventDebug", "false") == "true" then
|
|
|
|
|
Config.System.EventDebug = false
|
|
|
|
|
end
|
2025-04-20 01:22:32 +01:00
|
|
|
end
|
2025-04-20 19:17:16 +01:00
|
|
|
|
2025-04-20 01:22:32 +01:00
|
|
|
Config.System.Menu = GetConvar("jim_menuScript", Config.System.Menu)
|
2025-05-07 01:59:03 +01:00
|
|
|
Config.System.Notify = GetConvar("jim_notifyScript", Config.System.Notify or "gta")
|
|
|
|
|
Config.System.ProgressBar = GetConvar("jim_progressBarScript", Config.System.ProgressBar or "gta")
|
|
|
|
|
Config.System.drawText = GetConvar("jim_drawTextScript", Config.System.drawText or "gta")
|
|
|
|
|
Config.System.skillCheck = GetConvar("jim_skillCheckScript", Config.System.skillCheck or "gta")
|
2025-04-20 19:17:16 +01:00
|
|
|
|
|
|
|
|
if GetConvar("jim_dontUseTarget", "false") == "true" then
|
|
|
|
|
Config.System.DontUseTarget = true
|
2025-04-22 19:17:34 +01:00
|
|
|
end
|
2025-04-20 01:22:32 +01:00
|
|
|
end
|
|
|
|
|
|
2025-05-10 19:54:31 +01:00
|
|
|
-- Load the core files here instead of in fxmanifests
|
2025-05-07 13:55:12 +01:00
|
|
|
-- Forcefully loads the files and quietly, compared to fxmanifest complaining if they don't exist when you don't need them all
|
2025-05-10 19:54:31 +01:00
|
|
|
local filesToLoad = {
|
|
|
|
|
Shared = {
|
|
|
|
|
[Exports.OXLibExport] = { "init.lua" },
|
|
|
|
|
[Exports.OXCoreExport] = { "lib/init.lua" },
|
|
|
|
|
[Exports.ESXExport] = { "imports.lua" },
|
|
|
|
|
[Exports.QBXExport] = { "modules/playerdata.lua" },
|
|
|
|
|
},
|
|
|
|
|
Client = {
|
2025-05-07 13:55:12 +01:00
|
|
|
["PolyZone"] = { "client.lua", "BoxZone.lua", "EntityZone.lua", "CircleZone.lua", "ComboZone.lua" },
|
|
|
|
|
["warmenu"] = { "warmenu.lua", },
|
2025-05-10 19:54:31 +01:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Shared framework file loader
|
|
|
|
|
for Type, ScriptTable in pairs(filesToLoad) do
|
|
|
|
|
if Type == "Client" and IsDuplicityVersion() then
|
|
|
|
|
goto continue
|
|
|
|
|
else
|
|
|
|
|
for scriptName, files in pairs(ScriptTable) do
|
|
|
|
|
local state = GetResourceState(scriptName)
|
|
|
|
|
-- if the resource is started, load the file
|
|
|
|
|
if state == "started" then
|
2025-05-26 15:58:49 +01:00
|
|
|
if scriptName == Exports.OXLibExport and GetResourceState(Exports.OXCoreExport):find("start") then
|
|
|
|
|
if debugMode then print("OX_Core found, skipping OX_Lib loading") end
|
|
|
|
|
goto skip
|
|
|
|
|
end
|
2025-05-10 19:54:31 +01:00
|
|
|
-- Force items into a table if they are not
|
|
|
|
|
if type(files) == "string" then
|
|
|
|
|
files = { files }
|
|
|
|
|
end
|
|
|
|
|
for _, file in pairs(files) do
|
2025-05-17 19:19:15 +01:00
|
|
|
--print("^5CoreLoader^7: '"..scriptName.."/"..file.."' ^2into ^7'"..GetCurrentResourceName().."' ...")
|
2025-05-10 19:54:31 +01:00
|
|
|
local fileLoader = assert(load(LoadResourceFile(scriptName, (file)), ('@@'..scriptName..'/'..file)))
|
|
|
|
|
fileLoader()
|
2025-05-18 16:32:29 +01:00
|
|
|
if debugMode then
|
|
|
|
|
print("^5CoreLoader^7: ^2loaded ^1Core ^2file^7: ^3"..scriptName.."^7/^3"..(file):gsub("/", "^7/^3"):gsub("%.lua", "^7.lua").." ^2into ^7'"..GetCurrentResourceName().."'")
|
|
|
|
|
end
|
2025-05-10 19:54:31 +01:00
|
|
|
end
|
2025-05-26 15:58:49 +01:00
|
|
|
::skip::
|
2025-05-07 13:55:12 +01:00
|
|
|
end
|
|
|
|
|
|
2025-05-10 19:54:31 +01:00
|
|
|
-- if script is in server, but not started warn the user
|
|
|
|
|
if state == "uninitialized" or state == "stopped" then
|
|
|
|
|
print("^5CoreLoader^7: ^3"..scriptName.." ^1 found but it wasn't started^7.")
|
|
|
|
|
print("^1Check your ^3server^7.^3cfg ^1load order^7")
|
|
|
|
|
end
|
2025-05-07 13:55:12 +01:00
|
|
|
|
2025-05-10 19:54:31 +01:00
|
|
|
-- debugging only, if the script is missing, warn the user
|
|
|
|
|
if state == "missing" then
|
|
|
|
|
if debugMode then
|
|
|
|
|
print("^5CoreLoader^7: ^3"..scriptName.." ^2not found^7, ^2skipping")
|
|
|
|
|
end
|
2025-05-07 13:55:12 +01:00
|
|
|
end
|
2025-05-01 17:08:21 +01:00
|
|
|
end
|
|
|
|
|
end
|
2025-05-10 19:54:31 +01:00
|
|
|
::continue::
|
2025-05-01 17:08:21 +01:00
|
|
|
end
|
2025-04-29 12:26:49 +01:00
|
|
|
|
2025-03-01 12:58:43 +00:00
|
|
|
-- Load files here into the invoking script
|
|
|
|
|
for _, v in pairs({ -- This is a specific load order
|
2025-04-29 12:26:49 +01:00
|
|
|
|
2025-03-01 12:58:43 +00:00
|
|
|
'helpers.lua', -- needs to be first
|
|
|
|
|
'_loaders.lua',
|
|
|
|
|
|
|
|
|
|
'_eventDebug.lua',
|
|
|
|
|
'callback.lua',
|
2025-05-17 20:23:32 +01:00
|
|
|
'coreloader.lua',
|
2025-03-01 12:58:43 +00:00
|
|
|
|
|
|
|
|
'duifunctions.lua',
|
|
|
|
|
|
|
|
|
|
-- Native Scaleforms
|
2025-03-08 13:44:05 +00:00
|
|
|
'scaleforms/scaleform_basic.lua',
|
2025-03-01 12:58:43 +00:00
|
|
|
'scaleforms/bigMessageInstance.lua',
|
|
|
|
|
'scaleforms/countDownHandler.lua',
|
|
|
|
|
'scaleforms/debugScaleform.lua',
|
|
|
|
|
'scaleforms/instructionalButtons.lua',
|
|
|
|
|
'scaleforms/timerBars.lua',
|
|
|
|
|
|
|
|
|
|
-- Required functions
|
|
|
|
|
'make/loaders.lua',
|
|
|
|
|
'make/makeBlip.lua',
|
|
|
|
|
'make/makePed.lua',
|
|
|
|
|
'make/makeProp.lua',
|
|
|
|
|
'make/makeVeh.lua',
|
|
|
|
|
'make/cameras.lua',
|
|
|
|
|
'make/progressBars.lua',
|
|
|
|
|
|
|
|
|
|
'wrapperfunctions.lua',
|
|
|
|
|
'polyZone.lua',
|
2025-03-08 13:44:05 +00:00
|
|
|
'inventories.lua',
|
2025-03-01 12:58:43 +00:00
|
|
|
'itemcontrol.lua',
|
|
|
|
|
'playerfunctions.lua',
|
2025-03-06 23:49:07 +00:00
|
|
|
'metaHandlers.lua',
|
2025-03-01 12:58:43 +00:00
|
|
|
'jobfunctions.lua',
|
2025-03-08 13:44:05 +00:00
|
|
|
'societybank.lua',
|
|
|
|
|
'phones.lua',
|
2025-03-01 12:58:43 +00:00
|
|
|
|
|
|
|
|
-- Interactions
|
|
|
|
|
'targets.lua',
|
|
|
|
|
'contextmenus.lua',
|
|
|
|
|
'input.lua',
|
|
|
|
|
'notify.lua',
|
|
|
|
|
'drawText.lua',
|
2025-03-26 21:43:48 +00:00
|
|
|
'skillcheck.lua',
|
2025-03-01 12:58:43 +00:00
|
|
|
|
|
|
|
|
-- Crafting / Shops / Stashes
|
|
|
|
|
'crafting.lua',
|
2025-03-26 21:43:48 +00:00
|
|
|
'shops.lua',
|
2025-03-01 12:58:43 +00:00
|
|
|
'stashcontrol.lua',
|
|
|
|
|
|
|
|
|
|
-- Kind of "other"
|
|
|
|
|
'isAnimal.lua',
|
|
|
|
|
'scaleEntity.lua',
|
|
|
|
|
'vehicles.lua',
|
|
|
|
|
'effects.lua',
|
2025-03-08 13:44:05 +00:00
|
|
|
|
2025-06-06 00:39:24 +01:00
|
|
|
--'warmenu.lua',
|
2025-06-20 20:55:49 +01:00
|
|
|
'_authToken.lua',
|
2025-03-08 13:44:05 +00:00
|
|
|
-- Do version check last
|
2025-04-22 19:17:34 +01:00
|
|
|
'_scriptversioncheck.lua'
|
2025-03-01 12:58:43 +00:00
|
|
|
}) do
|
|
|
|
|
if debugMode then
|
2025-03-06 23:49:07 +00:00
|
|
|
--print("^5Loading^7: 'jim_bridge/shared/"..v.."' ^2into ^7'"..GetCurrentResourceName().."' ...")
|
2025-03-01 12:58:43 +00:00
|
|
|
end
|
|
|
|
|
local fileLoader = assert(load(LoadResourceFile('jim_bridge', ('shared/'..v)), ('@@jim_bridge/shared/'..v)))
|
|
|
|
|
fileLoader()
|
|
|
|
|
if debugMode then
|
2025-06-06 00:39:24 +01:00
|
|
|
print("^5CoreLoader^7: ^2loaded file^7: ^3"..(v):gsub("/", "^7/^3"):gsub("%.lua", "^7.lua").."^7")
|
2025-03-01 12:58:43 +00:00
|
|
|
end
|
2025-06-10 18:26:57 +01:00
|
|
|
end
|
|
|
|
|
|
2025-06-22 17:45:33 +01:00
|
|
|
-- Auto Detection of Old/New QBInv/PSInv versions --
|
|
|
|
|
|
2025-06-10 18:26:57 +01:00
|
|
|
if isStarted(QBInv) then
|
2025-06-22 17:45:33 +01:00
|
|
|
if isServer() then
|
|
|
|
|
if not checkExportExists(QBInv, "CreateShop") then
|
|
|
|
|
print("^6Bridge^7: ^2Can^7'^2t ^2find new ^4"..QBInv.."^2 export^7, ^2forcing ^1QBInvNew ^2to ^1false^7")
|
|
|
|
|
QBInvNew = false
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if checkExportExists(QBInv, "GetTrunkSize") then
|
|
|
|
|
print("^6Bridge^7: ^2Found old ^4"..QBInv.."^3 export^7, ^2forcing ^1QBInvNew ^2to ^1false^7")
|
|
|
|
|
QBInvNew = false
|
|
|
|
|
end
|
2025-06-10 18:26:57 +01:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if isStarted(PSInv) then
|
2025-06-22 17:45:33 +01:00
|
|
|
if isServer() then
|
|
|
|
|
if not checkExportExists(PSInv, "CreateShop") then
|
|
|
|
|
print("^6Bridge^7: ^2Can^7'^2t ^2find new ^4"..PSInv.."^2 export^7, ^2forcing ^1QBInvNew ^2to ^1false^7")
|
|
|
|
|
QBInvNew = false
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local function versionCompare(v1, v2)
|
|
|
|
|
local split = function(v) local t = {} for s in v:gmatch("[^.]+") do t[#t+1] = tonumber(s) end return t end
|
|
|
|
|
local a, b = split(v1), split(v2)
|
|
|
|
|
for i = 1, math.max(#a, #b) do
|
|
|
|
|
local ai, bi = a[i] or 0, b[i] or 0
|
|
|
|
|
if ai > bi then return true
|
|
|
|
|
elseif ai < bi then return false end
|
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if versionCompare(GetResourceMetadata("ps-inventory", "version", 0), "1.0.6") then
|
|
|
|
|
print("^6Bridge^7: ^4"..PSInv.."^2 Version above ^31.0.6^7, ^2forcing ^1QBInvNew ^2to ^1true^7")
|
|
|
|
|
QBInvNew = true
|
|
|
|
|
else
|
|
|
|
|
print("^6Bridge^7: ^4"..PSInv.."^2 Version ^1below ^31.0.6^7, ^2forcing ^1QBInvNew ^2to ^1false^7")
|
|
|
|
|
QBInvNew = false
|
|
|
|
|
end
|
2025-06-10 18:26:57 +01:00
|
|
|
end
|
|
|
|
|
end
|