mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 14:56:02 +01:00
Change qb-inv item removal to do in one go
This commit is contained in:
@@ -88,6 +88,8 @@ function addItem(item, amount, info, src)
|
|||||||
if src then
|
if src then
|
||||||
TriggerEvent(getScript()..":server:toggleItem", true, item, amount, src, info)
|
TriggerEvent(getScript()..":server:toggleItem", true, item, amount, src, info)
|
||||||
else
|
else
|
||||||
|
local timeout = GetGameTimer() + 5000
|
||||||
|
while currentToken == nil and GetGameTimer() < timeout do Wait(100) end
|
||||||
TriggerServerEvent(getScript()..":server:toggleItem", true, item, amount, nil, info, nil, currentToken)
|
TriggerServerEvent(getScript()..":server:toggleItem", true, item, amount, nil, info, nil, currentToken)
|
||||||
currentToken = nil -- clear client cached token
|
currentToken = nil -- clear client cached token
|
||||||
end
|
end
|
||||||
@@ -113,7 +115,7 @@ function removeItem(item, amount, src, slot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if src then
|
if src then
|
||||||
debugPrint(src)
|
--debugPrint(src)
|
||||||
TriggerEvent(getScript()..":server:toggleItem", false, item, amount, src, nil, slot)
|
TriggerEvent(getScript()..":server:toggleItem", false, item, amount, src, nil, slot)
|
||||||
else
|
else
|
||||||
TriggerServerEvent(getScript()..":server:toggleItem", false, item, amount, nil, nil, slot)
|
TriggerServerEvent(getScript()..":server:toggleItem", false, item, amount, nil, nil, slot)
|
||||||
@@ -211,17 +213,22 @@ RegisterNetEvent(getScript()..":server:toggleItem", function(give, item, amount,
|
|||||||
|
|
||||||
elseif isStarted(QBInv) then
|
elseif isStarted(QBInv) then
|
||||||
invName = QBInv
|
invName = QBInv
|
||||||
while remamount > 0 do
|
if Core.Functions.GetPlayer(src).Functions.RemoveItem(item, remamount, slot) then
|
||||||
if Core.Functions.GetPlayer(src).Functions.RemoveItem(item, 1, slot) then
|
TriggerClientEvent((isStarted(QBInv) and QBInvNew and "qb-" or "").."inventory:client:ItemBox", src, Items[item], "remove", amount or 1)
|
||||||
remamount -= 1
|
|
||||||
else
|
else
|
||||||
print("^1Error removing "..item.." Amount left: "..remamount)
|
print("^1Error removing "..item.." Amount left: "..remamount)
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if Config.Crafting ~= nil and Config.Crafting.showItemBox then
|
|
||||||
TriggerClientEvent((isStarted(QBInv) and QBInvNew and "qb-" or "").."inventory:client:ItemBox", src, Items[item], "remove", amount or 1)
|
|
||||||
end
|
end
|
||||||
|
--while remamount > 0 do
|
||||||
|
-- if Core.Functions.GetPlayer(src).Functions.RemoveItem(item, 1, slot) then
|
||||||
|
-- remamount -= 1
|
||||||
|
-- else
|
||||||
|
-- print("^1Error removing "..item.." Amount left: "..remamount)
|
||||||
|
-- break
|
||||||
|
-- end
|
||||||
|
--end
|
||||||
|
--if Config.Crafting ~= nil and Config.Crafting.showItemBox then
|
||||||
|
-- TriggerClientEvent((isStarted(QBInv) and QBInvNew and "qb-" or "").."inventory:client:ItemBox", src, Items[item], "remove", amount or 1)
|
||||||
|
--end
|
||||||
|
|
||||||
elseif isStarted(PSInv) then
|
elseif isStarted(PSInv) then
|
||||||
invName = PSInv
|
invName = PSInv
|
||||||
|
|||||||
Reference in New Issue
Block a user