• ConCommand("say Hello World!") not working
    13 replies, posted
It seems that trying to execute the console command say from a script doesn't work. If replaced with something else (kill for example) the command works, but using say just causes nothing to happen. I have googled about but haven't seen anything about this particular problem. Is the command restricted? If so, how would I go about executing a say command? All help is appreciated!
you'd have to spit it up ConCommand("say", "Hello World!")
[QUOTE=Hentie;38818712]you'd have to spit it up ConCommand("say", "Hello World!")[/QUOTE] This doesn't seem to work...and since the wiki seems to show ConCommand only accepts one argument I'm not sure why it didn't spout out any errors when I tried
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexcfcc.html"]RunConsoleCommand[/URL]: RunConsoleCommand("say", "chat") --clientside [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8d04.html"]ConCommand[/URL]: ply:ConCommand("say chat")--serverside
[quote] for k,v in pairs(player.GetAll()) do v:ConCommand("say", "Hello World!") [/quote] The code above will make all players in the server say "Hello World!"
[QUOTE=tyguy;38819037]The code above will make all players in the server say "Hello World!"[/QUOTE] It will also give him an error. You forgot a "end".
My bad lol :P
[QUOTE=brandonj4;38818993][URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexcfcc.html"]RunConsoleCommand[/URL]: RunConsoleCommand("say", "chat") --clientside [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8d04.html"]ConCommand[/URL]: ply:ConCommand("say chat")--serverside[/QUOTE] That's what I've been trying, ply:ConCommand. Seems to work for everything but "say chat". Say anything just refuses to bring up anything. I already know I'm executing the function fine because things like kill and disconnect work fine. Just say not say.
tell us your code
[code] local plyTble = player.GetAll(); local toExecute = "say Hello World!" plyTble[1]:ConCommand(toExecute) [/code] That's written server side ofcourse. Like I said before, if I made toExecute suddenly equal "kill" or "disconnect" it works.
no idea, what I do is loop around the players and then run the command (like you did, but in a similiar way)
Anyone else have any experience with this?
Try this: ply:ConCommand("say Hello World!")
[QUOTE=Cold;38820140][code] local plyTble = player.GetAll(); local toExecute = "say Hello World!" plyTble[1]:ConCommand(toExecute) [/code] That's written server side ofcourse. Like I said before, if I made toExecute suddenly equal "kill" or "disconnect" it works.[/QUOTE] The serverside one has more restrictions. Try this: [code] if ( CLIENT ) then usermessage.Hook("conbitch", function( um ) LocalPlayer():ConCommand( um:ReadString() ) end ) else function ConCommand( ply, str ) umsg.Start("conbitch", ply) umsg.String(str) umsg.End() end end [/code] To use it just use ConCommand( player, "say bla") or whatever you want.
Sorry, you need to Log In to post a reply to this thread.