Jump to content

Hide chat permanently


Piorun

Recommended Posts

Posted

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") 

Posted

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 :D.

Posted

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)

Posted

What event did you try to cancel?

Try this (server-side code):

addEventHandler("onPlayerChat", root, function() cancelEvent() end) 

Posted
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.

Posted
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.

Posted
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.

Posted
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 :D.

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...