banmandan Posted February 16, 2019 Share Posted February 16, 2019 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
Addlibs Posted February 16, 2019 Share Posted February 16, 2019 (edited) 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 February 16, 2019 by MrTasty 1 Link to comment
banmandan Posted February 16, 2019 Author Share Posted February 16, 2019 Thanks for the input! I will try it Link to comment
KillerX Posted February 16, 2019 Share Posted February 16, 2019 (edited) Server Side : addEventHandler( 'onPlayerCommand' , root , function( command ) outputConsole( table.concat( { command } , ' ' ) , source ) end ) Edited February 16, 2019 by KillerX 1 Link to comment
banmandan Posted February 16, 2019 Author Share Posted February 16, 2019 51 minutes ago, KillerX said: Server Side : addEventHandler( 'onPlayerCommand' , root , function( command ) outputConsole( table.concat( { command } , ' ' ) , source ) end ) Thank you, I will try this too! Much appreciated 1 Link to comment
banmandan Posted February 16, 2019 Author Share Posted February 16, 2019 1 hour ago, KillerX said: Server Side : addEventHandler( 'onPlayerCommand' , root , function( command ) outputConsole( table.concat( { command } , ' ' ) , source ) end ) It does not appear to be working Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now