Print something to chat from command?

Hi so if someone runs a command in console I would like it to print something to chat for everyone not just client side.

function commandCheck()
   if(act dance) then
   chat.AddText( "user has ran act dance" ) 

hook.Add( "Think", "check", commandCheck )

I am really not good with lua, so if you could help me out and explain what each line means then this may help :slight_smile:

You can’t.

You could create a command lua-side and do it, but not with default commands.

[editline]3rd July 2014[/editline]

Try something like:

concommand.Add( "act_with_print", function( ply )
   print( "Nifty" )
   RunConsoleCommand( "act", "dance" )

Yes thats what I am trying to do, there is an exploit with a console command so I removed it then if I re added it:

concommand.Add( "dodgy_exploit", function( ply )
   print( steamworks.GetPlayerName( string steamID64 ) "tried to crash the server!" )

That defeats the whole purpose of his initial pseudo code, to capture all commands called, bind or through console, which you can only do in case of a binded to a key command.

[editline]3rd July 2014[/editline]

And you can’t override default console commands obviously.

Ive seen another server who have done this, and I am trying to do it like theres.

Edit: What I am going to do is find out where the command is (I think its an addon) then I am going to edit it there.

The “act” concommand is an engine console command and I believe there was a hook for it, but I can’t remember it or find it. ?

Thanks for the help but its not act that was just an example, the real command crashes any server so I don’t tend to reveal it.

You cannot override engine commands. If you found a crash exploit, send me a PM describing it.

Or, you know, you could PM Robotboy or I and tell us so we can get it fixed if it’s a default command like you say it is.