haxball / haxball-issues

116 stars 43 forks source link

change nickname #1593

Closed ghost closed 1 year ago

ghost commented 2 years ago

I want the nicknames of the players entering the room to be changed automatically by the bot.

i saw it in a room, nickname of those who entered with vpn was changing automatically. I want at least this code

The reason I want this is because people constantly enter and leave the room with abusive nicknames.

Pls help me

thenorthstar commented 2 years ago

I want the nicknames of the players entering the room to be changed automatically by the bot.

i saw it in a room, nickname of those who entered with vpn was changing automatically. I want at least this code

The reason I want this is because people constantly enter and leave the room with abusive nicknames.

Pls help me

@mydestiny185 Duplicate of #1588.

ghost commented 2 years ago

I want the nicknames of the players entering the room to be changed automatically by the bot. i saw it in a room, nickname of those who entered with vpn was changing automatically. I want at least this code The reason I want this is because people constantly enter and leave the room with abusive nicknames. Pls help me

@mydestiny185 Duplicate of #1588.

@thenorthstar

I opened this issue because I couldn't find this code anywhere. I am sorry

thenorthstar commented 2 years ago

I want the nicknames of the players entering the room to be changed automatically by the bot. i saw it in a room, nickname of those who entered with vpn was changing automatically. I want at least this code The reason I want this is because people constantly enter and leave the room with abusive nicknames. Pls help me

@mydestiny185 Duplicate of #1588.

@thenorthstar

I opened this issue because I couldn't find this code anywhere. I am sorry

@mydestiny185 Make sure I also don't have that code. Already even though I have I don't share with anyone apart from the people who I trusted (they knows themselves); because it's made by editing the sensitive and obfuscated code of HaxBall API and if this code is seized by malevolent people, then it would be the end of story of HaxBall.

guguxh commented 2 years ago

Using the Haxball-Extended-Room API u can do this using settings. But if u rlly want and need this code in the normal API it's like this:

`js let playerList = {};

var room = HBInit({roomName:"TEST",noPlayer:true,public:false,maxPlayers:12});

room.onPlayerJoin = (player) => { if (playerList[player.name] == undefined) return playerList[player.name] = {name: player.name, id: player.id, nick: undefined}; }

room.onPlayerChat = (player, message) => { let newNickname = playerList[player.name].nick; if (message.toLowerCase().substr(0, 6) == "!nick " ) { yournick = message.substr(6); playerList[player.name].nick = yournick; return false; }

if (newNickname == undefined) {
    room.sendAnnouncement(`${player.name} : ${message}`);
} else if (newNickname !== undefined) room.sendAnnouncement(`${newNickname} : ${message}`);

return false;

}`

guguxh commented 2 years ago

This code works using command, but u can change using an array of names it's easy I trust you.

thenorthstar commented 2 years ago

Using the Haxball-Extended-Room API u can do this using settings. But if u rlly want and need this code in the normal API it's like this:

`js let playerList = {};

var room = HBInit({roomName:"TEST",noPlayer:true,public:false,maxPlayers:12});

room.onPlayerJoin = (player) => { if (playerList[player.name] == undefined) return playerList[player.name] = {name: player.name, id: player.id, nick: undefined}; }

room.onPlayerChat = (player, message) => { let newNickname = playerList[player.name].nick; if (message.toLowerCase().substr(0, 6) == "!nick " ) { yournick = message.substr(6); playerList[player.name].nick = yournick; return false; }

if (newNickname == undefined) {
  room.sendAnnouncement(`${player.name} : ${message}`);
} else if (newNickname !== undefined) room.sendAnnouncement(`${newNickname} : ${message}`);

return false;

}`

@guguxh Yours is a different approach, OK but I have seen this in two different rooms and they were all using their own editions and player names were the new nicknames. For example, like on the following:

image

For example, let the players name are changed into Turkish male and female names and both seem on the chat as the same.

guguxh commented 2 years ago

Yep, this command is for personal editions, any player can do, but this script can be changed easily to an array namer or admin only can put nicknames in players.