• Print something to chat from command?
    10 replies, posted
Hi so if someone runs a command in console I would like it to print something to chat for everyone not just client side. [CODE] function commandCheck() if(act dance) then chat.AddText( "user has ran act dance" ) end hook.Add( "Think", "check", commandCheck ) [/CODE] I am really not good with lua, so if you could help me out and explain what each line means then this may help :)
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: [Code]concommand.Add( "act_with_print", function( ply ) print( "Nifty" ) RunConsoleCommand( "act", "dance" ) end)[/code]
[QUOTE=code_gs;45281981]You could create a command lua-side and do it, but not with default commands. [editline]3rd July 2014[/editline] Try something like: [Code]concommand.Add( "act_with_print", function( ply ) print( "Nifty" ) RunConsoleCommand( "act", "dance" ) end)[/code][/QUOTE] 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: [CODE] concommand.Add( "dodgy_exploit", function( ply ) print( steamworks.GetPlayerName( string steamID64 ) "tried to crash the server!" ) end) [/CODE]
[QUOTE=code_gs;45281981]You could create a command lua-side and do it, but not with default commands. [editline]3rd July 2014[/editline] Try something like: [Code]concommand.Add( "act_with_print", function( ply ) print( "Nifty" ) RunConsoleCommand( "act", "dance" ) end)[/code][/QUOTE] 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.
[QUOTE=Robotboy655;45282054]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.[/QUOTE] 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.
[QUOTE=Robotboy655;45282162]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.[/QUOTE] [url]http://wiki.garrysmod.com/page/GM/TranslateActivity[/url] ?
[QUOTE=Robotboy655;45282162]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.[/QUOTE] 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.
[QUOTE=F14;45282206]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.[/QUOTE] You cannot override engine commands. If you found a crash exploit, send me a PM describing it.
[QUOTE=F14;45282206]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.[/QUOTE] 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.
Sorry, you need to Log In to post a reply to this thread.