mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +01:00
Remove references to qs scripts
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
### wrapperfunctions.lua
|
### wrapperfunctions.lua
|
||||||
|
|
||||||
Provides wrapper compatibility functions for command and inventory stash systems across different frameworks (OX, QB, ESX, QS, etc).
|
Provides wrapper compatibility functions for command and inventory stash systems across different frameworks (OX, QB, ESX, etc).
|
||||||
|
|
||||||
- **registerCommand(command, options)**
|
- **registerCommand(command, options)**
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ Provides wrapper compatibility functions for command and inventory stash systems
|
|||||||
- **registerStash(name, label, slots?, weight?, owner?, coords?)**
|
- **registerStash(name, label, slots?, weight?, owner?, coords?)**
|
||||||
|
|
||||||
⚠️ Server Side Only
|
⚠️ Server Side Only
|
||||||
- Registers a stash using OX, QS, or Origen inventory systems.
|
- Registers a stash using OX, or Origen inventory systems.
|
||||||
- **Example:**
|
- **Example:**
|
||||||
```lua
|
```lua
|
||||||
registerStash(
|
registerStash(
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ local Exports = {
|
|||||||
OXInv = "ox_inventory",
|
OXInv = "ox_inventory",
|
||||||
QBInv = "qb-inventory",
|
QBInv = "qb-inventory",
|
||||||
PSInv = "ps-inventory",
|
PSInv = "ps-inventory",
|
||||||
QSInv = "qs-inventory",
|
|
||||||
CoreInv = "core_inventory",
|
CoreInv = "core_inventory",
|
||||||
CodeMInv = "codem-inventory",
|
CodeMInv = "codem-inventory",
|
||||||
OrigenInv = "origen_inventory",
|
OrigenInv = "origen_inventory",
|
||||||
@@ -149,11 +148,8 @@ local itemFunc = {
|
|||||||
-- If this is nil, they need to update to qbx_core 1.23.0+
|
-- If this is nil, they need to update to qbx_core 1.23.0+
|
||||||
if not cache.Items then
|
if not cache.Items then
|
||||||
-- if their inventory doesn't allow that (they refuse to update their butchered core replacement):
|
-- if their inventory doesn't allow that (they refuse to update their butchered core replacement):
|
||||||
if GetResourceState(Exports.QSInv):find("start") then
|
|
||||||
itemResource = Exports.QSInv
|
|
||||||
cache.Items = exports[Exports.QSInv]:GetItemList()
|
|
||||||
|
|
||||||
elseif GetResourceState(Exports.OrigenInv):find("start") then
|
if GetResourceState(Exports.OrigenInv):find("start") then
|
||||||
itemResource = Exports.OrigenInv
|
itemResource = Exports.OrigenInv
|
||||||
cache.Items = exports[Exports.OrigenInv]:Items()
|
cache.Items = exports[Exports.OrigenInv]:Items()
|
||||||
|
|
||||||
@@ -179,14 +175,10 @@ local itemFunc = {
|
|||||||
},
|
},
|
||||||
{ script = Exports.ESXExport,
|
{ script = Exports.ESXExport,
|
||||||
cacheItem = function()
|
cacheItem = function()
|
||||||
if GetResourceState(Exports.QSInv):find("start") then
|
cache.Items = ESX.GetItems()
|
||||||
cache.Items = exports[Exports.QSInv]:GetItemList()
|
while not next(cache.Items) do
|
||||||
else
|
|
||||||
cache.Items = ESX.GetItems()
|
cache.Items = ESX.GetItems()
|
||||||
while not next(cache.Items) do
|
Wait(1000)
|
||||||
cache.Items = ESX.GetItems()
|
|
||||||
Wait(1000)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@@ -437,9 +429,7 @@ local function getInventoryConfig(resource, data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
local fn, err = load(content, '@'..data.file, 't', env)
|
local fn, err = load(content, '@'..data.file, 't', env)
|
||||||
--local success, err = xpcall(fn, function(e)
|
|
||||||
-- print(debug.traceback("Error while executing qs-inventory config:\n" .. tostring(e), 2))
|
|
||||||
--end)
|
|
||||||
if not fn then return nil, "Failed to compile config: " .. err end
|
if not fn then return nil, "Failed to compile config: " .. err end
|
||||||
if not pcall(fn) then return nil, "Error executing config file" end
|
if not pcall(fn) then return nil, "Error executing config file" end
|
||||||
|
|
||||||
@@ -470,7 +460,6 @@ local invWeightTable = {
|
|||||||
},
|
},
|
||||||
[Exports.JPRInv] = { file = "configs/main_config.lua", path = { "MaxInventoryWeight" }, slotPath = { "MaxInventorySlots" } },
|
[Exports.JPRInv] = { file = "configs/main_config.lua", path = { "MaxInventoryWeight" }, slotPath = { "MaxInventorySlots" } },
|
||||||
[Exports.PSInv] = { file = "config.lua", path = { "MaxInventoryWeight" }, slotPath = { "MaxInventorySlots" } },
|
[Exports.PSInv] = { file = "config.lua", path = { "MaxInventoryWeight" }, slotPath = { "MaxInventorySlots" } },
|
||||||
[Exports.QSInv] = { file = "config/config.lua", path = { "InventoryWeight", "weight" }, slotPath = { "InventoryWeight", "slots" } },
|
|
||||||
[Exports.TgiannInv] = { file = "configs/config.lua", path = { "slotsMaxWeights", "player", "maxWeight" }, slotPath = { "slotsMaxWeights", "player", "slots" } },
|
[Exports.TgiannInv] = { file = "configs/config.lua", path = { "slotsMaxWeights", "player", "maxWeight" }, slotPath = { "slotsMaxWeights", "player", "slots" } },
|
||||||
[Exports.CodeMInv] = { file = "config/config.lua", path = { "MaxWeight" }, slotPath = { "MaxSlots" } },
|
[Exports.CodeMInv] = { file = "config/config.lua", path = { "MaxWeight" }, slotPath = { "MaxSlots" } },
|
||||||
[Exports.RSGInv] = { file = "config/config.lua", path = { "MaxWeight" }, slotPath = { "MaxSlots" } },
|
[Exports.RSGInv] = { file = "config/config.lua", path = { "MaxWeight" }, slotPath = { "MaxSlots" } },
|
||||||
|
|||||||
@@ -10,11 +10,10 @@ OXLibExport, QBXExport, QBExport, ESXExport, OXCoreExport =
|
|||||||
Exports.ESXExport or "",
|
Exports.ESXExport or "",
|
||||||
Exports.OXCoreExport or ""
|
Exports.OXCoreExport or ""
|
||||||
|
|
||||||
OXInv, QBInv, PSInv, QSInv, CoreInv, CodeMInv, OrigenInv, TgiannInv, JPRInv =
|
OXInv, QBInv, PSInv, CoreInv, CodeMInv, OrigenInv, TgiannInv, JPRInv =
|
||||||
Exports.OXInv or "",
|
Exports.OXInv or "",
|
||||||
Exports.QBInv or "",
|
Exports.QBInv or "",
|
||||||
Exports.PSInv or "",
|
Exports.PSInv or "",
|
||||||
Exports.QSInv or "",
|
|
||||||
Exports.CoreInv or "",
|
Exports.CoreInv or "",
|
||||||
Exports.CodeMInv or "",
|
Exports.CodeMInv or "",
|
||||||
Exports.OrigenInv or "",
|
Exports.OrigenInv or "",
|
||||||
|
|||||||
@@ -118,99 +118,6 @@ local InvFunc = {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ invName = QSInv,
|
|
||||||
removeItem =
|
|
||||||
function(src, item, remamount)
|
|
||||||
exports[QSInv]:RemoveItem(src, item, remamount)
|
|
||||||
end,
|
|
||||||
addItem =
|
|
||||||
function(src, item, amountToAdd, info, slot)
|
|
||||||
exports[QSInv]:AddItem(src, item, amountToAdd, slot, info)
|
|
||||||
end,
|
|
||||||
setItemMetadata =
|
|
||||||
function(data, src)
|
|
||||||
exports[QSInv]:SetItemMetadata(src, data.slot, data.metadata)
|
|
||||||
end,
|
|
||||||
hasItem =
|
|
||||||
function(item, amount, src)
|
|
||||||
if src then
|
|
||||||
local serverItemCheck = exports[QSInv]:GetItemTotalAmount(src, item) or 0
|
|
||||||
return serverItemCheck >= amount, serverItemCheck
|
|
||||||
else
|
|
||||||
local localItemCheck = exports[QSInv]:Search(item) or 0
|
|
||||||
return localItemCheck >= amount, localItemCheck
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
canCarry =
|
|
||||||
function(itemTable, src)
|
|
||||||
local resultTable = {}
|
|
||||||
for k, v in pairs(itemTable) do
|
|
||||||
resultTable[k] = exports[QSInv]:CanCarryItem(src, k, v)
|
|
||||||
end
|
|
||||||
return resultTable
|
|
||||||
end,
|
|
||||||
getMaxInvWeight =
|
|
||||||
function()
|
|
||||||
return InventoryWeight
|
|
||||||
end,
|
|
||||||
getPlayerInv =
|
|
||||||
function(src)
|
|
||||||
local grabInv = nil
|
|
||||||
if src then
|
|
||||||
grabInv = exports[QSInv]:GetInventory(src)
|
|
||||||
else
|
|
||||||
grabInv = exports[QSInv]:getUserInventory()
|
|
||||||
end
|
|
||||||
return grabInv
|
|
||||||
end,
|
|
||||||
invImg =
|
|
||||||
function(item)
|
|
||||||
return "nui://"..QSInv.."/html/images/"..(Items[item].image or "")
|
|
||||||
end,
|
|
||||||
openShop =
|
|
||||||
function(name, label, items)
|
|
||||||
TriggerServerEvent("inventory:server:OpenInventory", "shop", label, items)
|
|
||||||
end,
|
|
||||||
serverOpenShop = function(shopName)
|
|
||||||
--
|
|
||||||
end,
|
|
||||||
registerShop =
|
|
||||||
function(name, label, items, society)
|
|
||||||
--
|
|
||||||
end,
|
|
||||||
openStash =
|
|
||||||
function(data)
|
|
||||||
TriggerEvent("inventory:client:SetCurrentStash", data.stash)
|
|
||||||
TriggerServerEvent("inventory:server:OpenInventory", "stash", data.stash, {
|
|
||||||
slots = data.slots or 50,
|
|
||||||
maxWeight = data.maxWeight or 600000
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
clearStash =
|
|
||||||
function(stashId)
|
|
||||||
exports[QSInv]:ClearOtherInventory('stash', stashId)
|
|
||||||
end,
|
|
||||||
getStash =
|
|
||||||
function(stashName)
|
|
||||||
return exports[QSInv]:GetStashItems(stashName)
|
|
||||||
end,
|
|
||||||
stashAddItem =
|
|
||||||
function(stashItems, stashName, items)
|
|
||||||
--
|
|
||||||
end,
|
|
||||||
stashRemoveItem =
|
|
||||||
function(stashItems, stashName, items)
|
|
||||||
for k, v in pairs(items) do
|
|
||||||
exports[QSInv]:RemoveItemIntoStash(stashName[1], k, v)
|
|
||||||
debugPrint("^6Bridge^7: ^2Removing ^3"..QSInv.." ^2Stash item^7:", k, v)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
registerStash =
|
|
||||||
function(name, label, slots, weight, owner, coords)
|
|
||||||
--
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{ invName = CoreInv,
|
{ invName = CoreInv,
|
||||||
removeItem =
|
removeItem =
|
||||||
function(src, item, remamount)
|
function(src, item, remamount)
|
||||||
@@ -1889,13 +1796,6 @@ function getCurrentInvWeight()
|
|||||||
weight = exports[OXInv]:GetPlayerWeight()
|
weight = exports[OXInv]:GetPlayerWeight()
|
||||||
end
|
end
|
||||||
|
|
||||||
if isStarted(QSInv) then
|
|
||||||
local itemcheck = exports[QSInv]:getUserInventory()
|
|
||||||
for _, v in pairs(itemcheck) do
|
|
||||||
weight += ((v.weight * v.amount) or 0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if isStarted(CoreInv) then
|
if isStarted(CoreInv) then
|
||||||
local itemcheck = exports[CoreInv]:getInventory()
|
local itemcheck = exports[CoreInv]:getInventory()
|
||||||
for _, v in pairs(itemcheck) do
|
for _, v in pairs(itemcheck) do
|
||||||
@@ -2318,7 +2218,7 @@ RegisterNetEvent(getScript()..":server:stashRemoveItem", stashRemoveItem)
|
|||||||
--- local hasAll, details = stashhasItem(currentStashItems, { iron = 2, wood = 5 })
|
--- local hasAll, details = stashhasItem(currentStashItems, { iron = 2, wood = 5 })
|
||||||
--- ```
|
--- ```
|
||||||
function stashhasItem(stashItems, items, amount)
|
function stashhasItem(stashItems, items, amount)
|
||||||
local invs = { OXInv, QSInv, CoreInv, CodeMInv, OrigenInv, TgiannInv, JPRInv, QBInv, PSInv, RSGInv }
|
local invs = { OXInv, CoreInv, CodeMInv, OrigenInv, TgiannInv, JPRInv, QBInv, PSInv, RSGInv }
|
||||||
local foundInv = ""
|
local foundInv = ""
|
||||||
|
|
||||||
for _, inv in ipairs(invs) do
|
for _, inv in ipairs(invs) do
|
||||||
@@ -2357,7 +2257,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Registers a stash with the active inventory system.
|
--- Registers a stash with the active inventory system.
|
||||||
--- Supports either OXInv or QSInv.
|
--- Not all
|
||||||
---
|
---
|
||||||
--- @param name string Unique stash identifier.
|
--- @param name string Unique stash identifier.
|
||||||
--- @param label string Display name for the stash.
|
--- @param label string Display name for the stash.
|
||||||
|
|||||||
@@ -95,35 +95,6 @@ local progressFunc = {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
qs = {
|
|
||||||
start =
|
|
||||||
function(data)
|
|
||||||
if exports['qs-interface']:ProgressBar({
|
|
||||||
duration = debugMode and 1000 or data.time,
|
|
||||||
label = data.label,
|
|
||||||
position = 'bottom',
|
|
||||||
useWhileDead = data.dead or false,
|
|
||||||
canCancel = data.cancel or true,
|
|
||||||
disable = data.disableMovement or false,
|
|
||||||
anim = {
|
|
||||||
dict = data.dict,
|
|
||||||
clip = data.anim,
|
|
||||||
flag = data.flag or 32
|
|
||||||
},
|
|
||||||
prop = nil
|
|
||||||
}) then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
stop =
|
|
||||||
function()
|
|
||||||
--??
|
|
||||||
TriggerEvent("progressbar:client:cancel")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
esx = {
|
esx = {
|
||||||
start =
|
start =
|
||||||
function(data)
|
function(data)
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
• ox
|
• ox
|
||||||
• red (default)
|
• red (default)
|
||||||
• gta (default)
|
• gta (default)
|
||||||
• qs-interface
|
|
||||||
• lation
|
• lation
|
||||||
• esx
|
• esx
|
||||||
]]
|
]]
|
||||||
@@ -38,17 +37,6 @@ local notifyFunc = {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
qs = {
|
|
||||||
client =
|
|
||||||
function(title, message, type)
|
|
||||||
exports['qs-interface']:AddNotify(message, title, 6000)
|
|
||||||
end,
|
|
||||||
server =
|
|
||||||
function(title, message, type, src)
|
|
||||||
TriggerClientEvent('interface:notification', src, message, title, 6000)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
ox = {
|
ox = {
|
||||||
client =
|
client =
|
||||||
function(title, message, type)
|
function(title, message, type)
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
Supported systems include:
|
Supported systems include:
|
||||||
- gksphone
|
- gksphone
|
||||||
- yflip-phone
|
- yflip-phone
|
||||||
- qs-smartphone
|
|
||||||
- qs-smartphone-pro
|
|
||||||
- roadphone
|
- roadphone
|
||||||
- lb-phone
|
- lb-phone
|
||||||
- qb-phone
|
- qb-phone
|
||||||
@@ -42,24 +40,14 @@ local phoneFunc = {
|
|||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ phone = "yflip-phone",
|
{ phone = "yflip-phone",
|
||||||
sendMail =
|
sendMail =
|
||||||
function(mailData)
|
function(mailData)
|
||||||
TriggerServerEvent(getScript()..":yflip:SendMail", mailData)
|
TriggerServerEvent(getScript()..":yflip:SendMail", mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ phone = "qs-smartphone",
|
|
||||||
sendMail =
|
|
||||||
function(mailData)
|
|
||||||
TriggerServerEvent('qs-smartphone:server:sendNewMail', mailData)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ phone = "qs-smartphone-pro",
|
|
||||||
sendMail =
|
|
||||||
function(mailData)
|
|
||||||
TriggerServerEvent('phone:sendNewMail', mailData)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ phone = "roadphone",
|
{ phone = "roadphone",
|
||||||
sendMail =
|
sendMail =
|
||||||
function(mailData)
|
function(mailData)
|
||||||
@@ -68,6 +56,7 @@ local phoneFunc = {
|
|||||||
exports["roadphone"]:sendMail(mailData)
|
exports["roadphone"]:sendMail(mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ phone = "lb-phone",
|
{ phone = "lb-phone",
|
||||||
sendMail =
|
sendMail =
|
||||||
function(mailData)
|
function(mailData)
|
||||||
@@ -76,6 +65,7 @@ local phoneFunc = {
|
|||||||
TriggerServerEvent(getScript()..":lbphone:SendMail", mailData)
|
TriggerServerEvent(getScript()..":lbphone:SendMail", mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ phone = "qb-phone",
|
{ phone = "qb-phone",
|
||||||
sendMail =
|
sendMail =
|
||||||
function(mailData)
|
function(mailData)
|
||||||
@@ -111,18 +101,21 @@ local phoneFunc = {
|
|||||||
TriggerClientEvent('qb-phone:RefreshPhone', mailData.src)
|
TriggerClientEvent('qb-phone:RefreshPhone', mailData.src)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ phone = "npwd_qbx_mail",
|
{ phone = "npwd_qbx_mail",
|
||||||
sendMail =
|
sendMail =
|
||||||
function(mailData)
|
function(mailData)
|
||||||
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
|
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ phone = "jpr-phonesystem",
|
{ phone = "jpr-phonesystem",
|
||||||
sendMail =
|
sendMail =
|
||||||
function(mailData)
|
function(mailData)
|
||||||
TriggerServerEvent(getScript()..":jpr:SendMail", mailData)
|
TriggerServerEvent(getScript()..":jpr:SendMail", mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ phone = "ef-phone",
|
{ phone = "ef-phone",
|
||||||
sendMail =
|
sendMail =
|
||||||
function(mailData)
|
function(mailData)
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
--- registerCommand("greet", {
|
--- registerCommand("greet", {
|
||||||
--- "Greets the player",
|
--- "Greets the player",
|
||||||
--- { name = "name", help = "Name of the player to greet" },
|
--- { name = "name", help = "Name of the player to greet" },
|
||||||
--- function(source, args) print("Hello, "..args[1].."!") end,
|
|
||||||
--- nil,
|
--- nil,
|
||||||
|
--- function(source, args) print("Hello, "..args[1].."!") end,
|
||||||
--- "admin"
|
--- "admin"
|
||||||
--- })
|
--- })
|
||||||
--- ```
|
--- ```
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ Exports = {
|
|||||||
OXInv = "ox_inventory",
|
OXInv = "ox_inventory",
|
||||||
QBInv = "qb-inventory",
|
QBInv = "qb-inventory",
|
||||||
PSInv = "ps-inventory",
|
PSInv = "ps-inventory",
|
||||||
QSInv = "qs-inventory",
|
|
||||||
CoreInv = "core_inventory",
|
CoreInv = "core_inventory",
|
||||||
CodeMInv = "codem-inventory",
|
CodeMInv = "codem-inventory",
|
||||||
OrigenInv = "origen_inventory",
|
OrigenInv = "origen_inventory",
|
||||||
|
|||||||
Reference in New Issue
Block a user