Open djoser30 opened 2 years ago
I need an anti-spam filter that does not block commands (like !help or !bb) on Haxball Bot Headless Level 4. Can anyone help me?
@djoser30 What you need is to substitute their place with each other. Most probably you're using the spam filter before the section of your commands.
I need an anti-spam filter that does not block commands (like !help or !bb) on Haxball Bot Headless Level 4. Can anyone help me?
@djoser30 What you need is to substitute their place with each other. Most probably you're using the spam filter before the section of your commands.
I am pretty sure that the spam filter was at the end of the code.
var room = HBInit({
roomName: "Ranger",
playerName: "Ranger#6017",
maxPlayers: 8,
public: false,
token: "XX",
noPlayer: false
});
// variaveis
var localplayers = [0, 0, 0, 0, 0, 0];
var Contagem = 0;
var mutados = [];
let palhetadecores = { // palheta de cores
vermelho: 0xFF0000,
verde: 0x7DFA89
};
// sitema de mute by:aazin#8560
function mute(message, player) {
room.sendAnnouncement(mutados.includes(message) ? `${message} já está mutado.` : `${message} foi mutado.\nMutados: ${mutados.push(message)}`, player);
}
function unmute(message, player) {
if (mutados.includes(message)) {
var remover = mutados.indexOf(message);
mutados.splice(remover, 1);
room.sendAnnouncement(message + " pode falar agora.");
}
else {
room.sendAnnouncement(message + " não foi mutado.", player);
}
}
function mutes(player) {
room.sendAnnouncement(mutados.length ? `Mutes: ${mutados.join(", ")}` : "Ninguém foi mutado.", player);
}
// sistema contra spameiros
room.onPlayerChat = function (player, message) {
if(player.name === "ranger") { // jogador que que ta livre do sistema de SPAM
Contagem = 1;
}
if (message[0][0] == "!") { // prefixo que deixa comandos livre de SPAM
Contagem = 1;
}
localplayers.push(player.id);
Contagem++;
if (Contagem === 4) { // ALERTA para spameiros
if (localplayers[localplayers.length - 1] === player.id && localplayers[localplayers.length - 2] === player.id && localplayers[localplayers.length - 3] === player.id && localplayers[localplayers.length - 4] === player.id) {
room.sendAnnouncement("Alerta, você ta enviando muitas mensagens em um curto periodo de tempo!.", player.id, palhetadecores.vermelho, "bold");
}
}
if (Contagem === 6) { // Punindo spameiros
if (localplayers[localplayers.length - 1] === player.id && localplayers[localplayers.length - 2] === player.id && localplayers[localplayers.length - 3] === player.id && localplayers[localplayers.length - 4] === player.id && localplayers[localplayers.length - 5] === player.id && localplayers[localplayers.length - 6] === player.id) {
room.sendAnnouncement(player.name + " Foi mutado por fazer SPAM! ", null, palhetadecores.vermelho, 'bold', 1);
mutados.push(player.name);
setTimeout(() => { // contagem regressiva para remover o mute do spameiro, opcional.
var remover = mutados.indexOf(message);
mutados.splice(remover, 1);
room.sendAnnouncement("comporte-se "+ player.name + " não faça SPAM! ", player.id, palhetadecores.verde, "bold", 2);
}, 10_000);
}
}
if (localplayers[localplayers.length - 1] !== localplayers[localplayers.length - 2]) { // resetar alertas para possiveis spameiros
Contagem = 1;
}
if (player.name === "Mr(D)" && player.name === "Lyreco") { // reset nome do possivel spameiro
Contagem = 1;
}
if (mutados.includes(player.name)) {
room.sendAnnouncement(" Você foi mutado aguarde alguns minutos para poder falar novamente.", player.id, palhetadecores.vermelho, "bold");
return false;
}
}
I need an anti-spam filter that does not block commands (like !help or !bb) on Haxball Bot Headless Level 4. Can anyone help me?