Jump to content

[QUESTION] How to output every command entered into console


banmandan

Recommended Posts

I was curious if it was possible to output every single command entered into console?

 

For example:

No matter which command a player enters, it’ll output on console. I know you can add this call to a regular function, but you’d need to tie it to every command manually, and when there’s over 300 commands it’s hard to get every one of them.

 

So to recap, even if it’s not a valid command I’d like it to be sent to console - can this be done?

Link to comment
addEventHandler("onClientConsole", localPlayer,
  function (text)
    local args = split(text, " ") -- split the text by spaces
    local command = table.remove(args, 1) -- remove the first word from the args table and put it into the "command" variable
    
    outputConsole(command)
  end
)

This should work, but I haven't tested it. This is clientside code by the way. You can use onConsole on the server but I believe that won't trigger for commands handled by a command handler.

Edited by MrTasty
  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...