Skip to content

Commit

Permalink
fix(server/inventory): add/remove/set item commands failed index
Browse files Browse the repository at this point in the history
Using these commands from the server broke the logging and threw an error.
  • Loading branch information
thelindat committed Feb 18, 2022
1 parent 1b8e531 commit 252b1ac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ import.commands('ox_inventory', {'additem', 'giveitem'}, function(source, args)
if args.item and args.count > 0 then
Inventory.AddItem(args.target, args.item.name, args.count, args.metatype)
local inventory = Inventories[args.target]
source = Inventories[source]
source = Inventories[source] or {label = 'console', owner = 'console'}

Log(('%s gave %sx %s to %s'):format(source.label, args.count, args.item.name, inventory.label),
source.owner,
Expand All @@ -1033,7 +1033,7 @@ import.commands('ox_inventory', 'removeitem', function(source, args)
if args.item and args.count > 0 then
Inventory.RemoveItem(args.target, args.item.name, args.count, args.metaType)
local inventory = Inventories[args.target]
source = Inventories[source]
source = Inventories[source] or {label = 'console', owner = 'console'}

Log(('%s took %sx %s from %s'):format(source.label, args.count, args.item.name, inventory.label),
source.owner,
Expand All @@ -1048,9 +1048,9 @@ import.commands('ox_inventory', 'setitem', function(source, args)
if args.item and args.count > 0 then
Inventory.SetItem(args.target, args.item.name, args.count, args.metaType)
local inventory = Inventories[args.target]
source = Inventories[source]
source = Inventories[source] or {label = 'console', owner = 'console'}

Log(('%s set %s\' %s count to %sx (target: %s)'):format(source.label, inventory.label, args.item.name, args.count),
Log(('%s set %s\' %s count to %sx'):format(source.label, inventory.label, args.item.name, args.count),
source.owner,
'admin', inventory.owner
)
Expand Down

0 comments on commit 252b1ac

Please sign in to comment.