Nut.command.add

This function creates a chat command. The command name must be unique.

Arguments

 * String command
 * Table data

Data Structure
desc [string] Description of the command. syntax [string] Arguments for the command (Not the actual arguments, just for visualisation) adminOnly [bool] Restrict to admins. superAdminOnly [bool] Restrict to superadmins. onRun [function] Function to call when command is run. onCanRun [function] Function to check if the command can be run. Return false or true for it to work.

Return Values
none

Examples
nut.command.add("kill", {   adminOnly = true, -- command only works for admins    syntax = "[string playername]", -- shows a player name needs to be given    onRun = function(client, arguments)        local target = nut.util.findPlayer(arguments[1]) -- get a player via the first argument aka the name

if target == nil then client:notify("Invalid player!") return end -- if there was no player found dont run the rest of the code and notify the executer

target:Kill -- kill the target client:notify(string.format("You have successfully killed %s!", target:Name)) -- notify, using string.format end })