Creating commands
RegisterCommand
It is recommended to always use this (and not chatMessage
!) as it allows for the use of the integrated ACL system, and other core functionality (automatic completion, console usage, …). This native consists of 3 parameters (commandName
[string], handler
[func] and restricted
[boolean]).
Example
RegisterCommand("commandName", function(source --[[ this is the player ID (on the server): a number ]], args --[[ this is a table of the arguments provided ]], rawCommand --[[ this is what the user entered ]])
if source > 0 then
print("You are not console.")
else
print("This is console!")
end
end, true) -- this true bool means that the user cannot execute the command unless they have the 'command.commandName' ACL object allowed to one of their identifiers.
Further examples can be found at the respective Lua and C# introductions.
Last modified December 18, 2019: Move {root->content} again for edit links. (483165c)