From 8cf4a6bd234f0f1b2937f43e4c77236d5162667b Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 22 Jan 2024 14:35:52 +0000 Subject: [PATCH 1/8] Version Bump - 1.0.6 --- fxmanifest.lua | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 7a4a8b5..54bfb4d 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim_Bridge" author "Jimathy" -version "1.0.5" +version "1.0.6" description "Framework Bridge By Jimathy" fx_version "cerulean" game "gta5" diff --git a/version.txt b/version.txt index f1cd2a9..2204301 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.5 +1.0.6 From 5ae4799a5f3c2ca3d1c0c24f63fac9c4f2e86162 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 22 Jan 2024 14:41:38 +0000 Subject: [PATCH 2/8] add auto check for ps/lj-inv --- wrapper.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wrapper.lua b/wrapper.lua index df031a0..a29aec3 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -1,5 +1,8 @@ Items, Vehicles, Jobs, Gangs, Core, ESX = {}, nil, nil, nil, nil, nil +if GetResourceState("ps-inventory"):find("start") then Exports.QBInv = "ps-inventory" end +if GetResourceState("lj-inventory"):find("start") then Exports.QBInv = "lj-inventory" end + OXLibExport = Exports and Exports.OXLibExport or "" QBXExport = Exports and Exports.QBXExport or "" From df785043e8ef51d7582720e8e17387570e1612f6 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 22 Jan 2024 14:51:51 +0000 Subject: [PATCH 3/8] CoreInv add/remove Item fixes --- functions.lua | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/functions.lua b/functions.lua index 987e6ff..9c1ca02 100644 --- a/functions.lua +++ b/functions.lua @@ -592,7 +592,16 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, print("^6Bridge^7: ^3"..addremove.."^7[^6"..QSInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end elseif GetResourceState(CoreInv):find("start") then - local success = exports[CoreInv]:removeItemExact('primary-'..src, item, amount) + local id = "" + if GetResourceState(QBExport):find("start") then + local Player = Core.Functions.GetPlayer(src) + id = Player.PlayerData.citizenid + Player.Functions.RemoveItem(item, amount, nil) + elseif GetResourceState(ESXExport):find("start") then + id = ESX.GetPlayerFromId(src).identifier:gsub(":", "") + Player = ESX.GetPlayerFromId(src) + Player.removeInventoryItem(item, count) + end if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CoreInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end @@ -631,7 +640,16 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, print("^6Bridge^7: ^3"..addremove.."^7[^6"..QSInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end elseif GetResourceState(CoreInv):find("start") then - local success = exports[CoreInv]:addItem('primary-'..src, item, amount) + local id = "" + if GetResourceState(QBExport):find("start") then + local Player = Core.Functions.GetPlayer(src) + id = Player.PlayerData.citizenid + Player.Functions.AddItem(item, amount, nil, nil) + elseif GetResourceState(ESXExport):find("start") then + id = ESX.GetPlayerFromId(src).identifier:gsub(":", "") + Player = ESX.GetPlayerFromId(src) + Player.addInventoryItem(item, amount) + end if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CoreInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end From f1ff06c0983cb37f2cf4e20f4dc92afced404494 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 22 Jan 2024 15:31:04 +0000 Subject: [PATCH 4/8] CoreInv hasItem events updated --- crafting.lua | 15 +++++++++++++-- functions.lua | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/crafting.lua b/crafting.lua index 0b9c381..48550f5 100644 --- a/crafting.lua +++ b/crafting.lua @@ -242,8 +242,19 @@ function hasItem(items, amount, src) local amount = amount and amount or 1 elseif GetResourceState(CoreInv):find("start") then foundInv = CoreInv - if src then grabInv = exports['core_inventory']:getInventory('primary-'..src) - else grabInv = exports[CoreInv]:getInventory('primary-'..GetPlayerServerId(PlayerPedId())) + if src then + if GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then + local Player = Core.Functions.GetPlayer(src) + grabInv = Player.PlayerData.inventory + elseif GetResourceState(ESXExport):find("start") then + local Player = ESX.GetPlayerFromId(src) + grabInv = Player.getInventory(false) + end + else + local p = promise.new() + Core.Functions.TriggerCallback('core_inventory:server:getInventory', function(cb) p:resolve(cb) end) + local result = Citizen.Await(p) + grabInv = result end elseif GetResourceState(CodeMInv):find("start") then diff --git a/functions.lua b/functions.lua index 9c1ca02..002761e 100644 --- a/functions.lua +++ b/functions.lua @@ -513,7 +513,7 @@ function setThirst(src, thirst) if GetResourceState(ESXExport):find("start") then TriggerClientEvent('esx_status:add', src, 'thirst', thirst) elseif GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then - local Player = QBCore.Functions.GetPlayer(src) + local Player = Core.Functions.GetPlayer(src) Player.Functions.SetMetaData('thirst', thirst) TriggerClientEvent("hud:client:UpdateNeeds", src, thirst, Player.PlayerData.metadata.thirst) end @@ -523,7 +523,7 @@ function setHunger(src, hunger) if GetResourceState(ESXExport):find("start") then TriggerClientEvent('esx_status:add', src, 'hunger', hunger) elseif GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then - local Player = QBCore.Functions.GetPlayer(src) + local Player = Core.Functions.GetPlayer(src) Player.Functions.SetMetaData('hunger', hunger) TriggerClientEvent("hud:client:UpdateNeeds", src, hunger, Player.PlayerData.metadata.hunger) end From d17a1da5b2bb7f2aabd4cfb5bd4c81566fe67a6d Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 22 Jan 2024 16:55:58 +0000 Subject: [PATCH 5/8] CoreInv Fully Supported --- crafting.lua | 68 +++++++++++++++++++++++++++++++-------------------- functions.lua | 24 ++++++------------ 2 files changed, 48 insertions(+), 44 deletions(-) diff --git a/crafting.lua b/crafting.lua index 48550f5..85be5cd 100644 --- a/crafting.lua +++ b/crafting.lua @@ -244,8 +244,7 @@ function hasItem(items, amount, src) local amount = amount and amount or 1 foundInv = CoreInv if src then if GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then - local Player = Core.Functions.GetPlayer(src) - grabInv = Player.PlayerData.inventory + grabInv = Core.Functions.GetPlayer(src).PlayerData.items elseif GetResourceState(ESXExport):find("start") then local Player = ESX.GetPlayerFromId(src) grabInv = Player.getInventory(false) @@ -254,6 +253,7 @@ function hasItem(items, amount, src) local amount = amount and amount or 1 local p = promise.new() Core.Functions.TriggerCallback('core_inventory:server:getInventory', function(cb) p:resolve(cb) end) local result = Citizen.Await(p) + if type(result) == "string" then result = json.decode(result) end grabInv = result end @@ -314,16 +314,23 @@ end function getStash(stashName) local stashItems, items = {}, {} if GetResourceState(OXInv):find("start") then - if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7ox_inventory") end + if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..OXInv) end stashItems = exports[OXInv]:Inventory(stashName).items + elseif GetResourceState(QSInv):find("start") then - if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7qs-inventory") end + if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..QSInv) end stashItems = exports[QSInv]:GetStashItems(stashName) + + elseif GetResourceState(CoreInv):find("start") then + if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..CoreInv) end + stashItems = exports[CoreInv]:getInventory(stashName) + elseif GetResourceState(CodeMInv):find("start") then - if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7qs-inventory") end + if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..CodeMInv) end stashItems = exports[CodeMInv]:GetInventoryItems('Stash', stashName) + elseif GetResourceState(QBInv):find("start") then - if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7qb-inventory") end + if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..QBInv) end local result = MySQL.scalar.await('SELECT items FROM stashitems WHERE stash = ?', { stashName }) if result then stashItems = json.decode(result) end end @@ -331,18 +338,18 @@ function getStash(stashName) for _, item in pairs(stashItems) do local itemInfo = Items[item.name:lower()] if itemInfo then - items[item.slot] = { - name = itemInfo["name"], + items[#items+1] = { + name = itemInfo["name"] ~= nil and itemInfo["slot"] or nil, amount = tonumber(item.amount) or tonumber(item.count), info = item.info ~= nil and item.info or "", - label = itemInfo["label"], + label = itemInfo["label"] ~= nil and itemInfo["slot"] or nil, description = itemInfo["description"] ~= nil and itemInfo["description"] or "", - weight = itemInfo["weight"], - type = itemInfo["type"], - unique = itemInfo["unique"], - useable = itemInfo["useable"], - image = itemInfo["image"], - slot = item.slot, + weight = itemInfo["weight"] ~= nil and itemInfo["slot"] or nil, + type = itemInfo["type"] ~= nil and itemInfo["slot"] or nil, + unique = itemInfo["unique"] ~= nil and itemInfo["slot"] or nil, + useable = itemInfo["useable"] ~= nil and itemInfo["slot"] or nil, + image = itemInfo["image"] ~= nil and itemInfo["slot"] or nil, + slot = itemInfo["slot"] ~= nil and itemInfo["slot"] or nil, } end end @@ -358,23 +365,30 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and if Config.System.Debug then print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..OXInv, k, v) end end elseif GetResourceState(QSInv):find("start") then - for k, v in pairs(items) do - for l in pairs(stashItems) do - if stashItems[l].name == k then - if (stashItems[l].amount - v) <= 0 then - if Config.System.Debug then - print("^6Bridge^7: ^2None of this item left in stash ^3Stash^7", k, v) + for k, v in pairs(items) do + for l in pairs(stashItems) do + if stashItems[l].name == k then + if (stashItems[l].amount - v) <= 0 then + if Config.System.Debug then + print("^6Bridge^7: ^2None of this item left in stash ^3Stash^7", k, v) + end + stashItems[l] = nil + else + if Config.System.Debug then + print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..QBInv, k, v) + end + exports[QSInv]:RemoveItemIntoStash(stashName, k, v, l) end - stashItems[l] = nil - else - if Config.System.Debug then - print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..QBInv, k, v) - end - exports[QSInv]:RemoveItemIntoStash(stashName, k, v, l) end end end + + elseif GetResourceState(CoreInv):find("start") then + for k, v in pairs(items) do + exports[CoreInv]:removeItemExact(stashName, k, v) + if Config.System.Debug then print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..CoreInv, k, v) end end + elseif GetResourceState(CodeMInv):find("start") then for k, v in pairs(items) do for l in pairs(stashItems) do diff --git a/functions.lua b/functions.lua index 002761e..f9d6d82 100644 --- a/functions.lua +++ b/functions.lua @@ -591,16 +591,11 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..QSInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end - elseif GetResourceState(CoreInv):find("start") then - local id = "" + elseif GetResourceState(CoreInv):find("start") then if GetResourceState(QBExport):find("start") then - local Player = Core.Functions.GetPlayer(src) - id = Player.PlayerData.citizenid - Player.Functions.RemoveItem(item, amount, nil) + Core.Functions.GetPlayer(src).Functions.RemoveItem(item, amount, nil) elseif GetResourceState(ESXExport):find("start") then - id = ESX.GetPlayerFromId(src).identifier:gsub(":", "") - Player = ESX.GetPlayerFromId(src) - Player.removeInventoryItem(item, count) + ESX.GetPlayerFromId(src).removeInventoryItem(item, count) end if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CoreInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") @@ -640,17 +635,12 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, print("^6Bridge^7: ^3"..addremove.."^7[^6"..QSInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end elseif GetResourceState(CoreInv):find("start") then - local id = "" - if GetResourceState(QBExport):find("start") then - local Player = Core.Functions.GetPlayer(src) - id = Player.PlayerData.citizenid - Player.Functions.AddItem(item, amount, nil, nil) + if GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then + Core.Functions.GetPlayer(src).Functions.AddItem(item, amount, nil, nil) elseif GetResourceState(ESXExport):find("start") then - id = ESX.GetPlayerFromId(src).identifier:gsub(":", "") - Player = ESX.GetPlayerFromId(src) - Player.addInventoryItem(item, amount) + ESX.GetPlayerFromId(src).addInventoryItem(item, amount) end - if Config.System.Debug then + if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CoreInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end elseif GetResourceState(CodeMInv):find("start") then From 8479aea1b0202198ea51cece67eedef1645d45ad Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 22 Jan 2024 17:14:56 +0000 Subject: [PATCH 6/8] Origen inv experimental support --- crafting.lua | 19 +++++++++++++++++++ exports.lua | 3 ++- functions.lua | 23 ++++++++++++++++++++++- wrapper.lua | 3 +++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/crafting.lua b/crafting.lua index 85be5cd..5da23c9 100644 --- a/crafting.lua +++ b/crafting.lua @@ -240,6 +240,14 @@ function hasItem(items, amount, src) local amount = amount and amount or 1 else grabInv = exports[QSInv]:getUserInventory() end + elseif GetResourceState(OrigenInv):find("start") then + foundInv = OrigenInv + if src then + grabInv = exports[OrigenInv]:getPlayerInventory(src) + else + grabInv = exports[OrigenInv]:getPlayerInventory() + end + elseif GetResourceState(CoreInv):find("start") then foundInv = CoreInv if src then @@ -329,6 +337,10 @@ function getStash(stashName) if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..CodeMInv) end stashItems = exports[CodeMInv]:GetInventoryItems('Stash', stashName) + elseif GetResourceState(OrigenInv):find("start") then + if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..OrigenInv) end + stashItems = exports[OrigenInv]:GetStash(stashName) + elseif GetResourceState(QBInv):find("start") then if Config.System.Debug then print("^6Bridge^7: ^2Retrieving ^3Stash^2 with ^7"..QBInv) end local result = MySQL.scalar.await('SELECT items FROM stashitems WHERE stash = ?', { stashName }) @@ -410,6 +422,13 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and if Config.System.Debug then print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'") end + + elseif GetResourceState(OrigenInv):find("start") then + for k, v in pairs(items) do + exports[OrigenInv]:RemoveItem(stashName, k, v) + if Config.System.Debug then print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..OrigenInv, k, v) end + end + elseif GetResourceState(QBInv):find("start") then for k, v in pairs(items) do for l in pairs(stashItems) do diff --git a/exports.lua b/exports.lua index 1a92d42..bab1fa0 100644 --- a/exports.lua +++ b/exports.lua @@ -7,8 +7,9 @@ Exports = { OXInv = "ox_inventory", QBInv = "qb-inventory", QSInv = "qs-inventory", - CoreInv = "core-inventory", + CoreInv = "core_inventory", CodeMInv = "codem-inventory", + OrigenInv = "origen_inventory", OXLibExport = "ox_lib", diff --git a/functions.lua b/functions.lua index f9d6d82..d7700aa 100644 --- a/functions.lua +++ b/functions.lua @@ -586,11 +586,13 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..OXInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + elseif GetResourceState(QSInv):find("start") then local success = exports[QSInv]:RemoveItem(src, item, amount) if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..QSInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + elseif GetResourceState(CoreInv):find("start") then if GetResourceState(QBExport):find("start") then Core.Functions.GetPlayer(src).Functions.RemoveItem(item, amount, nil) @@ -600,11 +602,19 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CoreInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end - elseif GetResourceState(CodeMInv):find("start") then + + elseif GetResourceState(OrigenInv):find("start") then + local success = exports[OrigenInv]:RemoveItem(src, item, amount) + if Config.System.Debug then + print("^6Bridge^7: ^3"..addremove.."^7[^6"..OrigenInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") + end + + elseif GetResourceState(CodeMInv):find("start") then local success = exports[CodeMInv]:RemoveItem(src, item, amount) if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CodeMInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + elseif GetResourceState(QBInv):find("start") then while remamount > 0 do if Core.Functions.GetPlayer(src).Functions.RemoveItem(item, 1) then end @@ -629,11 +639,13 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..OXInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + elseif GetResourceState(QSInv):find("start") then local success = exports[QSInv]:AddItem(src, item, amount) if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..QSInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + elseif GetResourceState(CoreInv):find("start") then if GetResourceState(QBExport):find("start") or GetResourceState(QBXExport):find("start") then Core.Functions.GetPlayer(src).Functions.AddItem(item, amount, nil, nil) @@ -643,11 +655,19 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CoreInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + elseif GetResourceState(CodeMInv):find("start") then local success = exports[CodeMInv]:AddItem(src, item, amount) if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..CodeMInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + + elseif GetResourceState(OrigenInv):find("start") then + local success = exports[OrigenInv]:AddItem(src, item, amount) + if Config.System.Debug then + print("^6Bridge^7: ^3"..addremove.."^7[^6"..OrigenInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") + end + elseif GetResourceState(QBInv):find("start") then if Core.Functions.GetPlayer(src).Functions.AddItem(item, amount or 1) then --if Config.Crafting.showItemBox then @@ -657,6 +677,7 @@ RegisterNetEvent(GetCurrentResourceName()..":server:toggleItem", function(give, if Config.System.Debug then print("^6Bridge^7: ^3"..addremove.."^7[^6"..QBInv.."^7] ^2Player^7("..src..") ^6"..Items[item].label.."^7("..item..") x^5"..(amount and amount or "1").."^7") end + else print("^4ERROR^7: ^2No Inventory detected ^7- ^2Check ^3exports^1.^2lua^7") end diff --git a/wrapper.lua b/wrapper.lua index a29aec3..02d367f 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -15,6 +15,7 @@ QBInv = Exports and Exports.QBInv or "" QSInv = Exports and Exports.QSInv or "" CoreInv = Exports and Exports.CoreInv or "" CodeMInv = Exports and Exports.CodeMInv or "" +OrigenInv = Exports and Exports.OrigenInv or "" QBMenuExport = Exports and Exports.QBMenuExport or "" @@ -1243,6 +1244,8 @@ function invImg(item) imgLink = "nui://"..QSInv.."/html/images/"..(Items[item].image or "") elseif GetResourceState(CoreInv and CoreInv or ""):find("start") then imgLink = "nui://"..CoreInv.."/html/img/"..(Items[item].image or "") + elseif GetResourceState(OrigenInv and OrigenInv or ""):find("start") then + imgLink = "nui://"..OrigenInv.."/html/img/"..(Items[item].image or "") elseif GetResourceState(QBInv and QBInv or ""):find("start") then imgLink = "nui://"..QBInv.."/html/images/"..(Items[item].image or "") else From f7a7e89c568de7f784c315a20be2bbe7ef2b4a30 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Tue, 23 Jan 2024 00:36:04 +0000 Subject: [PATCH 7/8] lib.showMenu support --- wrapper.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/wrapper.lua b/wrapper.lua index 02d367f..aa99c0c 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -227,16 +227,19 @@ end function openMenu(Menu, data) if Config.System.Menu == "ox" then - if data.onBack then + local index = nil + if data.onBack and not data.onSelected then table.insert(Menu, 1, { icon = "fas fa-circle-arrow-left", title = "Return", onSelect = data.onBack, + label = "Return" }) end for k in pairs(Menu) do if not Menu[k].title then if Menu[k].header ~= nil and Menu[k].header ~= "" then Menu[k].title = Menu[k].header + Menu[k].label = Menu[k].header if Menu[k].txt then Menu[k].description = Menu[k].txt else Menu[k].description = "" end else Menu[k].title = Menu[k].txt @@ -250,8 +253,22 @@ function openMenu(Menu, data) Menu[k].disabled = true end end - lib.registerContext({id = 'Menu', title = data.header..br..br..(data.headertxt and data.headertxt or ""), position = 'top-right', options = Menu, canClose = data.canClose and data.canClose or nil, onExit = data.onExit and data.onExit or nil, }) - lib.showContext("Menu") + local menuID = 'Menu' + (data.onSelected and lib.registerMenu or lib.registerContext)({ + id = menuID, + title = data.header..br..br..(data.headertxt and data.headertxt or ""), + position = 'top-right', + options = Menu, + canClose = data.canClose and data.canClose or nil, + onClose = (data.onBack and data.onBack) or (data.onExit and data.onExit) or nil, + onExit = data.onExit and data.onExit or nil, + onSelected = data.onSelected and (function(selected) index = selected end) or nil, + }, (data.onSelected and (function(x, y, args) Menu[x].onSelect() end) or nil)) + if data.onSelected then + lib.showMenu(menuID, 1) + else + lib.showContext(menuID) + end elseif Config.System.Menu == "qb" then if data.onBack then table.insert(Menu, 1, { icon = "fas fa-circle-arrow-left", From 7d6235855829ebb2187d94da5c7a1cb49ad638de Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Tue, 23 Jan 2024 00:37:18 +0000 Subject: [PATCH 8/8] ox input default "select" --- wrapper.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapper.lua b/wrapper.lua index aa99c0c..b0b38e1 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -771,7 +771,7 @@ function createInput(title, opts) isRequired = opts[i].isRequired, label = opts[i].label or opts[i].text, name = opts[i].name, - default = opts[i].options[1].value, + default = opts[i].default or opts[i].options[1].value, options = opts[i].options, } end