Skip to content

Commit

Permalink
refactor(server/inventory): assign commands to group.admin
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Mar 4, 2022
1 parent f768449 commit 1243351
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ game 'gta5'
--[[ Resource Information ]]--
name 'ox_inventory'
author 'Overextended'
version '2.5.3'
version '2.5.4'
repository 'https://github.com/overextended/ox_inventory'
description 'Slot-based inventory with metadata'

Expand Down
17 changes: 8 additions & 9 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ RegisterServerEvent('ox_inventory:updateWeapon', function(action, value, slot)
end
end)

lib.addCommand('ox_inventory', {'additem', 'giveitem'}, function(source, args)
lib.addCommand('group.admin', {'additem', 'giveitem'}, function(source, args)
args.item = Items(args.item)
if args.item and args.count > 0 then
Inventory.AddItem(args.target, args.item.name, args.count, args.metatype)
Expand All @@ -1041,7 +1041,7 @@ lib.addCommand('ox_inventory', {'additem', 'giveitem'}, function(source, args)
end
end, {'target:number', 'item:string', 'count:number', 'metatype:?string'})

lib.addCommand('ox_inventory', 'removeitem', function(source, args)
lib.addCommand('group.admin', 'removeitem', function(source, args)
args.item = Items(args.item)
if args.item and args.count > 0 then
Inventory.RemoveItem(args.target, args.item.name, args.count, args.metaType)
Expand All @@ -1056,7 +1056,7 @@ lib.addCommand('ox_inventory', 'removeitem', function(source, args)
end
end, {'target:number', 'item:string', 'count:number', 'metatype:?string'})

lib.addCommand('ox_inventory', 'setitem', function(source, args)
lib.addCommand('group.admin', 'setitem', function(source, args)
args.item = Items(args.item)
if args.item and args.count >= 0 then
Inventory.SetItem(args.target, args.item.name, args.count, args.metaType)
Expand Down Expand Up @@ -1087,28 +1087,27 @@ lib.addCommand(false, 'clearevidence', function(source, args)
end
end, {'evidence:number'})

lib.addCommand('ox_inventory', 'takeinv', function(source, args)
lib.addCommand('group.admin', 'takeinv', function(source, args)
Inventory.Confiscate(args.target)
end, {'target:number'})

lib.addCommand('ox_inventory', 'returninv', function(source, args)
lib.addCommand('group.admin', 'returninv', function(source, args)
Inventory.Return(args.target)
end, {'target:number'})

lib.addCommand('ox_inventory', 'clearinv', function(source, args)
lib.addCommand('group.admin', 'clearinv', function(source, args)
Inventory.Clear(args.target)
end, {'target:number'})

lib.addCommand('ox_inventory', 'saveinv', function()
lib.addCommand('group.admin', 'saveinv', function()
saveInventories()
end)

lib.addCommand('ox_inventory', 'viewinv', function(source, args)
lib.addCommand('group.admin', 'viewinv', function(source, args)
local inventory = Inventories[args.target] or Inventories[tonumber(args.target)]
TriggerClientEvent('ox_inventory:viewInventory', source, inventory)
end, {'target'})

lib.addCommand = nil
Inventory.accounts = server.accounts

TriggerEvent('ox_inventory:loadInventory', Inventory)
Expand Down

0 comments on commit 1243351

Please sign in to comment.