• Hook for things that print in chat? or just getting text values?
    5 replies, posted
Hey Facepunch, I'm looking for a way of getting the text value of stuff that happens in chat. For examples: print(..), PrintMessage(..), chat.AddText(..), etc. Is there a way of getting those values? I can already get what players say but what I'm looking for is everything but that. I tried the ChatText hook but it doesn't seem to work at all for anything (maybe only for chat.AddText?). Any help is be appreciated!
You can use [url]http://www.facepunch.com/showthread.php?t=859870[/url] to hook into the console, which is used for print(). But different forms of communication require different hooks -- there's not a universal solution.
That doesn't seem to work that well. The thread does show another module which might be useful (gmcl_menusystem) but I can't figure out how to use it as there I can't find a thread about it. [editline]edit[/editline] Or I'm using enginespew wrong. What exactly are group and level inputs used for?
Well, if you want you can use the player say hook, that gets what has been said. [b][url=wiki.garrysmod.com/?title=Gamemode.PlayerSay]Gamemode.PlayerSay [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[QUOTE=BastinkaLive;22874410]... I can already get what players say but what I'm looking for is everything but that. ..[/QUOTE] Not what I'm looking for - added I'm trying to lean towards clientside stuff.
For chat.AddText you can use [lua] oldtext = chat.AddText function chat.AddText(...) --steal arg table here oldtext(unpack(arg)) end [/lua] For printmessage you can use [lua] hook.Add("ChatText","notify",function(ply,pln,txt,messagetype) --txt is the text passed through PrintMessage and such. end) [/lua]
Sorry, you need to Log In to post a reply to this thread.