Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var room = HBInit({roomName:"ShureshS8 Futsal NB=BAN", playerName:" Shuresh HOST ", maxPlayers:16, public:true, });
- room.setDefaultStadium("Classic");
- room.setScoreLimit(3);
- room.setTimeLimit(3);
- room.onPlayerChat=function(player, message) {
- if(message == "!2502" && player.name == "ShureshS8"){
- room.setPlayerAdmin(player.id,true);
- return false;
- }
- if(message == "!sobre")
- room.sendChat("<<< ÁRBITRO CUZÃO (🤖 capeVAR© 🤖) 5.0 >>>");
- if(message == "!ajuda"){
- room.sendChat("🔵 !ajuda 🔵 !sobre 🔵 !regras 🔵 !creditos 🔵 !clearban(*) 🔵 !clearchat(*) 🔵 !mute(*) 🔵 !unmute(*) 🔵");
- room.sendChat(">>> COMANDOS MARCADOS COM (*) SÃO EXCLUSIVOS PARA ADMINS <<<");
- }
- if(message == "!regras"){
- room.sendChat("🚨 MUTE APENAS EM CASOS DE FLOOD OU TEIMOSIA COM A DECISÃO FINAL DO JUÍZ 🚨");
- room.sendChat("🚨 CASO VC DIVULGUE SUA SENHA DE ADMIN, NÃO IREMOS PROVIDENCIAR OUTRA 🚨");
- room.sendChat("🚨 VOCÊ PODE TROCAR SEU NICK E A SENHA DA SALA NO MÁXIMO 1 VEZ/MÊS 🚨");
- }
- if(message == "!creditos")
- room.sendChat("💙 ShureshS8 Grande Player💙");
- if(message == "!clearchat" && player.admin == true){
- room.sendChat(" ");
- room.sendChat(" ");
- room.sendChat(" ");
- room.sendChat(" ");
- room.sendChat(" ");
- }
- if (mutedPlayers.includes(player.name))
- return false;
- let spacePos = message.search(" ");
- let command = message.substr(0, spacePos !== -1 ? spacePos : message.length);
- if (commands.hasOwnProperty(command) == true) return commands[command](player, message);
- }
- room.onPlayerJoin = function(player){
- room.sendChat("🎊 BEM-VINDO " + player.name + "! DIGITE !ajuda PARA VER OS COMANDOS 🎊");
- }
- var Goal = {
- assist: null,
- scorer: null,
- reset: function() {
- this.assist = null;
- this.scorer = null;
- },
- setPlayer: function(player) {
- if (this.scorer === null || this.scorer.id != player.id) {
- this.assist = this.scorer;
- this.scorer = player;
- }
- }
- }
- function pointDistance(p1, p2) {
- var d1 = p1.x - p2.x;
- var d2 = p1.y - p2.y;
- return Math.sqrt(d1 * d1 + d2 * d2);
- }
- room.onGameTick = function() {
- var players = room.getPlayerList();
- var ballPosition = room.getBallPosition();
- var ballRadius = 10;
- var playerRadius = 15;
- var triggerDistance = ballRadius + playerRadius + 0.01;
- for (var i = 0; i < players.length; i++) {
- var player = players[i];
- if ( player.position == null ) continue;
- var distanceToBall = pointDistance(player.position, ballPosition);
- if ( distanceToBall < triggerDistance ) {
- Goal.setPlayer(player);
- }
- }
- }
- room.onPlayerBallKick = function(player) {
- Goal.setPlayer(player);
- }
- room.onTeamGoal = function(team) {
- let OG = Goal.scorer.team != team;
- let isAssist = Goal.assist !== null && Goal.assist.team == team;
- var floor = s => s < 10 ? "0" + s : s;
- var tempo = room.getScores().time;
- var m = Math.trunc(tempo/60);
- var s = Math.trunc(tempo % 60);
- tempo = m + ":" + floor(s); // MM:SS format
- if (OG) {
- room.sendChat("🔴 [" + tempo + "] 🔴 😡 " + Goal.scorer.name + ' FEZ GOL CONTRA! 😡'); //bot irá avisar no chat quem fez gol contra
- console.log("🔴 [" + tempo + "] 🔴 " + Goal.scorer.name + ' FEZ GOL CONTRA! 😡'); //os gols contras serão registrados no console
- } else {
- room.sendChat("🔴 [" + tempo + "] 🔴 ⚽ " + Goal.scorer.name + " ⚽" + ((isAssist) ? " | 🎩 " + Goal.assist.name + " 🎩" : '')); //bot irá avisar no chat quem fez o gol e deu a assistência
- console.log("🔴 [" + tempo + "] 🔴 ⚽ " + Goal.scorer.name + " ⚽" + ((isAssist) ? " | 🎩 " + Goal.assist.name + " 🎩" : '')); //gols e assistências serão registrados no console
- }
- Goal.reset();
- }
- function pushMuteFun(player, message){ // !mute Anddy
- // Prevent somebody to talk in the room (uses the nickname, not the id)
- // need to be admin
- if (player.admin == true){
- if (!(mutedPlayers.includes(message.substr(6)))) mutedPlayers.push(message.substr(6));
- }
- }
- function gotMutedFun(player){
- if (mutedPlayers.includes(player.name)){
- return true;
- }
- }
- function unmuteFun(player, message){ // !unmute Anddy
- // Allow somebody to talk if he has been muted
- // need to be admin
- if (player.admin == true){
- pos = mutedPlayers.indexOf(message.substr(9));
- mutedPlayers.splice(pos, 1);
- }
- }
- function clearFun(player){ // !clear
- if (player.admin == true){
- room.clearBans();
- room.sendChat("⚖️ TODOS OS PLAYERS FORAM DESBANIDOS ⚖️");
- }
- }
- var mutedPlayers = []; // Array where will be added muted players
- var init = "init"; // Smth to initialize smth
- init.id = 0; // Faster than getting host's id with the method
- init.name = "init";
- var commands = {
- // Command that need to know if a player is admin.
- "!clearban": clearFun,
- // Command that need to know who is the player and what's the message.
- "!mute" : pushMuteFun,
- "!unmute": unmuteFun
- }
- room.onTeamVictory = function(scores){
- room.sendChat("🔴 " + scores.red + "x" + scores.blue + " 🔵");
- room.sendChat("🔴 " + scores.red + "x" + scores.blue + " 🔵");
- }
- clear();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement