haxball / haxball-issues

115 stars 43 forks source link

Ignore system #1445

Open guguxh opened 3 years ago

guguxh commented 3 years ago

I want to do a Ignore system but idk how I start this, my idea is to ppl can "block" any player and the messages of this player be blocked to the ppl.

genals commented 3 years ago

You need to implement a command like !ignore #id.

You make a list for every player in the room with the players that they will ignore (i recommend using the auth and not the id to identify the player to be ignored, but remember auth is only available in onPlayerJoin, see: PlayerObject).

In onPlayerChat you loop through all players in the room.

If the player who sends the message is not in the ignore list of the loop-player, you send the message by sendAnnouncement or sendChat to that player.

In onPlayerChat you return false (because you sent the message manually to the players).

guguxh commented 3 years ago

You need to implement a command like !ignore #id.

You make a list for every player in the room with the players that they will ignore (i recommend using the auth and not the id to identify the player to be ignored, but remember auth is only available in onPlayerJoin, see: PlayerObject).

In onPlayerChat you loop through all players in the room.

If the player who sends the message is not in the ignore list of the loop-player, you send the message by sendAnnouncement or sendChat to that player.

In onPlayerChat you return false (because you sent the message manually to the players).

I see this is like a mute, not an ignore system. I mean a system to all players, like a "block" or anything in facebook.

genals commented 3 years ago

You need to implement a command like !ignore #id.

You make a list for every player in the room with the players that they will ignore (i recommend using the auth and not the id to identify the player to be ignored, but remember auth is only available in onPlayerJoin, see: PlayerObject).

In onPlayerChat you loop through all players in the room.

If the player who sends the message is not in the ignore list of the loop-player, you send the message by sendAnnouncement or sendChat to that player.

In onPlayerChat you return false (because you sent the message manually to the players).

I see this is like a mute, not an ignore system. I mean a system to all players, like a "block" or anything in facebook.

What I described is how you can implement an IGNORE system.

A MUTE system is much easier to implement: In onPlayerChat you just check whether the player who wrote the message is on the mute list and then return false.