-
Notifications
You must be signed in to change notification settings - Fork 11
/
Clearban.js
49 lines (44 loc) · 1.32 KB
/
Clearban.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var banList = [];
var names = [];
var ids = [];
var room = HBInit({roomName:"Clear Ban",noPlayer:true,public:true,maxPlayers:12});
function GetNameById(id){
if(!isNaN(id)){
return names[id-1];
}
}
room.onPlayerJoin = function(player){
names.push(player.name);
ids.push(player.id);
}
room.onPlayerKicked = function(kickedPlayer,reason,ban,byPlayer){
if(ban == 0){
console.log(kickedPlayer.name + " [" + kickedPlayer.id + "] was kicked (" + reason + ")");
return false;
}
else if(ban == 1){
console.log(kickedPlayer.name + " [" + kickedPlayer.id + "] was banned (" + reason + ")");
banList.push(kickedPlayer.name);
}
}
room.onPlayerChat = function(player,msg){
if(player.admin==true){
if(msg.split(" ")[0] == "!banınıkaldır"){
var id = msg.split(" ")[1];
room.clearBan(parseInt(id));
var name = GetNameById(id);
room.sendAnnouncement(id + " numaralı oyuncunun (" + name + ") banı kaldırıldı!",player.id,0x00FF00,"normal",1);
banList.splice(banList.indexOf(name),1);
return false;
}
else if(msg == "!banlılar"){
if(banList.length == 0){
room.sendAnnouncement("Banlı oyuncu yok!",player.id,0xFFFF00,"normal",1);
}
else{
room.sendAnnouncement("Ban listesi: " + banList.toString(),player.id,0xFFFFFF,"normal",1);
}
return false;
}
}
}