Created
February 20, 2023 18:07
-
-
Save Mkeefeus/4e71e157ba9f36c6380155e267adcb03 to your computer and use it in GitHub Desktop.
addCommand thoughts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib.addCommand({ | |
name = {'additem', 'giveitem'}, | |
description = "Give an item to a player", | |
groups = {'admin', 'moderator'}, | |
args = { | |
{ | |
name = "target", | |
description = "Server ID", | |
type = "number", | |
required = true | |
}, | |
{ | |
name = "item", | |
description = "Name of the item to give", | |
type = "string", | |
required = false | |
}, | |
{ | |
name = "count", | |
description = "Amount of the item to give, leave blank for 1", | |
type = "number", | |
required = false | |
}, | |
{ | |
name = "metatype", | |
description = "Metatype of the item", | |
type = "string", | |
required = false | |
} | |
}, | |
}, 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) | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment