Jump to content

[HELP] Local Mute Player


AliGR

Recommended Posts

Hey,

Yeah, it's possible.

Unfortunately, not with one line of code. 😄

A client-sided way to do it is to save the serials of the players you don't want messages from in a table and then save them in an xml file (you will need load and save operations of course - XML functions).
And when the event onClientChatMessage is triggered check whether the source's serial is one of the ones in the xml file/table. If it is => cancelEvent()
*Note that you will have the get player's serial from server!

The server-sided way is to put the serials in a table and then convert it toJSON and save it as account data (setAccountData). To load them you will need to get them (getAccountData) and convert to a table (fromJSON).
The thing is that you will need to cancel the onChatMessage event and re-write the operations of sending the messages to all the players (with a for loop). And then to do the filtering who should and who shouldn't receive the message by checking the serials in the table.

In my opinion the client-sided one is better and easier. 😄 
Especially if you are new to scripting.

I hope I gave you enough information on how it can be done.

Edited by SpecT
Link to post
18 hours ago, SpecT said:

Hey,

Yeah, it's possible.

Unfortunately, not with one line of code. 😄

A client-sided way to do it is to save the serials of the players you don't want messages from in a table and then save them in an xml file (you will need load and save operations of course - XML functions).
And when the event onClientChatMessage is triggered check whether the source's serial is one of the ones in the xml file/table. If it is => cancelEvent()
*Note that you will have the get player's serial from server!

The server-sided way is to put the serials in a table and then convert it toJSON and save it as account data (setAccountData). To load them you will need to get them (getAccountData) and convert to a table (fromJSON).
The thing is that you will need to cancel the onChatMessage event and re-write the operations of sending the messages to all the players (with a for loop). And then to do the filtering who should and who shouldn't receive the message by checking the serials in the table.

In my opinion the client-sided one is better and easier. 😄 
Especially if you are new to scripting.

I hope I gave you enough information on how it can be done.

 

Hello

I want to create a blocking system so that one player can block another player for herself !!

Link to post

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