PS-Inventory snippets
These functions above is for ps-inventory:
--- @param src number
--- @param type string
--- @param count number
function giveItem(src, item, count)
exports['ps-inventory']:AddItem(src, item, count)
notify.send(src, string.format(Locales.Get("GOT_ITEM"), count, item), 2500)
end--- @param src number
--- @param type string
--- @param count number
function canCarry(src, item, count)
local Player = QBCore.Functions.GetPlayer(src)
local totalWeight = exports['ps-inventory']:GetTotalWeight(Player.PlayerData.items)
local itemInfo = QBCore.Shared.Items[item:lower()]
if totalWeight + (itemInfo['weight'] * count) <= Config.MaxInventoryWeight then
return true
else
notify.send(src, Locales.Get('NOT_E_SPACE'), 'info', 2500)
end
endLast updated