diff --git a/server/main.lua b/server/main.lua index 7bd439b..6f03ba6 100644 --- a/server/main.lua +++ b/server/main.lua @@ -981,6 +981,18 @@ local function CreateNewDrop(source, fromSlot, toSlot, itemAmount, created) end end +local function OpenInventoryById(source, targetId) + local QBPlayer = QBCore.Functions.GetPlayer(source) + local TargetPlayer = QBCore.Functions.GetPlayer(tonumber(targetId)) + if not QBPlayer or not TargetPlayer then return end + if Player(targetId).state.inv_busy then TriggerClientEvent("ps-inventory:client:closeinv", targetId) end + Wait(1500) + Player(targetId).state.inv_busy = true + OpenInventory("otherplayer", targetId, nil, source) +end + +exports('OpenInventoryById', OpenInventoryById) + local function OpenInventory(name, id, other, origin) -- New QB compatibility