mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +01:00
Add automated check for QBInv version
Currently if you still have the old qb-inventory or a css edit it would require you to manually edit the starter.lua
```lua
QBInvNew = true
```
I'm testing a change to grab the version and return true of false if its above `2.0.0` (200)
```lua
local qbInvVer = GetResourceMetadata(Exports.QBInv, 'version', nil):gsub("%.", "")
QBInvNew = tonumber(qbInvVer) >= 200
```
If this causes issue's I'll revert this
This commit is contained in:
54
starter.lua
54
starter.lua
@@ -30,7 +30,15 @@ Exports = {
|
|||||||
-- Required variables
|
-- Required variables
|
||||||
debugMode = Config.System.Debug
|
debugMode = Config.System.Debug
|
||||||
|
|
||||||
-- Check server convars for hard set defaults
|
-- Testing a new check for new inventory, otherwise it will use the old calls for qb-inv
|
||||||
|
-- It's messy, and doesn't take in to account if you have text in the version like "beta"
|
||||||
|
local qbInvVer = GetResourceMetadata(Exports.QBInv, 'version', nil):gsub("%.", "")
|
||||||
|
QBInvNew = tonumber(qbInvVer) >= 200 -- if your qb inv version is 2.0.0 or above, then its classed as "new"
|
||||||
|
|
||||||
|
InventoryWeight = 120000
|
||||||
|
|
||||||
|
-- [[ Server.Cfg Convar Check ]]--
|
||||||
|
-- Check server convars for hard set defaults, otherwise it uses per script configurations
|
||||||
if Config and Config.System then
|
if Config and Config.System then
|
||||||
if Config.System.Debug then
|
if Config.System.Debug then
|
||||||
if GetConvar("jim_DisableDebug", "false") == "true" then
|
if GetConvar("jim_DisableDebug", "false") == "true" then
|
||||||
@@ -52,28 +60,28 @@ if Config and Config.System then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
QBInvNew = true
|
|
||||||
|
|
||||||
InventoryWeight = 120000
|
|
||||||
|
|
||||||
-- Testing loading the core files here instead of in fxmanifests
|
-- Testing loading the core files here instead of in fxmanifests
|
||||||
--for k, v in pairs({ -- This is a specific load order
|
-- Forcefully loads the files and quietly, compared to fxmanifest complaining if they don't exist
|
||||||
-- [Exports.OXLibExport] = "init.lua",
|
-- This may be better button would require more refinement maybe
|
||||||
-- [Exports.OXCoreExport] = "lib/init.lua",
|
--[[
|
||||||
-- [Exports.ESXExport] = "imports.lua",
|
for k, v in pairs({ -- This is a specific load order
|
||||||
-- [Exports.QBXExport] = "modules/playerdata.lua",
|
[Exports.OXLibExport] = "init.lua",
|
||||||
--}) do
|
[Exports.OXCoreExport] = "lib/init.lua",
|
||||||
-- if GetResourceState(k) == "started" then
|
[Exports.ESXExport] = "imports.lua",
|
||||||
-- print("^5Loading^7: '"..k.."/"..v.."' ^2into ^7'"..GetCurrentResourceName().."' ...")
|
[Exports.QBXExport] = "modules/playerdata.lua",
|
||||||
-- local fileLoader = assert(load(LoadResourceFile(k, (v)), ('@@'..k..'/'..v)))
|
}) do
|
||||||
-- fileLoader()
|
if GetResourceState(k) == "started" then
|
||||||
-- print("^2Success^7: ^2loaded ^1Core ^2file^7: ^3"..k.."^7/^3"..(v):gsub("/", "^7/^3"):gsub("%.lua", "^7.lua").."^7")
|
print("^5Loading^7: '"..k.."/"..v.."' ^2into ^7'"..GetCurrentResourceName().."' ...")
|
||||||
-- else
|
local fileLoader = assert(load(LoadResourceFile(k, (v)), ('@@'..k..'/'..v)))
|
||||||
-- if debugMode then
|
fileLoader()
|
||||||
-- print("^3Warning^7: ^3"..k.." ^2not found^7, ^2skipping")
|
print("^2Success^7: ^2loaded ^1Core ^2file^7: ^3"..k.."^7/^3"..(v):gsub("/", "^7/^3"):gsub("%.lua", "^7.lua").."^7")
|
||||||
-- end
|
else
|
||||||
-- end
|
if debugMode then
|
||||||
--end
|
print("^3Warning^7: ^3"..k.." ^2not found^7, ^2skipping")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
-- Load files here into the invoking script
|
-- Load files here into the invoking script
|
||||||
for _, v in pairs({ -- This is a specific load order
|
for _, v in pairs({ -- This is a specific load order
|
||||||
@@ -144,4 +152,4 @@ for _, v in pairs({ -- This is a specific load order
|
|||||||
if debugMode then
|
if debugMode then
|
||||||
print("^5Success^7: ^2loaded file^7: ^3"..(v):gsub("/", "^7/^3"):gsub("%.lua", "^7.lua").."^7")
|
print("^5Success^7: ^2loaded file^7: ^3"..(v):gsub("/", "^7/^3"):gsub("%.lua", "^7.lua").."^7")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user