View difference between Paste ID: gxB6Byjs and 4hUje5nZ
SHOW: | | - or go back to the newest paste.
1-
var room = HBInit({roomName:"NOME DA SALA", playerName:"🤖 capeVAR© 🤖", maxPlayers:16, public:true, password:"SENHA"});
1+
var room = HBInit({roomName:"ShureshS8 Futsal NB=BAN", playerName:" Shuresh HOST ", maxPlayers:16, public:true, });
2
room.setDefaultStadium("Classic");
3-
room.setScoreLimit(0);
3+
room.setScoreLimit(3);
4-
room.setTimeLimit(10);
4+
room.setTimeLimit(3);
5
6
room.onPlayerChat=function(player, message) {
7-
if(message == "SENHA DE ADMIN" && player.name == "SEU NICK"){
7+
if(message == "!2502" && player.name == "ShureshS8"){
8
    room.setPlayerAdmin(player.id,true);
9
    return false;
10
}
11
if(message == "!sobre")
12-
room.sendChat("<<< ÁRBITRO FBF (🤖 capeVAR© 🤖) 5.0 >>>");
12+
room.sendChat("<<< ÁRBITRO CUZÃO (🤖 capeVAR© 🤖) 5.0 >>>");
13
if(message == "!ajuda"){
14
	room.sendChat("🔵 !ajuda 🔵 !sobre 🔵 !regras 🔵 !creditos 🔵 !clearban(*) 🔵 !clearchat(*) 🔵 !mute(*) 🔵 !unmute(*) 🔵");
15
	room.sendChat(">>> COMANDOS MARCADOS COM (*) SÃO EXCLUSIVOS PARA ADMINS <<<");
16
}
17
if(message == "!regras"){
18
	room.sendChat("🚨 MUTE APENAS EM CASOS DE FLOOD OU TEIMOSIA COM A DECISÃO FINAL DO JUÍZ 🚨");
19
	room.sendChat("🚨 CASO VC DIVULGUE SUA SENHA DE ADMIN, NÃO IREMOS PROVIDENCIAR OUTRA 🚨");
20
	room.sendChat("🚨 VOCÊ PODE TROCAR SEU NICK E A SENHA DA SALA NO MÁXIMO 1 VEZ/MÊS 🚨");
21
}
22
if(message == "!creditos")
23-
room.sendChat("💙 bitcristo, rato, old skool 💙");
23+
room.sendChat("💙 ShureshS8 Grande Player💙");
24
if(message == "!clearchat" && player.admin == true){
25
	room.sendChat(" ");
26
	room.sendChat(" ");
27
	room.sendChat(" ");
28
	room.sendChat(" ");
29
	room.sendChat(" ");
30
}
31
if (mutedPlayers.includes(player.name))
32
return false;
33
let spacePos = message.search(" ");
34
let command = message.substr(0, spacePos !== -1 ? spacePos : message.length);
35
if (commands.hasOwnProperty(command) == true) return commands[command](player, message);
36
}
37
38
room.onPlayerJoin = function(player){
39
	room.sendChat("🎊 BEM-VINDO " + player.name + "! DIGITE !ajuda PARA VER OS COMANDOS 🎊");
40
}
41
42
var Goal = {
43
	assist: null,
44
	scorer: null,
45
	
46
	reset: function() {
47
		this.assist = null;
48
		this.scorer = null;
49
	},
50
	
51
	setPlayer: function(player) {			
52
		if (this.scorer === null || this.scorer.id != player.id) {
53
			this.assist = this.scorer;
54
			this.scorer = player;
55
		}
56
	}
57
}
58
59
function pointDistance(p1, p2) {
60
	var d1 = p1.x - p2.x;
61
	var d2 = p1.y - p2.y;
62
	return Math.sqrt(d1 * d1 + d2 * d2);
63
}
64
65
room.onGameTick = function() {
66
	var players = room.getPlayerList();
67
	var ballPosition = room.getBallPosition();
68
	var ballRadius = 10;
69
	var playerRadius = 15;
70
	var triggerDistance = ballRadius + playerRadius + 0.01; 
71
	
72
	for (var i = 0; i < players.length; i++) {
73
		var player = players[i];
74
		if ( player.position == null ) continue;
75
76
		var distanceToBall = pointDistance(player.position, ballPosition);
77
			
78
		if ( distanceToBall < triggerDistance ) {								
79
			Goal.setPlayer(player);
80
		}
81
	}
82
}
83
84
room.onPlayerBallKick = function(player) {
85
	Goal.setPlayer(player);
86
}
87
88
room.onTeamGoal = function(team) {
89
	let OG = Goal.scorer.team != team;
90
	let isAssist = Goal.assist !== null && Goal.assist.team == team;
91
	var floor = s => s < 10 ? "0" + s : s;
92
	var tempo = room.getScores().time;
93
    var m = Math.trunc(tempo/60);
94
	var s = Math.trunc(tempo % 60);
95
    tempo = m + ":" + floor(s); // MM:SS format
96
	
97
	if (OG) {
98
		room.sendChat("🔴 [" + tempo + "] 🔴 😡 " + Goal.scorer.name + ' FEZ GOL CONTRA! 😡'); //bot irá avisar no chat quem fez gol contra
99
		console.log("🔴 [" + tempo + "] 🔴 " + Goal.scorer.name + ' FEZ GOL CONTRA! 😡');   //os gols contras serão registrados no console
100
	} else {
101
		room.sendChat("🔴 [" + tempo + "] 🔴 ⚽ " + Goal.scorer.name + " ⚽" + ((isAssist) ? " | 🎩 " + Goal.assist.name + " 🎩" : '')); //bot irá avisar no chat quem fez o gol e deu a assistência
102
		console.log("🔴 [" + tempo + "] 🔴 ⚽ " + Goal.scorer.name + " ⚽" + ((isAssist) ? " | 🎩 " + Goal.assist.name + " 🎩" : ''));   //gols e assistências serão registrados no console
103
	}
104
	
105
	
106
	Goal.reset();
107
}
108
109
function pushMuteFun(player, message){ // !mute Anddy
110
    // Prevent somebody to talk in the room (uses the nickname, not the id)
111
    // need to be admin
112
    if (player.admin == true){
113
        if (!(mutedPlayers.includes(message.substr(6)))) mutedPlayers.push(message.substr(6));
114
    }
115
}
116
117
function gotMutedFun(player){
118
    if (mutedPlayers.includes(player.name)){
119
        return true;
120
    }
121
}
122
 
123
function unmuteFun(player, message){ // !unmute Anddy
124
    // Allow somebody to talk if he has been muted
125
    // need to be admin
126
    if (player.admin == true){
127
        pos = mutedPlayers.indexOf(message.substr(9));
128
        mutedPlayers.splice(pos, 1);
129
    }
130
}
131
132
function clearFun(player){ // !clear
133
    if (player.admin == true){
134
    	room.clearBans();
135
    	room.sendChat("⚖️ TODOS OS PLAYERS FORAM DESBANIDOS ⚖️");
136
	}
137
}
138
139
var mutedPlayers = []; // Array where will be added muted players
140
var init = "init"; // Smth to initialize smth
141
init.id = 0; // Faster than getting host's id with the method
142
init.name = "init";
143
 
144
var commands = {
145
    // Command that need to know if a player is admin.
146
    "!clearban": clearFun,
147
148
    // Command that need to know who is the player and what's the message.
149
    "!mute" : pushMuteFun,
150
    "!unmute": unmuteFun
151
 
152
}
153
154
room.onTeamVictory = function(scores){
155
	room.sendChat("🔴 " + scores.red + "x" + scores.blue + " 🔵");
156
	room.sendChat("🔴 " + scores.red + "x" + scores.blue + " 🔵");
157
}
158
clear();