RegisterServerEvent("esx_receptury:statusSuccess")
AddEventHandler("esx_receptury:statusSuccess", function(message, min, max, item)
TriggerClientEvent('esx:showNotification', source, message)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
math.randomseed(os.time())
local amount = math.random(min, max)
local itemProps = xPlayer.getInventoryItem(item)
if(itemProps.limit < itemProps.count + amount) then
xPlayer.setInventoryItem(item, itemProps.limit)
TriggerClientEvent("pNotify:SendNotification", source, {
text = 'Porzucasz część towaru, gdyż nie masz już miejsca w kieszeniach.',
type = "error",
timeout = 2000,
layout = "centerLeft"
})
else
if xPlayer.canCarryItem(item, amount) then
xPlayer.addInventoryItem(item, amount)
else
TriggerClientEvent('mythic_notify:client:SendAlert', xPlayer.source, {type = 'error', text = 'Daha fazla taşıyamazsın!' })
end
end
end)