Piorun Posted January 5, 2016 Share Posted January 5, 2016 Hi guys, I want to ask you how to hide chat permanently. I tried to cancelEvent after "showchat" command but it doesnt work so then i tried to unbind 't' and 'y' key - doesn't work. I used on c-side unbindKey("t") unbindKey("y") Link to comment
John Smith Posted January 5, 2016 Share Posted January 5, 2016 showChat(false) This will hide the chat and it's input permanently, unless other script turns chat back on. Link to comment
Piorun Posted January 5, 2016 Author Share Posted January 5, 2016 but u can use "showchat" via console and magic's gone . Link to comment
Piorun Posted January 5, 2016 Author Share Posted January 5, 2016 Ok i did it like that: addEventHandler("onClientRender",root,function()showChat(false)end) I don't know if it's optimal but now i dont care . Link to comment
John Smith Posted January 5, 2016 Share Posted January 5, 2016 I don't really use showChat alot, so excuse my mistake ^^ but you could also try canceling onPlayerCommand event if command was 'showchat' (not sure if will work, but if it does, its better solution rather than using showChat each frame) Link to comment
vx89 Posted January 5, 2016 Share Posted January 5, 2016 What event did you try to cancel? Try this (server-side code): addEventHandler("onPlayerChat", root, function() cancelEvent() end) Link to comment
Mega9 Posted January 6, 2016 Share Posted January 6, 2016 What event did you try to cancel?Try this (server-side code): addEventHandler("onPlayerChat", root, function() cancelEvent() end) He wants to hide the chat, not prevent messages from being sent. Link to comment
Tails Posted January 6, 2016 Share Posted January 6, 2016 I don't really use showChat alot, so excuse my mistake ^^ but you could also try canceling onPlayerCommand event if command was 'showchat' (not sure if will work, but if it does, its better solution rather than using showChat each frame) I believe only server-side commands can be blocked. Link to comment
Revolt Posted January 6, 2016 Share Posted January 6, 2016 First hide the chat, then output a bunch of blank messages, and cancel out 'onPlayerChat' event. Link to comment
ViRuZGamiing Posted January 6, 2016 Share Posted January 6, 2016 indeed, showchat is in here; https://wiki.multitheftauto.com/wiki/Co ... _and_CVars Link to comment
vx89 Posted January 6, 2016 Share Posted January 6, 2016 What event did you try to cancel?Try this (server-side code): addEventHandler("onPlayerChat", root, function() cancelEvent() end) He wants to hide the chat, not prevent messages from being sent. OK, depends on his usecase, this is indeed true if some players can see the chat and some players will not, where only the first group can really speak with each other. In that case client-side event onClientChatMessage could be canceled instead. Link to comment
myonlake Posted January 7, 2016 Share Posted January 7, 2016 Ok i did it like that: addEventHandler("onClientRender",root,function()showChat(false)end) I don't know if it's optimal but now i dont care . Holy crap, don't do that. Use https://wiki.multitheftauto.com/wiki/OnConsole and call showChat whenever someone tries to show it. Not sure if MTA's internal command system is considered as "existing command handler" in this case, but test it at least. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now