Don't parse item object to client, added weapon component notifications (more see desc)

- Removed xPlayer .displayBank()
- Fixed issues with giving weapon using commands
- Modified ESX.UI.ShowInventoryItemNotification() to take string instead of table
- Minor adjustments and variable renames
- Fixed lower case weapons not droppable
- Removed /disconnect command becasue fivem implemented their own
This commit is contained in:
ElPumpo
2020-01-20 14:33:24 +01:00
parent 17b19893c9
commit cd1ce6a849
5 changed files with 93 additions and 77 deletions
+14 -8
View File
@@ -124,15 +124,18 @@ AddEventHandler('es:activateMoney', function(money)
end)
RegisterNetEvent('esx:addInventoryItem')
AddEventHandler('esx:addInventoryItem', function(item, count)
AddEventHandler('esx:addInventoryItem', function(item, count, showNotification)
for k,v in ipairs(ESX.PlayerData.inventory) do
if v.name == item.name then
ESX.PlayerData.inventory[k] = item
if v.name == item then
ESX.UI.ShowInventoryItemNotification(true, v.label, count - v.count)
ESX.PlayerData.inventory[k].count = count
break
end
end
ESX.UI.ShowInventoryItemNotification(true, item, count)
if showNotification then
ESX.UI.ShowInventoryItemNotification(true, item, count)
end
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
ESX.ShowInventory()
@@ -140,15 +143,18 @@ AddEventHandler('esx:addInventoryItem', function(item, count)
end)
RegisterNetEvent('esx:removeInventoryItem')
AddEventHandler('esx:removeInventoryItem', function(item, count)
AddEventHandler('esx:removeInventoryItem', function(item, count, showNotification)
for k,v in ipairs(ESX.PlayerData.inventory) do
if v.name == item.name then
ESX.PlayerData.inventory[k] = item
if v.name == item then
ESX.UI.ShowInventoryItemNotification(false, v.label, v.count - count)
ESX.PlayerData.inventory[k].count = count
break
end
end
ESX.UI.ShowInventoryItemNotification(false, item, count)
if showNotification then
ESX.UI.ShowInventoryItemNotification(false, item, count)
end
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
ESX.ShowInventory()