• Redirect chat command
    1 replies, posted
-Snip-
Returning any value in a Garry's Mod hook causes other hooks of the type to not be run. That means when you return a string from PlayerSay hook like that, it's sent right into the chat and it's not processed by the other hooks. I didn't test this, but maybe it will work. You may need to touch the GM:CanSeePlayerChat hook and hide the message from there, dunno. Didn't touch chat for loooong time. [lua] function Redirect( ply, text) if (string.sub(text, 1, 4) == "// ") then hook.Run("PlayerSay", ply, "/ooc ".. string.sub( text, 5 )); return ""; end end hook.Add( "PlayerSay", "Redirect", Redirect ) [/lua] EDIT: Better solution would probably be to edit the condition in "/ooc " hook to accept "//" too.
Sorry, you need to Log In to post a reply to this thread.