From e309ffe8e42c11eba98b0b8c30e6c71113c06a7e Mon Sep 17 00:00:00 2001 From: OGReaper <102786953+OGReaperx@users.noreply.github.com> Date: Mon, 16 Mar 2026 18:38:38 +1300 Subject: [PATCH 01/14] added solaire notify compatibility --- modules/notify/solaire_notify/client.lua | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 modules/notify/solaire_notify/client.lua diff --git a/modules/notify/solaire_notify/client.lua b/modules/notify/solaire_notify/client.lua new file mode 100644 index 0000000..b5e7ca9 --- /dev/null +++ b/modules/notify/solaire_notify/client.lua @@ -0,0 +1,54 @@ +---@diagnostic disable: duplicate-set-field +Notify = Notify or {} +local resourceName = "solaire_notify" +local configValue = BridgeSharedConfig.Notify + +if (configValue == "auto" and GetResourceState(resourceName) ~= "started") + or (configValue ~= "auto" and configValue ~= resourceName) +then + return +end + +Notify.GetResourceName = function() + return resourceName +end + +local Language = Language or Require("modules/locales/shared.lua") +local locale = Language.Locale +local placeHolderText = locale("Notifications.PlaceholderTitle") + +Notify.SendNotify = function(message, _type, time) + time = time or 3000 + + return exports.solaire_notify:Notify({ + type = _type or "info", + message = message, + duration = time, + }) +end + +---This will send a notify message of the type and time passed +---@param title string +---@param message string +---@param _type string +---@param time number +---@param props table | nil +---@return nil +Notify.SendNotification = function(title, message, _type, time, props) + time = time or 3000 + if not title or title == "" then title = placeHolderText end + + props = props or {} + + return exports.solaire_notify:Notify({ + type = _type or "info", + title = title, + message = message, + duration = time, + position = props.position or "top-right", + sound = props.sound, + item = props.item, + }) +end + +return Notify \ No newline at end of file From b0242ba0602d6cf5831fe7114c411511a9655b9c Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 22 Mar 2026 11:23:48 -0400 Subject: [PATCH 02/14] Update modules/notify/solaire_notify/client.lua Co-authored-by: Solaire --- modules/notify/solaire_notify/client.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/notify/solaire_notify/client.lua b/modules/notify/solaire_notify/client.lua index b5e7ca9..90ef901 100644 --- a/modules/notify/solaire_notify/client.lua +++ b/modules/notify/solaire_notify/client.lua @@ -48,6 +48,7 @@ Notify.SendNotification = function(title, message, _type, time, props) position = props.position or "top-right", sound = props.sound, item = props.item, + volume = props.volume }) end From 3c6d56d19d00b9bbd78fbc55f25066c4d2962569 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 22 Mar 2026 11:24:02 -0400 Subject: [PATCH 03/14] Update modules/notify/solaire_notify/client.lua Co-authored-by: Solaire --- modules/notify/solaire_notify/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/notify/solaire_notify/client.lua b/modules/notify/solaire_notify/client.lua index 90ef901..3509823 100644 --- a/modules/notify/solaire_notify/client.lua +++ b/modules/notify/solaire_notify/client.lua @@ -20,7 +20,7 @@ local placeHolderText = locale("Notifications.PlaceholderTitle") Notify.SendNotify = function(message, _type, time) time = time or 3000 - return exports.solaire_notify:Notify({ + return exports.solaire_notify:Notify({ type = _type or "info", message = message, duration = time }) type = _type or "info", message = message, duration = time, From 17bb8b05c705616d73a80058c30dcf94343a118d Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 22 Mar 2026 11:24:10 -0400 Subject: [PATCH 04/14] Update modules/notify/solaire_notify/client.lua Co-authored-by: Solaire --- modules/notify/solaire_notify/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/notify/solaire_notify/client.lua b/modules/notify/solaire_notify/client.lua index 3509823..2086dc3 100644 --- a/modules/notify/solaire_notify/client.lua +++ b/modules/notify/solaire_notify/client.lua @@ -3,7 +3,7 @@ Notify = Notify or {} local resourceName = "solaire_notify" local configValue = BridgeSharedConfig.Notify -if (configValue == "auto" and GetResourceState(resourceName) ~= "started") +if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end or (configValue ~= "auto" and configValue ~= resourceName) then return From 1dbd528d2243e9265a2df33f057283bb29e5d5c6 Mon Sep 17 00:00:00 2001 From: Tkiljoy <50683104+Tkiljoy@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:22:03 -0500 Subject: [PATCH 05/14] added dhs-banking to the supported banks in community bridge --- modules/banking/dhs-banking/server.lua | 68 ++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 modules/banking/dhs-banking/server.lua diff --git a/modules/banking/dhs-banking/server.lua b/modules/banking/dhs-banking/server.lua new file mode 100644 index 0000000..00e80db --- /dev/null +++ b/modules/banking/dhs-banking/server.lua @@ -0,0 +1,68 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('DHS-BankingSim') == 'missing' then return end +Banking = Banking or {} + +local dhsBanking = exports['DHS-BankingSim'] + +--- Helper: resolve business account ID from a job/society name +---@param account string Job or society name (e.g. 'police', 'ambulance') +---@return number|nil businessId +local function ResolveBusinessId(account) + local row = MySQL.single.await( + 'SELECT id FROM business_accounts WHERE job_name = ? AND status = ? LIMIT 1', + { account, 'active' } + ) + return row and row.id or nil +end + +---This will get the name of the Managment system being being used. +---@return string +Banking.GetManagmentName = function() + return 'DHS-BankingSim' +end + +---This will get the name of the in use resource. +---@return string +Banking.GetResourceName = function() + return 'DHS-BankingSim' +end + +---This will return a number +---@param account string +---@return number +Banking.GetAccountMoney = function(account) + local businessId = ResolveBusinessId(account) + if not businessId then return 0 end + local balance = dhsBanking:GetBusinessBalance(businessId) + return balance or 0 +end + +---This will add money to the specified account of the passed amount +---@param account string +---@param amount number +---@param reason string +---@return boolean +Banking.AddAccountMoney = function(account, amount, reason) + local businessId = ResolveBusinessId(account) + if not businessId then return false end + reason = reason or 'Community Bridge deposit' + MySQL.update.await('UPDATE business_accounts SET balance = balance + ? WHERE id = ?', { amount, businessId }) + return true +end + +---This will remove money from the specified account of the passed amount +---@param account string +---@param amount number +---@param reason string +---@return boolean +Banking.RemoveAccountMoney = function(account, amount, reason) + local businessId = ResolveBusinessId(account) + if not businessId then return false end + reason = reason or 'Community Bridge withdrawal' + local row = MySQL.single.await('SELECT balance FROM business_accounts WHERE id = ?', { businessId }) + if not row or (tonumber(row.balance) or 0) < amount then return false end + MySQL.update.await('UPDATE business_accounts SET balance = balance - ? WHERE id = ?', { amount, businessId }) + return true +end + +return Banking From 5cdc4b4e720c6d3f956699a062f252d4b1ce730e Mon Sep 17 00:00:00 2001 From: SignApps Dev Date: Wed, 8 Apr 2026 11:27:05 +0200 Subject: [PATCH 06/14] feat: add support for tk_bosstablet and zat-bossmenu boss menus --- modules/bossmenu/_default/client.lua | 4 ++++ modules/bossmenu/tk_bosstablet/client.lua | 12 ++++++++++++ modules/bossmenu/tk_bosstablet/server.lua | 16 ++++++++++++++++ modules/bossmenu/zat-bossmenu/client.lua | 12 ++++++++++++ modules/bossmenu/zat-bossmenu/server.lua | 16 ++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 modules/bossmenu/tk_bosstablet/client.lua create mode 100644 modules/bossmenu/tk_bosstablet/server.lua create mode 100644 modules/bossmenu/zat-bossmenu/client.lua create mode 100644 modules/bossmenu/zat-bossmenu/server.lua diff --git a/modules/bossmenu/_default/client.lua b/modules/bossmenu/_default/client.lua index 63a8efa..0179a1d 100644 --- a/modules/bossmenu/_default/client.lua +++ b/modules/bossmenu/_default/client.lua @@ -18,6 +18,10 @@ RegisterNetEvent('community_bridge:client:OpenBossMenu', function(jobName, jobTy end, {wash = false}) elseif BossMenu.GetResourceName() == "qbx_management" then exports.qbx_management:OpenBossMenu(jobType) + elseif BossMenu.GetResourceName() == "tk_bosstablet" then + exports.tk_bosstablet:openBossMenu() + elseif BossMenu.GetResourceName() == "zat-bossmenu" then + exports['zat-bossmenu']:OpenBossMenu(jobType or 'job') end end) diff --git a/modules/bossmenu/tk_bosstablet/client.lua b/modules/bossmenu/tk_bosstablet/client.lua new file mode 100644 index 0000000..31fca1a --- /dev/null +++ b/modules/bossmenu/tk_bosstablet/client.lua @@ -0,0 +1,12 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('tk_bosstablet') ~= 'started' then return end + +BossMenu = BossMenu or {} + +---This will get the name of the module being used. +---@return string +BossMenu.GetResourceName = function() + return "tk_bosstablet" +end + +return BossMenu diff --git a/modules/bossmenu/tk_bosstablet/server.lua b/modules/bossmenu/tk_bosstablet/server.lua new file mode 100644 index 0000000..1cc588b --- /dev/null +++ b/modules/bossmenu/tk_bosstablet/server.lua @@ -0,0 +1,16 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('tk_bosstablet') ~= 'started' then return end + +BossMenu = BossMenu or {} + +---This will get the name of the module being used. +---@return string +BossMenu.GetResourceName = function() + return "tk_bosstablet" +end + +BossMenu.OpenBossMenu = function(src, jobName, jobType) + TriggerClientEvent("community_bridge:client:OpenBossMenu", src, jobName, jobType) +end + +return BossMenu diff --git a/modules/bossmenu/zat-bossmenu/client.lua b/modules/bossmenu/zat-bossmenu/client.lua new file mode 100644 index 0000000..7cddc27 --- /dev/null +++ b/modules/bossmenu/zat-bossmenu/client.lua @@ -0,0 +1,12 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('zat-bossmenu') ~= 'started' then return end + +BossMenu = BossMenu or {} + +---This will get the name of the module being used. +---@return string +BossMenu.GetResourceName = function() + return "zat-bossmenu" +end + +return BossMenu diff --git a/modules/bossmenu/zat-bossmenu/server.lua b/modules/bossmenu/zat-bossmenu/server.lua new file mode 100644 index 0000000..e746baf --- /dev/null +++ b/modules/bossmenu/zat-bossmenu/server.lua @@ -0,0 +1,16 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('zat-bossmenu') ~= 'started' then return end + +BossMenu = BossMenu or {} + +---This will get the name of the module being used. +---@return string +BossMenu.GetResourceName = function() + return "zat-bossmenu" +end + +BossMenu.OpenBossMenu = function(src, jobName, jobType) + TriggerClientEvent("community_bridge:client:OpenBossMenu", src, jobName, jobType) +end + +return BossMenu From aa0b1e17f6efb3b78774f5aefa693f4ddb6d07bd Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 13 Apr 2026 14:37:53 -0400 Subject: [PATCH 07/14] Bump version to 0.13.4 and fix vehicle key path --- fxmanifest.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 01eb242..58b471c 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes' author 'The Order of the Sacred Framework' name 'community_bridge' description 'A Universal Bridge for Our Community, created by a group of contributors with a shared vision to enhance both user and developer experiences. This bridge connects various frameworks, inventories, target systems, notification systems, and more, fostering compatibility and seamless integration.' -version '0.13.3' +version '0.13.4' shared_scripts { '@ox_lib/init.lua', @@ -45,7 +45,7 @@ client_scripts { 'modules/doorlock/**/client.lua', 'modules/phone/**/client.lua', 'modules/weather/**/client.lua', - 'modules/vehicleKey/**/client.lua', + 'modules/vehiclekey/**/client.lua', 'modules/fuel/**/client.lua', 'modules/target/**/client.lua', 'modules/dispatch/**/client.lua', From 5cc8a0cd68d470047739bc9a26b84e05a9860a5f Mon Sep 17 00:00:00 2001 From: Luke <62490330+Luke20201@users.noreply.github.com> Date: Sun, 19 Apr 2026 16:20:44 +0100 Subject: [PATCH 08/14] Add server SendAlert support for fd_dispatch --- .../dispatch/fd_dispatch/server/server.lua | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/dispatch/fd_dispatch/server/server.lua b/modules/dispatch/fd_dispatch/server/server.lua index ef9fa8f..1e39097 100644 --- a/modules/dispatch/fd_dispatch/server/server.lua +++ b/modules/dispatch/fd_dispatch/server/server.lua @@ -8,4 +8,37 @@ Dispatch.GetResourceName = function() return 'fd_dispatch' end -return Dispatch \ No newline at end of file +Dispatch.SendAlert = function(data) + local metadata = {} + if data.vehicle then + table.insert(metadata, { + type = 'vehicle', + model = data.vehicle or locale('unknown_vehicle_model'), + plate = data.plate or nil, + color = data.colorHex or nil + }) + end + if type(data.job) == "string" then + data.job = {data.job} + end + local coords = data.coords or nil + local alertData = { + source = data.source, + title = data.title or "No message provided", + description = data.message or "", + groups = data.jobs or data.job or {"police"}, + code = data.code or '10-80', + priority = data.priority or 2, + metadata = metadata, + blip = { + radius = data.blip and data.blip.radius or 0, + sprite = data.blip and data.blip.sprite or 161, + color = data.blip and data.blip.color or 84, + scale = data.blip and data.blip.scale or 1.0, + time = data.time and (data.time / 1000) or nil, + }, + } + exports.fd_dispatch:addAlert(alertData) +end + +return Dispatch From b8642cea23e8cc10c30d16a7bb00cebdaa43da69 Mon Sep 17 00:00:00 2001 From: Luke <62490330+Luke20201@users.noreply.github.com> Date: Sun, 19 Apr 2026 17:10:57 +0100 Subject: [PATCH 09/14] Fix blips --- modules/dispatch/fd_dispatch/server/server.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/dispatch/fd_dispatch/server/server.lua b/modules/dispatch/fd_dispatch/server/server.lua index 1e39097..9a62eef 100644 --- a/modules/dispatch/fd_dispatch/server/server.lua +++ b/modules/dispatch/fd_dispatch/server/server.lua @@ -21,7 +21,7 @@ Dispatch.SendAlert = function(data) if type(data.job) == "string" then data.job = {data.job} end - local coords = data.coords or nil + local coords = data.coords or GetEntityCoords(GetPlayerPed(data.source)) local alertData = { source = data.source, title = data.title or "No message provided", @@ -31,11 +31,15 @@ Dispatch.SendAlert = function(data) priority = data.priority or 2, metadata = metadata, blip = { - radius = data.blip and data.blip.radius or 0, + title = data.title or "No message provided", + coords = coords, + radius = data.blip and data.blip.radius or nil, sprite = data.blip and data.blip.sprite or 161, - color = data.blip and data.blip.color or 84, - scale = data.blip and data.blip.scale or 1.0, - time = data.time and (data.time / 1000) or nil, + color = data.blip and data.blip.color or 1, + scale = data.blip and data.blip.scale or 1.2, + flashes = data.blip.flash or false, + time = data.time or (6 * 60000), + category = data.category or nil, }, } exports.fd_dispatch:addAlert(alertData) From 14779773ac38102f72a4b9bcdc3109eea65c36b2 Mon Sep 17 00:00:00 2001 From: Luke <62490330+Luke20201@users.noreply.github.com> Date: Sun, 19 Apr 2026 17:20:19 +0100 Subject: [PATCH 10/14] ox_target cleanup when invoking resource is stopped --- modules/target/ox_target/client.lua | 37 +++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index 45ffd85..04100bf 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -7,6 +7,11 @@ local targetDebug = BridgeSharedConfig and BridgeSharedConfig.DebugLevel == 2 or local ox_target = exports.ox_target local targetZones = {} +local resourceTargets = {} +resourceTargets.models = {} +resourceTargets.entities = {} +resourceTargets.networkedEntities = {} + Target.GetResourceName = function() return "ox_target" end @@ -99,6 +104,9 @@ end function Target.AddLocalEntity(entities, options) options = Target.FixOptions(options) ox_target:addLocalEntity(entities, options) + local resource = GetInvokingResource() + resourceTargets.entities[resource] = resourceTargets.entities[resource] or {} + table.insert(resourceTargets.entities[resource], { entities = entities}) end ---This will remove the target options from a local entity. This is useful for when you want to remove target options from a specific entity. @@ -114,6 +122,9 @@ end function Target.AddNetworkedEntity(netids, options) options = Target.FixOptions(options) ox_target:addEntity(netids, options) + local resource = GetInvokingResource() + resourceTargets.networkedEntities[resource] = resourceTargets.networkedEntities[resource] or {} + table.insert(resourceTargets.networkedEntities[resource], { netids = netids}) end ---This will remove a networked entity from the target system. @@ -129,6 +140,9 @@ end function Target.AddModel(models, options) options = Target.FixOptions(options) ox_target:addModel(models, options) + local resource = GetInvokingResource() + resourceTargets.models[resource] = resourceTargets.models[resource] or {} + table.insert(resourceTargets.models[resource], { models = models}) end ---This will remove target options from all specified models. @@ -189,13 +203,32 @@ function Target.RemoveZone(name) end AddEventHandler('onResourceStop', function(resource) - if resource ~= GetCurrentResourceName() then return end for _, target in pairs(targetZones) do if target.creator == resource then ox_target:removeZone(target.id) end end targetZones = {} + if resourceTargets.entities[resource] and #resourceTargets.entities[resource] > 0 then + for _, data in pairs(resourceTargets.entities[resource]) do + Target.RemoveLocalEntity(data.entities) + end + end + resourceTargets.entities[resource] = nil + if resourceTargets.networkedEntities[resource] and #resourceTargets.networkedEntities[resource] > 0 then + for _, data in pairs(resourceTargets.networkedEntities[resource]) do + Target.RemoveNetworkedEntity(data.netids) + end + end + resourceTargets.networkedEntities[resource] = nil + if resourceTargets.models[resource] and #resourceTargets.models[resource] > 0 then + for _, data in pairs(resourceTargets.models[resource]) do + for _, model in pairs(data.models) do + ox_target:removeModel(model) + end + end + end + resourceTargets.models[resource] = nil end) -return Target \ No newline at end of file +return Target From d2b6c288f1e0e84eecc1fa6313a9d1d74f94f136 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 25 Apr 2026 10:56:03 -0400 Subject: [PATCH 11/14] Fix broken Notify return and redundant checks Clean up modules/notify/solaire_notify/client.lua by removing duplicated conditional lines in the resource check and fixing Notify.SendNotify to return a single table argument to exports.solaire_notify:Notify. This removes stray/duplicated lines that caused syntax/logic issues and simplifies the early-return config logic. --- modules/notify/solaire_notify/client.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/notify/solaire_notify/client.lua b/modules/notify/solaire_notify/client.lua index 2086dc3..02cd413 100644 --- a/modules/notify/solaire_notify/client.lua +++ b/modules/notify/solaire_notify/client.lua @@ -4,10 +4,6 @@ local resourceName = "solaire_notify" local configValue = BridgeSharedConfig.Notify if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end - or (configValue ~= "auto" and configValue ~= resourceName) -then - return -end Notify.GetResourceName = function() return resourceName @@ -21,10 +17,6 @@ Notify.SendNotify = function(message, _type, time) time = time or 3000 return exports.solaire_notify:Notify({ type = _type or "info", message = message, duration = time }) - type = _type or "info", - message = message, - duration = time, - }) end ---This will send a notify message of the type and time passed From c78acfd8af005fb7aa66869f905fa71e9e84de09 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 30 May 2026 12:05:21 -0400 Subject: [PATCH 12/14] Add one_inventory integration (client/server) Introduce a new one_inventory adapter under modules/inventory/one_inventory, providing client and server bridges to the one_inventory resource. Implements common Inventory functions (GetResourceName, GetItemInfo, Items, HasItem, GetItemCount, GetImagePath, GetPlayerInventory) on the client. On the server adds AddItem, RemoveItem (with client update events), GetItemBySlot, SetMetadata, OpenStash, AddStashItems, AddTrunkItems, ClearStash, CanCarryItem, UpdatePlate, OpenShop, RegisterShop (stub error), and OpenPlayerInventory. Both files early-return if one_inventory is missing and resolve item image paths. This connects community_bridge inventory operations to one_inventory APIs and handles stash/trunk/glovebox ID mapping and metadata handling. --- modules/inventory/one_inventory/client.lua | 66 ++++++ modules/inventory/one_inventory/server.lua | 241 +++++++++++++++++++++ 2 files changed, 307 insertions(+) create mode 100644 modules/inventory/one_inventory/client.lua create mode 100644 modules/inventory/one_inventory/server.lua diff --git a/modules/inventory/one_inventory/client.lua b/modules/inventory/one_inventory/client.lua new file mode 100644 index 0000000..ad8452d --- /dev/null +++ b/modules/inventory/one_inventory/client.lua @@ -0,0 +1,66 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('one_inventory') == 'missing' then return end +local inv = exports['one_inventory'] +Inventory = Inventory or {} + +---@description This will get the name of the in use resource. +---@return string +Inventory.GetResourceName = function() + return "one_inventory" +end + +---@description Return the item info in oxs format, {name, label, stack, weight, description, image} +---@param item string +---@return table +Inventory.GetItemInfo = function(item) + local itemData = inv:GetItemDefinition(item) + if not itemData then return {} end + return { + name = itemData.name, + label = itemData.label, + stack = itemData.unique, + weight = itemData.weight, + description = itemData.description, + image = Inventory.GetImagePath(itemData.image or itemData.name) + } +end + +---@description This will return the entire items table from the inventory. +---@return table +Inventory.Items = function() + return inv:GetAllItemDefinitions() +end + +---@description Will return boolean if the player has the item. +---@param item string +---@param requiredCount number (optional) +---@return boolean +Inventory.HasItem = function(item, requiredCount) + return inv:HasItem(item, requiredCount or 1) +end + +---@description This will return their count of the item in the players inventory, if not found will return 0. +---@param item string +---@return number +Inventory.GetItemCount = function(item) + return inv:GetItemCount(item, nil) +end + +---@description This will get the image path for this item, if not found will return placeholder. +---@param item string +---@return string +Inventory.GetImagePath = function(item) + item = Inventory.StripPNG(item) + local file = LoadResourceFile("one_inventory", string.format("web/images/%s.png", item)) + local imagePath = file and string.format("nui://one_inventory/web/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end + +---@description This will return the players inventory in the format of {name, label, count, slot, metadata} +---@return table +Inventory.GetPlayerInventory = function() + return inv:GetInventoryItems() +end + + +return Inventory \ No newline at end of file diff --git a/modules/inventory/one_inventory/server.lua b/modules/inventory/one_inventory/server.lua new file mode 100644 index 0000000..b45b9de --- /dev/null +++ b/modules/inventory/one_inventory/server.lua @@ -0,0 +1,241 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('one_inventory') == 'missing' then return end +local inv = exports['one_inventory'] +Inventory = Inventory or {} +Inventory.Stashes = Inventory.Stashes or {} +Inventory.Version = nil +Inventory.ShopData = {} + +---@description This will get the name of the in use resource. +---@return string +Inventory.GetResourceName = function() + return "one_inventory" +end + +---@description This will add an item, and return true or false based on success +---@param src number +---@param item string +---@param count number +---@param slot number (optional) +---@param metadata table (optional) +---@return boolean +Inventory.AddItem = function(src, item, count, slot, metadata) + local success = inv:AddItem(src, item, count, metadata, slot) + + if not success then return false end + TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) + return success or false +end + +---@description This will remove an item, and return true or false based on success +---@param src number +---@param item string +---@param count number +---@param slot number (optional) +---@param metadata table (optional) +---@return boolean +Inventory.RemoveItem = function(src, item, count, slot, metadata) + local success = inv:RemoveItem(src, item, count, metadata, slot) + + if not success then return false end + TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata}) + return success or false +end + +---@description This will return a table with the item info, {name, label, stack, weight, description, image} +---@param item string +---@return table +Inventory.GetItemInfo = function(item) + local itemData = inv:GetItemDefinition(item) + if not itemData then return {} end + return { + name = itemData.name, + label = itemData.label, + stack = itemData.unique, + weight = itemData.weight, + description = itemData.description, + image = Inventory.GetImagePath(itemData.image or itemData.name) + } +end + +---@description This will return the entire items table from the inventory. +---@return table +Inventory.Items = function() + return inv:GetAllItemDefinitions() +end + +---@description This will return the count of the item in the players inventory, if not found will return 0. +---@param src number +---@param item string +---@param metadata table (optional) +---@return number +Inventory.GetItemCount = function(src, item, metadata) + return inv:GetItemCount(src, item, metadata) +end + +---@description This wil return the players inventory. +---@param src number +---@return table +Inventory.GetPlayerInventory = function(src) + return inv:GetInventoryItems(src) +end + +---@description Returns the specified slot data as a table. +---@param src number +---@param slot number +---@return table {weight, name, metadata, slot, label, count} +Inventory.GetItemBySlot = function(src, slot) + local slotData = inv:GetSlot(src, slot) + print("GetItemBySlot".. json.encode(slotData), {indent = true}) + if not slotData then return {} end + return { + name = slotData.name, + label = slotData.name, + weight = slotData.weight, + slot = slotData.slot, + count = slotData.amount or slotData.count, + metadata = slotData.info or slotData.metadata, + stack = slotData.unique, + description = slotData.description + } +end + +---@description This will set the metadata of an item in the inventory. +---@param src number +---@param item string +---@param slot number +---@param metadata table +---@return nil +Inventory.SetMetadata = function(src, item, slot, metadata) + inv:SetItemMetadata(src, slot, metadata) +end + + +---@description This will open the specified stash for the src passed. +---@param src number +---@param _type string "stash", "trunk", "glovebox" +---@param id string +---@return nil +Inventory.OpenStash = function(src, _type, id) + _type = _type or "stash:" + if _type == "trunk" then + _type = "vehicle:trunk:" + elseif _type == "glovebox" then + _type = "vehicle:glovebox:" + elseif _type ~= "stash" then + _type = "stash:" + end + + return inv:OpenInventory(src, _type, {id = id}) +end + +---@description This will add items to a stash, and return true or false based on success +---@param id string +---@param items table {item, count, metadata} +---@return boolean +Inventory.AddStashItems = function(id, items) + if type(items) ~= "table" then return false end + local success = false + for _, item in pairs(items) do + success = inv:AddItem(id, item.item, item.amount or item.count, item.metadata or item.info or {}, nil) + end + return success +end + +---@description This will add items to a trunk, and return true or false based on success +---@param identifier string +---@param items table +---@return boolean +Inventory.AddTrunkItems = function(identifier, items) + if type(items) ~= "table" then return false end + local fullTrunkId = "vehicle:trunk:"..identifier + Wait(1000) + for i = 1, #items do + inv:AddItem(fullTrunkId, items[i].name, items[i].amount or items[i].count, items[i].metadata or items[i].info or {}, nil) + end + return true +end + +---@description This will clear the specified inventory, will always return true unless a value isnt passed correctly. +---@param id string +---@return boolean +Inventory.ClearStash = function(id, _type) + if type(id) ~= "string" then return false end + if Inventory.Stashes[id] then Inventory.Stashes[id] = nil end + if _type == "trunk" then + id = "vehicle:trunk:"..id + elseif _type == "glovebox" then + id = "vehicle:glovebox:"..id + elseif _type ~= "stash" then + id = "stash:"..id + end + inv:ClearInventory(id, false, false) + + return true +end + +---@description This will return a boolean if the player has the item. +---@param src number +---@param item string +---@param requiredCount number (optional) +---@return boolean +Inventory.HasItem = function(src, item, requiredCount) + return inv:HasItem(src, item, requiredCount or 1, nil) + +end + +---@description This is to get if there is available space in the inventory, will return boolean. +---@param src number +---@param item string +---@param count number +---@return boolean +Inventory.CanCarryItem = function(src, item, count) + return inv:CanCarryItem(src, item, count) +end + +---@description This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus) +---@param item string +---@return string +Inventory.GetImagePath = function(item) + item = Inventory.StripPNG(item) + local file = LoadResourceFile("one_inventory", string.format("web/images/%s.png", item)) + local imagePath = file and string.format("nui://one_inventory/web/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end + +---@description This will update the plate to the vehicle inside the inventory. (It will also update with jg-mechanic if using it) +---@param oldplate string +---@param newplate string +---@return boolean +Inventory.UpdatePlate = function(oldplate, newplate) + inv:UpdateVehiclePlate(oldplate, newplate) + if GetResourceState('jg-mechanic') == 'missing' then return true end + return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) +end + +---@description This will open the specified shop for the src passed. +---@param src number +---@param shopTitle string +Inventory.OpenShop = function(src, shopTitle) + return inv:OpenInventory(src, "shop", shopTitle) +end + +---@description This will register a shop, if it already exists it will return true. +---@param shopTitle string +---@param inventory table +---@param shopCoords table +---@param shopGroups table +Inventory.RegisterShop = function(shopTitle, inventory, shopCoords, shopGroups) + return false, print(shopTitle.." is not a valid shop type for one_inventory, please use the shop types defined in the documentation.") +end + +---@description This will open a players inventory, used for admin purposes and stuff. +---@param src number +---@param target number +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + assert(target, "OpenPlayerInventory: target is required") + inv:OpenInventory(src, "player:", target) +end + +return Inventory \ No newline at end of file From 5c9a97c1c0c8ee8f113c13d4e4b1d9d8fe9f349c Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 30 May 2026 12:08:31 -0400 Subject: [PATCH 13/14] Plug --- modules/inventory/one_inventory/client.lua | 6 ++++++ modules/inventory/one_inventory/server.lua | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/modules/inventory/one_inventory/client.lua b/modules/inventory/one_inventory/client.lua index ad8452d..cd2ea9b 100644 --- a/modules/inventory/one_inventory/client.lua +++ b/modules/inventory/one_inventory/client.lua @@ -1,3 +1,9 @@ +--[[ + + Get this inventory here https://onestudios.gg/ + +]]-- + ---@diagnostic disable: duplicate-set-field if GetResourceState('one_inventory') == 'missing' then return end local inv = exports['one_inventory'] diff --git a/modules/inventory/one_inventory/server.lua b/modules/inventory/one_inventory/server.lua index b45b9de..819ef75 100644 --- a/modules/inventory/one_inventory/server.lua +++ b/modules/inventory/one_inventory/server.lua @@ -1,3 +1,9 @@ +--[[ + + Get this inventory here https://onestudios.gg/ + +]]-- + ---@diagnostic disable: duplicate-set-field if GetResourceState('one_inventory') == 'missing' then return end local inv = exports['one_inventory'] From a4d984b951f4ae0474749ae6383162ec91678e95 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 30 May 2026 12:42:28 -0400 Subject: [PATCH 14/14] update core_inventory bridging to the current docs I dont have a copy of this, im banned from his discord and im doing this blindly based on the docs with no explanation of whats in these returned tables. If you are the creator and want me to tweak this please send a copy to my keymaster. TheRealMrNewb --- modules/inventory/core_inventory/client.lua | 26 +++++++++------------ modules/inventory/core_inventory/server.lua | 22 +++-------------- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/modules/inventory/core_inventory/client.lua b/modules/inventory/core_inventory/client.lua index 4ecfea0..39b4de0 100644 --- a/modules/inventory/core_inventory/client.lua +++ b/modules/inventory/core_inventory/client.lua @@ -1,8 +1,6 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('core_inventory') == 'missing' then return end local core = exports.core_inventory --- Core inventory docs available at https://docs.c8re.store/core-inventory/api/server#getitemslist -Callback = Callback or Require("lib/callback/shared/callback.lua") Inventory = Inventory or {} @@ -14,7 +12,7 @@ end local cachedItemList = nil --- Return the item info in oxs format, {name, label, stack, weight, description, image} ---- https://docs.c8re.store/core-inventory/api/server#getitemslist +--- https://docs.c8re.store/core-inventory/exports#client-exports-%E2%80%94-inventory-ui --- @param item string --- @return table Inventory.GetItemInfo = function(item) @@ -22,24 +20,22 @@ Inventory.GetItemInfo = function(item) return itemList[item] or {} end ----This will return the entire items table from the inventory. +---This will return the entire items table from the inventory in the ox format. ---@return table Inventory.Items = function() - local frameworkName = Framework.GetFrameworkName() - if not frameworkName then return {} end + if cachedItemList then return cachedItemList end + local allItems = core:getItemsList() + if not allItems then return {} end local dataRepack = {} - if frameworkName == 'es_extended' then - if not cachedItemList then cachedItemList = Callback.Trigger('community_bridge:Callback:core_inventory', false) end - dataRepack = cachedItemList or {} - elseif frameworkName == 'qb-core' then - dataRepack = Framework.Shared.Items or {} - end - for itemName, itemData in pairs(dataRepack) do + for itemName, itemData in pairs(allItems) do if itemData and itemData.name then - dataRepack[itemName].image = Inventory.GetImagePath(itemData.name) - dataRepack[itemName].stack = dataRepack[itemName].unique or false + dataRepack[itemName] = { + image = Inventory.GetImagePath(itemData.name), + stack = itemData.unique or false + } end end + cachedItemList = dataRepack return dataRepack end diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua index 64e473f..8af0219 100644 --- a/modules/inventory/core_inventory/server.lua +++ b/modules/inventory/core_inventory/server.lua @@ -3,7 +3,6 @@ if GetResourceState('core_inventory') == 'missing' then return end Inventory = Inventory or {} Inventory.Stashes = Inventory.Stashes or {} -Callback = Callback or Require("lib/callback/shared/callback.lua") local core = exports.core_inventory ---This will get the name of the in use resource. @@ -20,8 +19,7 @@ end ---@param metadata table ---@return boolean Inventory.AddItem = function(src, item, count, slot, metadata) - -- docs specify a table returned on success, on failure it returns false. - -- https://docs.c8re.store/core-inventory/api/server#additem + -- https://docs.c8re.store/core-inventory/exports#server-exports-%E2%80%94-items local success = core:addItem(src, item, count, metadata) if not success then return false end TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) @@ -48,16 +46,8 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata) end TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata}) if slot then - local identifier = Framework.GetPlayerIdentifier(src) - if not identifier then return false end - local framework = Bridge.Framework.GetFrameworkName() - if framework == 'es_extended' then - identifier = string.gsub(identifier, ":", "") - end - local weirdInventoryName = 'content-' .. identifier - -- No return value specified in docs, so we assume none. - -- https://docs.c8re.store/core-inventory/api/server#removeitemexact - return core:removeItemExact(weirdInventoryName, slot, count) + -- https://docs.c8re.store/core-inventory/exports#server-exports-%E2%80%94-items + return core:removeItemExact(src, slot, count) end core:removeItem(src, item, count) return true @@ -249,12 +239,6 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end ----This is used for the esx users, documentation doesnt show a client side available option for the inventory so we use jank callbacks to get this. -Callback.Register('community_bridge:Callback:core_inventory', function(source) - local items = core:getItemsList() - return items or {} -end) - ---This will return the entire items table from the inventory. ---@return table Inventory.Items = function()