mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Add support for new ESX weight system (#63)
* Added weight support * Update main.lua * Removed unused variable
This commit is contained in:
+7
-8
@@ -262,21 +262,20 @@ AddEventHandler('esx_mechanicjob:getStockItem', function(itemName, count)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory)
|
||||
local item = inventory.getItem(itemName)
|
||||
local sourceItem = xPlayer.getInventoryItem(itemName)
|
||||
|
||||
-- is there enough in the society?
|
||||
if count > 0 and item.count >= count then
|
||||
|
||||
-- can the player carry the said amount of x item?
|
||||
if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('player_cannot_hold'))
|
||||
else
|
||||
if xPlayer.canCarryItem(itemName, count) then
|
||||
inventory.removeItem(itemName, count)
|
||||
xPlayer.addInventoryItem(itemName, count)
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn', count, item.label))
|
||||
xPlayer.showNotification(_U('have_withdrawn', count, item.label))
|
||||
else
|
||||
xPlayer.showNotification(_U('player_cannot_hold'))
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity'))
|
||||
xPlayer.showNotification(_U('invalid_quantity'))
|
||||
end
|
||||
end)
|
||||
end)
|
||||
@@ -299,10 +298,10 @@ AddEventHandler('esx_mechanicjob:putStockItems', function(itemName, count)
|
||||
xPlayer.removeInventoryItem(itemName, count)
|
||||
inventory.addItem(itemName, count)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity'))
|
||||
xPlayer.showNotification(_U('invalid_quantity'))
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label))
|
||||
xPlayer.showNotification(_U('have_deposited', count, item.label))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user