From beb67b79a55638359f66ae245dc5aa6fe23ec27f Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Tue, 7 Oct 2025 21:07:31 +0100 Subject: [PATCH 01/13] Auto adjust boxes with poorly set minZ and maxZ Automatically adjusts box targets for custom locations that have been set wrong if minZ is too high, adjust it if maxZ is too low, adjust it and warn the client that the target has to be adjusted. Solves people opening tickets because they half edited a location without reading my docs --- shared/helpers.lua | 14 ++++++++++++++ shared/targets.lua | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/shared/helpers.lua b/shared/helpers.lua index f26f4d6..a8ab573 100644 --- a/shared/helpers.lua +++ b/shared/helpers.lua @@ -956,4 +956,18 @@ end function GetEntityForwardVector(entity) local heading = math.rad(GetEntityHeading(entity) + 90) return vec3(math.cos(heading), math.sin(heading), 0.0) +end + +function adjustMinMaxZ(coord, table) + local table = table + local adMinZ, adMaxZ = false, false + if table.minZ > coord.z then + adMinZ = true + table.minZ = (coord.z - 1.05) + end + if table.maxZ < coord.z then + adMinZ = true + table.maxZ = (coord.z + 0.80) + end + return table.minZ, table.maxZ, adMinZ, adMaxZ end \ No newline at end of file diff --git a/shared/targets.lua b/shared/targets.lua index e90d5fa..d336831 100644 --- a/shared/targets.lua +++ b/shared/targets.lua @@ -336,6 +336,13 @@ function createBoxTarget(data, opts, dist) local script = targetFunc[i] if isStarted(script.targetName) then debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1]) + if data[5].minZ or data[5].maxZ then + local adMinZ, adMaxZ + data[5].minZ, data[5].maxZ, adMinZ, adMaxZ = adjustMinMaxZ(data[2], { minZ = data[5].minZ, maxZ = data[5].maxZ }) + if adMinZ or adMaxZ then + print("^5Debug^7: ^2Auto adjusted ^7'^4"..data[1].."^7' ^2minZ and maxZ because ^1they weren't set correctly ^2remove or fix them for this target") + end + end local target = script.boxTarget(data, opts, dist) boxTargets[#boxTargets + 1] = target return target From 180cc7b2a234b3d9fb960f46d9cfb904574cd7c9 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Wed, 8 Oct 2025 22:53:36 +0100 Subject: [PATCH 02/13] Add new `createPropTarget()` function This is intended to help create automated prop based targets Using the coordinates and specified prop models dimensions to create a correctly sized box target. ```lua createPropTarget({ name, target.prop.coords, target.prop.model, }, options, 2.0) ``` --- shared/targets.lua | 47 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/shared/targets.lua b/shared/targets.lua index d336831..4f53404 100644 --- a/shared/targets.lua +++ b/shared/targets.lua @@ -252,7 +252,7 @@ function createEntityTarget(entity, opts, dist) -- Store the target entity for later cleanup. targetEntities[#targetEntities + 1] = entity - -- if force target off, use jim_bridge buiilt in target functions + -- if force target off, use jim_bridge built in target functions if Config.System.DontUseTarget then exports.jim_bridge:createEntityTarget(entity, opts, dist) debugPrint("^6Bridge^7: ^2Creating new ^3Entity ^2target with ^6jim_bridge ^2for entity ^7"..entity) @@ -325,7 +325,7 @@ end ---``` function createBoxTarget(data, opts, dist) - -- if force target off, use jim_bridge buiilt in target functions + -- if force target off, use jim_bridge built in target functions if Config.System.DontUseTarget then debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6jim_bridge ^7"..data[1]) return exports.jim_bridge:createZoneTarget(data, opts, dist) @@ -351,6 +351,45 @@ function createBoxTarget(data, opts, dist) return nil end + +function createPropTarget(data, opts, dist) + -- Audo create a location based on a coord and a prop models dimensions + local width, depth, _ = GetPropDimensions(data[3]) + local min, max = GetModelDimensions(data[3]) + local coordAdjustment = data[2] - vec4(0, 0, 1.03, 0) + local newData = { + [1] = data[1], + [2] = coordAdjustment.xyz, + [3] = width + 0.1, + [4] = depth + 0.1, + [5] = { + name = data[1], + heading = coordAdjustment.w - 90.0, + debugPoly = debugMode, + minZ = coordAdjustment.z + (min.z) - 0.1, + maxZ = coordAdjustment.z + (max.z) + 0.1, + } + } + -- if force target off, use jim_bridge built in target functions + if Config.System.DontUseTarget then + debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6jim_bridge ^7"..data[1]) + return exports.jim_bridge:createZoneTarget(newData, opts, dist) + end + + -- Check for target script and use that + for i = 1, #targetFunc do + local script = targetFunc[i] + if isStarted(script.targetName) then + debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1]) + local target = script.boxTarget(newData, opts, dist) + boxTargets[#boxTargets + 1] = target + return target + end + end + return nil +end + + ------------------------------------------------------------- -- Circle Zone Target Creation ------------------------------------------------------------- @@ -389,7 +428,7 @@ end --- ``` function createCircleTarget(data, opts, dist) - -- if force target off, use jim_bridge buiilt in target functions + -- if force target off, use jim_bridge built in target functions if Config.System.DontUseTarget then debugPrint("^6Bridge^7: ^2Creating new ^3Sphere ^2target with ^6jim_bridge ^7"..data[1]) return exports.jim_bridge:createZoneTarget(data, opts, dist) @@ -436,7 +475,7 @@ end ---``` function createModelTarget(models, opts, dist) - -- if force target off, use jim_bridge buiilt in target functions + -- if force target off, use jim_bridge built in target functions if Config.System.DontUseTarget then debugPrint("^6Bridge^7: ^2Creating new ^3Model ^2target with ^6jim_bridge^7") return exports.jim_bridge:createModelTarget(models, opts, dist) From b282d3393fc7a939dad25badaa814636061ef2d5 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 9 Oct 2025 17:55:54 +0100 Subject: [PATCH 03/13] make the auto check for minZ and maxZ more lenient --- shared/helpers.lua | 4 ++-- shared/targets.lua | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/shared/helpers.lua b/shared/helpers.lua index a8ab573..42e77c2 100644 --- a/shared/helpers.lua +++ b/shared/helpers.lua @@ -961,11 +961,11 @@ end function adjustMinMaxZ(coord, table) local table = table local adMinZ, adMaxZ = false, false - if table.minZ > coord.z then + if table.minZ > (coord.z + 0.1) then adMinZ = true table.minZ = (coord.z - 1.05) end - if table.maxZ < coord.z then + if table.maxZ < (coord.z - 0.1) then adMinZ = true table.maxZ = (coord.z + 0.80) end diff --git a/shared/targets.lua b/shared/targets.lua index 4f53404..2ed3f69 100644 --- a/shared/targets.lua +++ b/shared/targets.lua @@ -324,7 +324,6 @@ end ---}, 2.0) ---``` function createBoxTarget(data, opts, dist) - -- if force target off, use jim_bridge built in target functions if Config.System.DontUseTarget then debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6jim_bridge ^7"..data[1]) From 13b0f796ffb070c6272433261faf006225bf1777 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 9 Oct 2025 20:04:54 +0100 Subject: [PATCH 04/13] createPropTarget also makes the prop --- shared/targets.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared/targets.lua b/shared/targets.lua index 2ed3f69..0f2921a 100644 --- a/shared/targets.lua +++ b/shared/targets.lua @@ -369,6 +369,11 @@ function createPropTarget(data, opts, dist) maxZ = coordAdjustment.z + (max.z) + 0.1, } } + + if data[3] then -- If spawning a prop, make entity target instead (ignores depth and width stuff) + makeDistProp({ prop = data[3], coords = data[2] }, true, false) + end + -- if force target off, use jim_bridge built in target functions if Config.System.DontUseTarget then debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6jim_bridge ^7"..data[1]) From 98f8944a7913a3699035811eb183e48c7d768d22 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 9 Oct 2025 20:05:15 +0100 Subject: [PATCH 05/13] Add `codem` option for billing --- shared/playerfunctions.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/playerfunctions.lua b/shared/playerfunctions.lua index 768778c..f9b27f3 100644 --- a/shared/playerfunctions.lua +++ b/shared/playerfunctions.lua @@ -217,6 +217,10 @@ local billPlayerFunc = { function(data) TriggerEvent("okokBilling:ToggleCreateInvoice") end, + codem = + function(data) + TriggerEvent("codem-billing:client:OpenMenu") + end, } --- BillPlayer From a13284d0e0740e12689e3431a2eb3733547b4a31 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 9 Oct 2025 20:12:05 +0100 Subject: [PATCH 06/13] Add support for 17mov progressbars --- shared/make/progressBars.lua | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/shared/make/progressBars.lua b/shared/make/progressBars.lua index 15c1b94..9ebcc80 100644 --- a/shared/make/progressBars.lua +++ b/shared/make/progressBars.lua @@ -206,6 +206,52 @@ local progressFunc = { exports.jim_bridge:stopProgressBar() end, }, + + ["17mov"] = { + start = + function(data) + if exports["17mov_Hud"]:StartProgress({ + duration = debugMode and 1000 or data.time, + label = data.label, + useWhileDead = data.dead or false, + canCancel = data.cancel or true, + controlDisables = { + disableMovement = data.disableMovement or false, + disableCarMovement = data.disableMovement or false, + disableMouse = data.mouse or false, + disableCombat = data.combat or true, + }, + animation = { + animDict = data.dict, + anim = data.anim, + flags = (data.flag == 8 and 32 or data.flag) or nil, + task = data.task, + }, + prop = data.prop and { + model = data.prop.model, + bone = data.prop.bone or 0, + coords = data.prop.pos or vec3(0, 0, 0), + rotation = data.prop.rot or vec3(0, 0, 0), + + } or nil, + propTwo = data.propTwo and { + model = data.propTwo.model, + bone = data.propTwo.bone or 0, + coords = data.propTwo.pos or vec3(0, 0, 0), + rotation = data.propTwo.rot or vec3(0, 0, 0), + } or nil, + + }, nil, nil) then + return true + else + return false + end + end, + stop = + function() + exports["17mov_Hud"]:StopProgress() + end, + }, } --- Displays a progress bar using the configured progress bar system. From ae4637f9c417ab09073209a747949b732f702b5b Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Fri, 10 Oct 2025 00:40:35 +0100 Subject: [PATCH 07/13] Fix OrigenInv `getPlayerInv()` func calling OX_Inv --- shared/itemcontrol.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index 614863e..cdc387a 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -272,15 +272,15 @@ local InvFunc = { function(src) local grabInv = nil if src then - grabInv = exports[OXInv]:GetInventoryItems(src) + grabInv = exports[OrigenInv]:GetInventoryItems(src) else - grabInv = exports[OXInv]:GetPlayerItems() + grabInv = exports[OrigenInv]:GetInventory() end return grabInv end, invImg = function(item) - return "nui://"..OrigenInv.."/html/img/"..(Items[item].image or "") + return "nui://"..OrigenInv.."/html/images/"..(Items[item].image or "") end, openShop = function(name, label, items) From ad478362322bfed6fddaef39963c3f36df29789f Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Fri, 10 Oct 2025 01:41:52 +0100 Subject: [PATCH 08/13] All grabbox to recieve slot and maxweight --- shared/itemcontrol.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index cdc387a..6fc4ec0 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -2548,7 +2548,7 @@ if isServer() then end) end -RegisterNetEvent(getScript()..":openGrabBox", function(data) +RegisterNetEvent(getScript()..":openGrabBox", function(data, stashData) local Ped = PlayerPedId() local id = data.metadata and data.metadata.id or data.info and data.info.id or "" @@ -2559,7 +2559,9 @@ RegisterNetEvent(getScript()..":openGrabBox", function(data) openStash({ stash = id, - coords = GetEntityCoords(Ped) + coords = GetEntityCoords(Ped), + maxWeight = stashData and stashData.slots or 100000, + slots = stashData and stashData.slots or 5, }) end) From 9f914bd4974bde76d08444b4a6597f4856e24b87 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Fri, 10 Oct 2025 02:55:16 +0100 Subject: [PATCH 09/13] Fix embedded store handling --- shared/itemcontrol.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index 6fc4ec0..cf226d6 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -1377,7 +1377,6 @@ function getPlayerInv(src) grabInv = triggerCallback(getScript()..":GetESXInv") end end - --jsonPrint(grabInv) end if grabInv == nil then @@ -2356,7 +2355,6 @@ function getStash(stashName) end debugPrint("^6Bridge^7: ^3GetStashItems^7: ^2Stash information for '^6"..stashName.."^7' retrieved") end - --jsonPrint(items) return items end @@ -2783,11 +2781,10 @@ end --- }) --- ``` function openShop(data) - --jsonPrint(data) if (data.job or data.gang) and not jobCheck(data.job or data.gang) then return end -- If shop has registered coords, limit players from being too far away from it when opening - local exploitCheck = triggerCallback(getScript()..":getRegisteredShopLocation", data.originShop or data.shop) + local exploitCheck = triggerCallback(getScript()..":getRegisteredShopLocation", data.shop) if not exploitCheck then print("^3Warning^7: ^2This isn't a registered store^1, refusing call^7") return @@ -2804,16 +2801,14 @@ function openShop(data) end if not data.items.items[1] then local shopMenu = {} - --jsonPrint(data.items) for k, v in pairs(data.items.items) do - print(v.header) local clonedTable = cloneTable(data) local itemsTable = v.items or v.Items shopMenu[#shopMenu+1] = { header = v.header or k, txt = countTable(itemsTable).." Products", onSelect = function() - clonedTable.originShop = data.shop + --clonedTable.originShop = data.shop clonedTable.shop = data.shop.."_"..k clonedTable.label = data.items.label.." - "..(v.header or k) clonedTable.slots = #itemsTable @@ -2849,7 +2844,7 @@ RegisterNetEvent(getScript()..':server:openServerShop', function(shopName) -- If shop has registered coords, limit players from being too far away from it when opening if not shopExploitCheck[shopName] then - print("^3Warning^7: ^1Source^7: ^3"..src.." ^1Tried to open a shop^7: ^2This isn't a registered store^1, refusing call^7") + print("^3Warning^7: ^1Source^7: ^3"..src.." ^1Tried to open a shop ^7'"..shopName.."' ^2This isn't a registered store^7, ^1refusing call^7") return end if not distExploitCheck(shopExploitCheck[shopName], src) then @@ -2894,6 +2889,9 @@ function registerShop(name, label, items, society, coords) if not items[1] then for k, v in pairs(items) do inv.registerShop(name.."_"..k, label.." - "..(v.header or k), v.items, society) + shopExploitCheck[name.."_"..k] = shopExploitCheck[name.."_"..k] or {} + shopExploitCheck[name.."_"..k][#shopExploitCheck[name.."_"..k]+1] = coords + debugPrint("^6Bridge^7: ^2Registering ^5"..inv.invName.." ^3Store^7:", name.."_"..k, "^4Label^7: "..label.." - "..(v.header or k), coords and "- ^4Coord^7: "..formatCoord(coords) or "NO COORD SET") end else From 8594ba12ec7b6160ad9f50ede66c0cc31eacf9fa Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Fri, 10 Oct 2025 13:27:29 +0100 Subject: [PATCH 10/13] Version Bump `2.1.06` - `2.1.07` --- fxmanifest.lua | 2 +- shared/itemcontrol.lua | 2 +- version.txt | 13 ++++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 378e2bb..cebafc6 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim_Bridge" author "Jimathy" -version "2.1.06" +version "2.1.07" description "Framework Bridge By Jimathy" fx_version "cerulean" rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.' diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index cf226d6..22fabc7 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -2558,7 +2558,7 @@ RegisterNetEvent(getScript()..":openGrabBox", function(data, stashData) openStash({ stash = id, coords = GetEntityCoords(Ped), - maxWeight = stashData and stashData.slots or 100000, + maxWeight = stashData and stashData.maxWeight or 100000, slots = stashData and stashData.slots or 5, }) end) diff --git a/version.txt b/version.txt index d40eed8..42aa67a 100644 --- a/version.txt +++ b/version.txt @@ -1,8 +1,11 @@ -2.1.06 +2.1.07 -- Fix stress calculations adding instead of taking away -- Add basic support for fallback functions for inventory management (esx isn't very well supported currently) -- Create ui_modules/alcohol.lua to handle alcohol and drug effects between scripts -- Fix AnimSet loading for "AlienEffect()" +- Support for new embeded shop recipes +- Add checks for targets set with minZ and maxZ set too high or low +- New target function `createPropTarget()` which creates a box target based on a prop model +- Add CodeM as option for billing +- Add 17Mov progressbar support +- Fix OrigenInv calling OX_Inv to get player inventory +- Allow "Grab Boxes" to have custom slots and weight https://github.com/jimathy/jim_bridge/releases/latest \ No newline at end of file From e05815cfbd8670275cf6949426cd76ac029b5298 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Sat, 11 Oct 2025 17:23:26 +0100 Subject: [PATCH 11/13] Fix getStash forcing fallback functions to run --- shared/itemcontrol.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index 22fabc7..18666d3 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -2315,7 +2315,7 @@ function getStash(stashName) if isStarted(inv.invName) then debugPrint("^6Bridge^7: ^2Retrieving ^3"..inv.invName.." ^2Stash^7:", stashName) stashItems = inv.getStash(stashName) - break + goto skip end end @@ -2331,7 +2331,7 @@ function getStash(stashName) end end - + ::skip:: if stashItems then for _, item in pairs(stashItems) do local itemInfo = Items[item.name:lower()] From 8e8010f8379f831fa8116d2704feeba5536702d0 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 13 Oct 2025 12:33:04 +0100 Subject: [PATCH 12/13] Start adding stashEditMetadata() Need help with this one `ox_inv` provides an easy function for this but most inventories don't seem to support editing specific items in a stash `qb-inv` currently you need to forcibly edit the sql others I'm I'm not too sure about yet --- shared/itemcontrol.lua | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index 18666d3..742da27 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -103,6 +103,10 @@ local InvFunc = { -- Add fallback if ox can't find the stash and returns a boolean return type(stash) == "table" and stash.items or {} end, + stashEditMetadata = + function(stash, slot, metadata) + exports[OXInv]:SetMetadata(stash, slot, metadata) + end, stashAddItem = function(stashItems, stashName, items) @@ -207,6 +211,13 @@ local InvFunc = { function(stashName) return exports[CoreInv]:getInventory(stashName) end, + stashEditMetadata = + function(stash, slot, metadata) + local itemData = exports[CoreInv]:getItemBySlot(stash, slot) or {} + if itemData then + exports[CoreInv]:setItem(stash, itemData.item, itemData.count, metadata) + end + end, stashAddItem = function(stashItems, stashName, items) -- @@ -306,6 +317,10 @@ local InvFunc = { function(stashName) return exports[OrigenInv]:getInventory(stashName) end, + stashEditMetadata = + function(stash, slot, metadata) + exports[OrigenInv]:setMetadata(stash, slot, metadata) + end, stashAddItem = function(stashItems, stashName, items) -- @@ -416,6 +431,10 @@ local InvFunc = { function(stashName) return exports[CodeMInv]:GetStashItems(stashName) end, + stashEditMetadata = + function(stash, slot, metadata) + + end, stashAddItem = function(stashItems, stashName, items) -- @@ -529,6 +548,10 @@ local InvFunc = { function(stashName) return exports[TgiannInv]:GetSecondaryInventoryItems("stash", stashName) end, + stashEditMetadata = + function(stash, slot, metadata) + + end, stashAddItem = function(stashItems, stashName, items) -- @@ -692,6 +715,10 @@ local InvFunc = { return result and json.decode(result) or {} end end, + stashEditMetadata = + function(stash, slot, metadata) + + end, stashAddItem = function(stashItems, stashName, items) -- @@ -880,6 +907,23 @@ local InvFunc = { end end end, + stashEditMetadata = + function(stash, slot, metadata) + local stashData = getStash(stash) + for i = 1, #stashData do + if stashData[i].slot == slot then + print("found slot") + stashData[i].info = metadata + end + jsonPrint(stashData[i]) + end + + debugPrint("^6Bridge^7: ^3stashEditMetadata^7: ^2Saving ^3QB^2 stash '^6"..stash.."^7'") + MySQL.Async.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', { + ['stash'] = stash, + ['items'] = json.encode(stashData) + }) + end, stashAddItem = function(stashItems, stashName, items) -- @@ -2246,6 +2290,16 @@ function openStash(data) end +function stashEditMetadata(stash, slot, metadata) + for i = 1, #InvFunc do + local inv = InvFunc[i] + if isStarted(inv.invName) then + inv.stashEditMetadata(stash, slot, metadata) + return + end + end +end + -- Wrapper function for opening stash from the server. -- Messy but not much else I can do about it. RegisterNetEvent(getScript()..":server:openServerStash", function(data) From 732b07c957e3d258381c03bb6e6f93628069b13a Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Tue, 14 Oct 2025 03:51:22 +0100 Subject: [PATCH 13/13] Create check for broken/missing config file --- starter.lua | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/starter.lua b/starter.lua index 1607f15..bc83dca 100644 --- a/starter.lua +++ b/starter.lua @@ -33,12 +33,47 @@ Exports = { } -- Required variables -debugMode = Config.System.Debug +debugMode = false QBInvNew = true InventoryWeight = 120000 +-- Corruptted transfer file Checks -- Not Ready Yet ⚠️ + +--CreateThread(function() +-- local res = GetCurrentResourceName() +-- local ok, val = pcall(function() +-- return exports[res]:ping_encrypted() +-- end) +-- +-- if not ok or val ~= "ok" then +-- print("\n^6===============================================================================") +-- print(("\n^1Corruption Warning^7: ^1[^7%s^1] Encrypted files failed to initialize.^7\n"):format(res)) +-- print("^3Common causes^7:") +-- print(" • Possible corrupt files") +-- print(" • Damaged or partial upload (FTP/zip/unzip issue).") +-- print(" • Outdated artifact version\n") +-- print("^2How To Fix^7:") +-- print(" • Update your server artifact version") +-- print(" • Re-download asset from Keymaster") +-- print(" • Use WinSCP to upload") +-- print(" • Avoid editing any encrypted files") +-- print(" • Restart the server") +-- print("\n^6===============================================================================^7\n") +-- end +--end) + +-- Missing/Broken Config file check +if not Config or not Config.System then + print("\n^6=================================================================================") + print("^6=================================================================================\n") + print(" ^1ERROR^7: jim_bridge ^1can't find the ^7Config^1 table in ^7"..GetCurrentResourceName()) + print(" ^1It is either missing, or there is an error inside it stopping it from loading^7\n") + print("^6=================================================================================") + print("^6=================================================================================^7\n") +end + -- [[ Server.Cfg Convar Check ]]-- -- Check server convars for hard set defaults, otherwise it uses per script configurations if Config and Config.System then @@ -49,6 +84,8 @@ if Config and Config.System then if GetConvar("jim_DisableEventDebug", "false") == "true" then Config.System.EventDebug = false end + else + debugMode = Config.System.Debug end Config.System.Menu = GetConvar("jim_menuScript", Config.System.Menu)