RegisterServerEvent("inventory:server:GiveItem")
AddEventHandler('inventory:server:GiveItem', function(name, inventory, item, amount)
local src = source
local Player = ESX.GetPlayerFromId(src)
local OtherPlayer = ESX.GetPlayerFromId(tonumber(name))
local totalWeight = ESX.GetTotalWeight(OtherPlayer.inventory)
local itemInfo = ESX.GetItems()[item.name:lower()]
if amount ~= 0 then
if OtherPlayer.addInventoryItem(item.name, amount, item.slot, item.info) then
if (totalWeight + (itemInfo["weight"] + amount)) <= ESX.GetConfig().MaxWeight then
if Player.removeInventoryItem(item.name, amount, item.slot, item.info) and OtherPlayer.addInventoryItem(item.name, amount,false, item.info) then
TriggerClientEvent('notification',src,"Şu İtemi Verdin : "..item.label..' ',3)
TriggerClientEvent("inventory:client:ItemBox",src, ESX.GetItems()[item.name],'remove',amount)
TriggerClientEvent('notification',src,"Şu İtemi Aldın : "..item.label..'',3)
end
else
TriggerClientEvent('notification',src,'Karşıdaki kişi maksimum kiloda',2)
TriggerClientEvent('notification',src,'Maksimum ağırlığa ulaştınız item eklenmedi',2)
end
end
end
end)