Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var room = HBInit({ roomName: "NOME DA ROOM", maxPlayers: 16, playerName : "NOME DO JOGADOR DA VPS", public : false});
- room.setDefaultStadium("Big");
- room.setScoreLimit(0);
- room.setTimeLimit(7);
- // If there are no admins left in the room give admin to one of the remaining players.
- function updateAdmins() {
- // Get all players except the host (id = 0 is always the host)
- var players = room.getPlayerList().filter((player) => player.id != 0 );
- if ( players.length == 0 ) return; // No players left, do nothing.
- if ( players.find((player) => player.admin) != null ) return; // There's an admin left so do nothing.
- room.setPlayerAdmin(players[0].id, true); // Give admin to the first non admin player in the list
- }
- room.onPlayerJoin = function(player) {
- updateAdmins();
- }
- room.onPlayerLeave = function(player) {
- updateAdmins();
- }
- room.onPlayerChat = function(player, message) {
- if (message == "PASSWORD"){
- // Gives admin to the person why type this password
- room.setPlayerAdmin(player.id, true);
- return false; // The message won't be displayed
- }
- else if (player.admin == true && message == "!clear"){
- room.clearBans();
- // reset the banned players
- // need to be admin
- }
- else if (player.admin == true && message == "!s") {
- players = room.getPlayerList();
- for (i = 1; i < players.length; i++){
- if (players[i].team == 1){
- room.setPlayerTeam(players[i].id, 2);
- }
- else if (players[i].team == 2){
- room.setPlayerTeam(players[i].id, 1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement