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
showChat(false) 

This will hide the chat and it's input permanently, unless other script turns chat back on.

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

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)

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

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.

Discord: its.tails

Posted

First hide the chat, then output a bunch of blank messages, and cancel out 'onPlayerChat' event.

Need a scripter? Feel free to contact me for inexpensive high-quality service!

Skype username: friedonibot

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.

If I helped you, please click the like button on the right ;) Thanks!

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