Open djoser30 opened 2 years ago
I want to prevent people from spamming my room by joining with multiple accounts at the same time. How can I do this? The last time someone gave me a solution, the same person could not join my room again even after they left, so they effectively got banned from the room after their first time using it.
@djoser30 As far as I have understood, you did take a look at these issues (#1161 and #1284). If you want to one does multiple join to get banned permanently, then you can use the following code:
var playerList = {};
room.onPlayerJoin = function(player){
if(playerList[player.name] == undefined){
playerList[player.name] = {name: player.name, auth: player.auth, conn: player.conn, isInTheRoom: true, isBlacklisted: false};
}
else{
playerList[player.name].isInTheRoom = true; //To catch the identical players with the same auth or the same conn in the room
}
var p = playerList.find(x => (x.isInTheRoom == true) && (x.auth == player.auth || x.conn == player.conn));
if(p){
room.kickPlayer(p.id,"Joining the room with multiple accounts is prohibited!",true);
room.kickPlayer(player.id,"Joining the room with multiple accounts is prohibited!",true);
playerList[p.name].isBlacklisted = true;
playerList[player.name].isBlacklisted = true; //If the person uses different name under the same auth or conn.
}
}
room.onPlayerLeave = function(player){
playerList[player.name].isInTheRoom = false;
}
If this is not what you are seeking, I will kindly ask you to describe your issue in a more comprehensible way.
@thenorthstar I think that #1161 and #1284 answer my question. Thank you for your input though.
I want to prevent people from spamming my room by joining with multiple accounts at the same time. How can I do this? The last time someone gave me a solution, the same person could not join my room again even after they left, so they effectively got banned from the room after their first time using it.