-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSlowMode.js
More file actions
32 lines (27 loc) · 958 Bytes
/
SlowMode.js
File metadata and controls
32 lines (27 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var playerList = {};
var removal = 3000; //In milliseconds
var room = HBInit({roomName:"SlowMode",noPlayer:true,public:true,maxPlayers:12});
room.onPlayerChat = function(player,message){
var administrators = room.getPlayerList(p => p.admin == true);
if(playerList[player.name].slowMode == false){
playerList[player.name].slowMode = true;
var name = player.name;
setTimeout(function(){
if(playerList[player.name].slowMode == true){
playerList[name].slowMode = false;
}
},removal);
}
else{
room.sendAnnouncement(`Slow mode is active. Only the administration can see your messages. (${message})`,player.id,0xFFFF00,"bold",2);
administrators.forEach(p => {
room.sendAnnouncement(`${player.name}: ${message}`,p.id,0xFFFF00,"bold",1);
});
return false;
}
}
room.onPlayerJoin = function(player){
if(playerList[player.name] == undefined){
playerList[player.name] = {name: player.name, slowMode: false};
}
}