mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
520758b355 | ||
|
|
e4e9ef0fb2 | ||
|
|
ada724069b | ||
|
|
9198068a19 | ||
|
|
263d5160aa | ||
|
|
65137207ae | ||
|
|
3bd9935346 | ||
|
|
23e2488cd1 |
@@ -1,6 +1,6 @@
|
|||||||
name "Jim_Bridge"
|
name "Jim_Bridge"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "2.0.10"
|
version "2.0.11"
|
||||||
description "Framework Bridge By Jimathy"
|
description "Framework Bridge By Jimathy"
|
||||||
fx_version "cerulean"
|
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.'
|
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ elseif isStarted(QBExport) then
|
|||||||
itemResource = QBExport
|
itemResource = QBExport
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
Items = Core and Core.Shared.Items or nil
|
Items = Core and Core.Shared.Items or nil
|
||||||
|
CreateThread(function()
|
||||||
|
while not Items or not next(Items) do
|
||||||
|
Items = exports[QBExport]:GetCoreObject().Shared.Items
|
||||||
|
Wait(1000)
|
||||||
|
end
|
||||||
|
end)
|
||||||
if isStarted(QBExport) and not isStarted(QBXExport) then
|
if isStarted(QBExport) and not isStarted(QBXExport) then
|
||||||
RegisterNetEvent('QBCore:Client:UpdateObject', function()
|
RegisterNetEvent('QBCore:Client:UpdateObject', function()
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
|
|||||||
@@ -50,8 +50,9 @@ function hasItem(items, amount, src)
|
|||||||
|
|
||||||
local count = 0
|
local count = 0
|
||||||
for _, itemData in pairs(grabInv) do
|
for _, itemData in pairs(grabInv) do
|
||||||
|
jsonPrint(itemData)
|
||||||
if itemData and itemData.name == item then
|
if itemData and itemData.name == item then
|
||||||
count += (itemData.count or itemData.amount or 1)
|
count += (itemData.amount or itemData.count or 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
foundInv = foundInv:gsub("%-", "^7-^6"):gsub("%_", "^7_^6")
|
foundInv = foundInv:gsub("%-", "^7-^6"):gsub("%_", "^7_^6")
|
||||||
@@ -67,6 +68,9 @@ function hasItem(items, amount, src)
|
|||||||
end
|
end
|
||||||
return true, hasTable
|
return true, hasTable
|
||||||
end
|
end
|
||||||
|
-- if can't find inventory, return false
|
||||||
|
print("^1Error^7: ^1Can't find players inventory for some reason")
|
||||||
|
return false, {}
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Retrieves a player's inventory based on the active inventory system.
|
--- Retrieves a player's inventory based on the active inventory system.
|
||||||
@@ -99,8 +103,7 @@ function getPlayerInv(src)
|
|||||||
if src then
|
if src then
|
||||||
grabInv = exports[QSInv]:GetInventory(src)
|
grabInv = exports[QSInv]:GetInventory(src)
|
||||||
else
|
else
|
||||||
--grabInv = exports[QSInv]:getUserInventory()
|
grabInv = exports[QSInv]:getUserInventory()
|
||||||
grabInv = triggerCallback(getScript().."getServerInvData", GetPlayerServerId(PlayerId()))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif isStarted(OrigenInv) then
|
elseif isStarted(OrigenInv) then
|
||||||
@@ -172,11 +175,6 @@ function getPlayerInv(src)
|
|||||||
return grabInv, foundInv
|
return grabInv, foundInv
|
||||||
end
|
end
|
||||||
|
|
||||||
createCallback(getScript()..":getServerInvData", function(source)
|
|
||||||
local src = source
|
|
||||||
return getPlayerInv(src)
|
|
||||||
end)
|
|
||||||
|
|
||||||
function isInventoryOpen()
|
function isInventoryOpen()
|
||||||
if isStarted(OXInv) then
|
if isStarted(OXInv) then
|
||||||
return LocalPlayer.state.invBusy
|
return LocalPlayer.state.invBusy
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ RegisterNetEvent(getScript()..":server:toggleItem", function(give, item, amount,
|
|||||||
else
|
else
|
||||||
local amountToAdd = amount or 1
|
local amountToAdd = amount or 1
|
||||||
if isStarted(OXInv) then invName = OXInv
|
if isStarted(OXInv) then invName = OXInv
|
||||||
|
jsonPrint(info)
|
||||||
exports[OXInv]:AddItem(src, item, amountToAdd, info, slot)
|
exports[OXInv]:AddItem(src, item, amountToAdd, info, slot)
|
||||||
|
|
||||||
elseif isStarted(QSInv) then invName = QSInv
|
elseif isStarted(QSInv) then invName = QSInv
|
||||||
|
|||||||
@@ -30,15 +30,17 @@ function sellMenu(data)
|
|||||||
for k, v in pairs(data.sellTable.Items) do itemList[k] = 1 end
|
for k, v in pairs(data.sellTable.Items) do itemList[k] = 1 end
|
||||||
local _, hasTable = hasItem(itemList)
|
local _, hasTable = hasItem(itemList)
|
||||||
for k, v in pairsByKeys(data.sellTable.Items) do
|
for k, v in pairsByKeys(data.sellTable.Items) do
|
||||||
Menu[#Menu + 1] = {
|
if Items[k] then
|
||||||
isMenuHeader = not hasTable[k].hasItem,
|
Menu[#Menu + 1] = {
|
||||||
icon = invImg(k),
|
isMenuHeader = not hasTable[k].hasItem,
|
||||||
header = Items[k].label..(hasTable[k].hasItem and "💰 (x"..hasTable[k].count..")" or ""),
|
icon = invImg(k),
|
||||||
txt = Loc[Config.Lan].info["sell_all"]..v.." "..Loc[Config.Lan].info["sell_each"],
|
header = Items[k].label..(hasTable[k].hasItem and "💰 (x"..hasTable[k].count..")" or ""),
|
||||||
onSelect = function()
|
txt = Loc[Config.Lan].info["sell_all"]..v.." "..Loc[Config.Lan].info["sell_each"],
|
||||||
sellAnim({ item = k, price = v, ped = data.ped, onBack = function() sellMenu(data) end })
|
onSelect = function()
|
||||||
end,
|
sellAnim({ item = k, price = v, ped = data.ped, onBack = function() sellMenu(data) end })
|
||||||
}
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for k, v in pairsByKeys(data.sellTable) do
|
for k, v in pairsByKeys(data.sellTable) do
|
||||||
|
|||||||
@@ -565,3 +565,19 @@ if isServer() then
|
|||||||
registerStash(name, label, slots, weight, owner, coords)
|
registerStash(name, label, slots, weight, owner, coords)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RegisterNetEvent(getScript()..":openGrabBox", function(data)
|
||||||
|
if isStarted(OXInv) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local id = ""
|
||||||
|
if data.metadata then
|
||||||
|
id = data.metadata.id
|
||||||
|
elseif data.info then
|
||||||
|
id = data.info.id
|
||||||
|
end
|
||||||
|
openStash({
|
||||||
|
stash = id,
|
||||||
|
coords = GetEntityCoords(PlayerPedId())
|
||||||
|
})
|
||||||
|
end)
|
||||||
@@ -1 +1 @@
|
|||||||
2.0.10
|
2.0.11
|
||||||
Reference in New Issue
Block a user