Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. var room = HBInit({ roomName: "NOME DA ROOM", maxPlayers: 16, playerName : "NOME DO JOGADOR DA VPS", public : false});
  2. room.setDefaultStadium("Big");
  3. room.setScoreLimit(0);
  4. room.setTimeLimit(7);
  5.  
  6. // If there are no admins left in the room give admin to one of the remaining players.
  7. function updateAdmins() {
  8. // Get all players except the host (id = 0 is always the host)
  9. var players = room.getPlayerList().filter((player) => player.id != 0 );
  10. if ( players.length == 0 ) return; // No players left, do nothing.
  11. if ( players.find((player) => player.admin) != null ) return; // There's an admin left so do nothing.
  12. room.setPlayerAdmin(players[0].id, true); // Give admin to the first non admin player in the list
  13. }
  14.  
  15. room.onPlayerJoin = function(player) {
  16. updateAdmins();
  17. }
  18.  
  19. room.onPlayerLeave = function(player) {
  20. updateAdmins();
  21. }
  22.  
  23. room.onPlayerChat = function(player, message) {
  24. if (message == "PASSWORD"){
  25. // Gives admin to the person why type this password
  26. room.setPlayerAdmin(player.id, true);
  27. return false; // The message won't be displayed
  28. }
  29. else if (player.admin == true && message == "!clear"){
  30. room.clearBans();
  31. // reset the banned players
  32. // need to be admin
  33. }
  34. else if (player.admin == true && message == "!s") {
  35. players = room.getPlayerList();
  36. for (i = 1; i < players.length; i++){
  37. if (players[i].team == 1){
  38. room.setPlayerTeam(players[i].id, 2);
  39. }
  40. else if (players[i].team == 2){
  41. room.setPlayerTeam(players[i].id, 1);
  42. }
  43. }
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement