Advertisement
Guest User

Untitled

a guest
May 30th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ({
  2. /** Server Events **/
  3. serverStartUp : function() {
  4.     this.afterNewMessage("Script Check: OK");
  5.     return; }
  6. ,
  7. afterNewMessage : function (message) {
  8.     if (message == "Script Check: OK") {
  9.         sys.sendAll("~~Server~~: Scripts were updated.");
  10.         if (typeof floodcount == "undefined") {
  11.             floodcount = new Array(); }
  12.         if (typeof mailWait == "undefined") {
  13.             mailWait = new Array(); }
  14.         if (typeof inBattle == "undefined") {
  15.             inBattle = new Array();}
  16.         if (typeof hyperMode == "undefined") {
  17.             hyperMode = new Array();}
  18.         if (typeof numUsers == "undefined") {
  19.             numUsers = 0}
  20.         if (typeof ver == 'undefined') {
  21.             ver = 1;
  22.             print('Thank you for loading Astruvis\' scripts! If this is the first time loading this script please type /debug as an admin while there are no pending connections, or restart the server.'); }
  23.             if  (typeof password == 'undefined') {
  24.                 password = new Array(); }
  25.         if (typeof serverpass == 'undefined') {
  26.             serverpass = ''; }
  27.         if (typeof rank == "undefined") {
  28.             rank = new Array();
  29.             rank[0] = 'a user';
  30.             rank[1] = 'a moderator';
  31.             rank[2] = 'an admin';
  32.             rank[3] = 'an owner';
  33.             rank[4] = 'a moderator(invisible)';
  34.             rank[5] = 'an admin(invisible)';
  35.             rank[6] = 'an owner(invisible)'; }
  36.         if (typeof(variablesset) == "undefined"){
  37.             variablesset = 1;
  38.             tourmode = 0;
  39.             border = "»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»:";}
  40.         }
  41.     if (message.toLowerCase().indexOf(' changed their team, and their name to ') != -1) {
  42.         var eventsrc = new Array();
  43.         eventsrc = message.split(' changed their team, and their name to ');
  44.         this.beforeTeamChange(sys.id(eventsrc[0]),eventsrc[1]); }
  45.     return; }
  46. ,
  47. /** Log in and Out **/
  48. afterLogIn : function(src) {
  49.     numUsers += 1;
  50.     /** Impersonation Check **/
  51.     if (sys.name(src).toLowerCase().indexOf('server') != -1 || sys.name(src).toLowerCase().indexOf('admin') != -1 || sys.name(src)[0] == '#' || sys.name(src)[0] == '@' || sys.name(src)[0] == '&' || sys.name(src)[0] == '.' || sys.name(src)[0] == '-' && sys.auth(src) == 0) {
  52.         sys.sendMessage(src,'Invalid name. Change your name.');
  53.         sys.kick(tar);
  54.         return; }
  55.     password[src] = '';
  56.     hyperMode[src] = false;
  57.     inBattle[src] = false;
  58.     mailWait[src] = false;
  59.     floodcount[src] = 0;
  60.     if (sys.auth(src) < 1 && sys.getVal('banned' + sys.ip(src)) == 1) {
  61.         sys.sendAll("~~Server~~: Banned user  " + sys.name(src) + ' (' + sys.ip(src) + ') was kicked!');
  62.         sys.kick(src);
  63.         return; }
  64.     if (sys.auth(src) < 1 && (typeof restrict != "undefined")) {
  65.         sys.sendMessage(src,"~~Server~~: The server is in restricted mode and can only be accesed by staff.");
  66.         sys.kick(src);
  67.         return; }
  68.     var str = '~~Server~~: Server status';
  69.     var muteis = sys.getVal('muted' + sys.ip(src));
  70.     var protis = sys.getVal('protected' + sys.ip(src));
  71.     if (typeof(stop) != "undefined")
  72.         { str += ', battles stopped'; }
  73.     if (typeof(hush) != "undefined")
  74.         { str += ', chat hushed'; }
  75.     if (serverpass != "")
  76.         { str += ', password protected'; }
  77.     if (typeof restrict != "undefined")
  78.         { str += ', restricted'; }
  79.     if (str == '~~Server~~: Server status') {
  80.     str = '~~Server~~: Server status, normal' }
  81.     str = str + '.';
  82.     sys.sendMessage(src,str);
  83.     str = '~~Server~~: Your status';
  84.     if (muteis == 1)
  85.         { str += ', muted'; }
  86.     if (protis == 1)
  87.         { str += ', protected'; }
  88.     if (muteis != 1 && protis != 1)
  89.         { str += ', normal'; }
  90.     str += '.';
  91.     sys.sendMessage(src,str +' You are ' + rank[sys.auth(src)] +'.');
  92.     sys.sendMessage(src,'~~Server~~: Type /cmdlist for the commands. Type /rules for the rules');
  93.     if (serverpass != '') {
  94.         if (sys.auth(src) == 0)  {
  95.             sys.sendMessage(src,'~~Server~~: The server is password protected, please enter the password using /pass password.'); }
  96.         else {
  97.             sys.sendAll('~~Server~~: '+sys.name(src)+' has joined!'); }
  98.         }
  99.     if (sys.auth(src) >= 1) {
  100.         var cnt = numUsers;
  101.         var user = 0;
  102.         while(user < cnt && user < 300)
  103.             { if (sys.loggedIn(user) == true) {
  104.                 if (sys.auth(user) >= 1) {
  105.                     sys.sendMessage(src,'~~Server~~: Online staff member ' + sys.name(user) + ' is ' +rank[sys.auth(user)]); }
  106.                 }
  107.             else {
  108.                 cnt += 1;}
  109.             user += 1; }
  110.         }
  111.     sys.sendMessage(src,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
  112.     /** Lutra's Tourn Script **/
  113.     if (tourmode == 1){
  114.         receiver = src;
  115.         this.tourdisplay();
  116.         sys.sendMessage(src,"~~Server~~:  " + tourcount + " space(s) are left!");
  117.         return;}
  118.     if (tourmode == 2){
  119.         sys.sendMessage(src, "~~Server~~: A tournament is currently running.");
  120.     return; }
  121.     }
  122. ,
  123. afterLogOut : function (src) {
  124.     numUsers -= 1;
  125.     return;
  126.     }
  127. ,
  128. beforeTeamChange : function(src,old) {
  129.     /** Impersonation Check **/
  130.     if (sys.name(src).toLowerCase().indexOf('server') != -1 || sys.name(src).toLowerCase().indexOf('admin') != -1 || sys.name(src)[0] == '#' || sys.name(src)[0] == '@' || sys.name(src)[0] == '&' || sys.name(src)[0] == '.' || sys.name(src)[0] == '-' && sys.auth(src) == 0) {
  131.         sys.sendMessage(src,'Invalid name. Change your name.');
  132.         sys.kick(tar);
  133.         return; }
  134.     }
  135. ,
  136. /** Moderation Menu **/
  137. unmute : function(tar){
  138.     sys.removeVal('muted' + sys.ip(tar));
  139.     return; }
  140. ,
  141. beforePlayerKick : function(src,tar) {
  142.     sys.stopEvent();
  143.     if (sys.getVal('protected' + sys.ip(tar)) == 1)
  144.         {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
  145.         return; }
  146.     if (sys.auth(tar) > 0)
  147.         {sys.sendMessage(src,"~~Server~~: Moderators and above can not be kicked.");
  148.         return; }
  149.     if (sys.auth(src) <= 3) {
  150.     sys.sendAll("~~Server~~: " + sys.name(tar) + " was kicked by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously kicked!"); }
  151.     sys.kick(tar);
  152.     return; }
  153. ,
  154. beforePlayerBan : function(src,tar) {
  155.     sys.stopEvent();
  156.     if (sys.auth(src) == 4) {
  157.     return; }
  158.     if (sys.getVal('protected' + sys.ip(tar)) == 1)
  159.         {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
  160.         return; }
  161.     if (sys.auth(tar) > 0)
  162.         {sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
  163.         return; }
  164.     if (sys.auth(src) <= 3) {
  165.         sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was banned for 1 hour by " + sys.name(src) + "!"); }
  166.         else
  167.         { sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was mysteriously banned for 1 hour!"); }
  168.     var rnd = sys.rand(1,99999999);
  169.     sys.saveVal('banned' + sys.ip(tar),1);
  170.     sys.saveVal('banchk' + sys.ip(tar),rnd);
  171.     sys.callLater("if (sys.getVal('banchk" + sys.ip(tar) +"') == "+ rnd+ " ) { sys.removeVal('banned" + sys.ip(tar) +"'); (sys.removeVal('banchk" + sys.ip(tar) +"'); sys.sendAll('~~Server~~: " + sys.name(tar) + " is no longer banned.'); }",3600);
  172.     var cnt = numUsers;
  173.     var user = 0;
  174.     while(user < cnt)
  175.         {if (sys.loggedIn(user) == true) {
  176.             if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
  177.                  { sys.kick(user);}
  178.             } else {
  179.                 cnt += 1;}
  180.             user += 1;
  181.             }
  182.     sys.kick(tar);
  183.     return; }
  184. ,
  185. /** Battles **/
  186. beforeBattleEnded : function(win, lose, result) {
  187.     inBattle[lose] = false;
  188.     inBattle[win] = false;
  189.     /**if (result == "win" || result == "forfeit") {
  190.     sys.sendAll(sys.name(win) + " won against "+ sys.name(lose)+'.'); } **/
  191.     if (mailWait[win] == true) {
  192.         sys.sendMessage(win,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(win).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
  193.         mailWait[win] = false; }
  194.     if (mailWait[lose] == true) {
  195.         sys.sendMessage(lose,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(lose).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
  196.         mailWait[lose] = false; }
  197.     if (tourmode == 2 &&  result != "tie"){
  198.         this.tourbattleend(sys.name(win), sys.name(lose));}
  199.     return; }
  200. ,
  201. checkhazards : function(id) {  
  202.     var stealthrock = sys.moveNum('Stealth Rock');
  203.     var toxicspikes = sys.moveNum('Toxic Spikes');
  204.     var spikes = sys.moveNum('Spikes');
  205.     if (sys.hasTeamMove(id,stealthrock) == true || sys.hasTeamMove(id,spikes) == true || sys.hasTeamMove(id,toxicspikes) == true) {
  206.         return(true); } else { return(false); }
  207.     }
  208. ,
  209. beforeBattleMatchup : function(src, tar, clauses) {
  210.     if ( typeof(stop) != "undefined") {
  211.         sys.stopEvent();
  212.         sys.sendMessage(src, "~~Server~~: The battles are stoped.");
  213.         return; }
  214.     var xx = 0;
  215.     if (sys.tier(src) == 'NoHazards' && this.checkhazards(src) == true) {
  216.         sys.sendMessage(src,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
  217.         sys.kick(src);
  218.         sys.sendAll('~~Server~~: '+sys.name(src)+' was kicked by ~~Server~~');
  219.         xx = 1; }
  220.     if (sys.tier(tar) == 'NoHazards' && this.checkhazards(tar) == true) {
  221.         sys.sendMessage(tar,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
  222.         sys.kick(tar);
  223.         sys.sendAll('~~Server~~: '+sys.name(tar)+' was kicked by ~~Server~~');
  224.         xx = 1; }
  225.     if (xx) {
  226.     return; }
  227.     inBattle[src] = true;
  228.     inBattle[tar] = true;
  229.     return; }
  230. ,
  231. beforeBattleStarted : function(src, tar, clauses, rated, mode) {
  232.     inBattle[src] = true;
  233.     inBattle[tar] = true;
  234.     return; }
  235. ,
  236. afterBattleStarted: function(src, trgt){
  237.           if (tourmode == 2){
  238.                     var srctier = sys.tier(src).toLowerCase();
  239.                     var trgttier = sys.tier(trgt).toLowerCase();
  240.                     var srcname = sys.name(src);
  241.                     var trgtname = sys.name(trgt);
  242.                     var tourmembershigh = tourmembers.indexOf(srcname);
  243.                     var tourmemberslow = tourmembers.indexOf(trgtname);
  244.                     if (srctier == trgttier && srctier == tourtier && tourmembershigh in tourmembers && tourmemberslow in tourmembers){
  245.                               if (tourmemberslow > tourmembershigh){
  246.                                         var temphigh = tourmemberslow;
  247.                                         tourmemberslow = tourmembershigh;
  248.                                         tourmembershigh = temphigh;
  249.                               }
  250.                               if (tourmemberslow % 2 == 0 && tourmembershigh == tourmemberslow + 1){
  251.                                         tourbattlers.push(srcname);
  252.                                         tourbattlers.push(trgtname);
  253.                               }
  254.                     }
  255.           }
  256. }
  257. ,
  258. beforeChallengeIssued : function(src, tar, clauses) {
  259.     if ( typeof(stop) != "undefined") {
  260.         sys.stopEvent();
  261.         sys.sendMessage(src, "~~Server~~: The battles are stoped.");
  262.         return; }
  263.     if (sys.tier(src) == 'NoHazards' && this.checkhazards(src) == true) {
  264.         sys.sendMessage(src,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
  265.         sys.kick(src);
  266.         sys.sendAll('~~Server~~: '+sys.name(src)+' was kicked by ~~Server~~.');
  267.         xx = 1; }
  268.     if (sys.tier(tar) == 'NoHazards' && this.checkhazards(tar) == true) {
  269.         sys.sendMessage(tar,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
  270.         sys.kick(tar);
  271.         sys.sendAll('~~Server~~: '+sys.name(tar)+' was kicked by ~~Server~~.');
  272.         xx = 1; }
  273.         }
  274. ,
  275. /** Other **/
  276. beforePlayerAway : function(src, aa) {
  277.     if (mailWait[src] == 1 && aa == 0) {
  278.         sys.sendMessage(src,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
  279.         mailWait[src] = false; }
  280.     return; }
  281. ,
  282. beforeChatMessage: function(src, message) {
  283.     if (message[0] != '/' && message[0] != '!') {
  284.         /** Hush check **/
  285.         if (sys.auth(src) < 1 && typeof(hush) != "undefined") {
  286.             sys.stopEvent();
  287.             sys.sendMessage(src, "~~Server~~: The chat is hushed.");
  288.             print("Hushed message from " + sys.name(src) + ": " + message);
  289.             return; }
  290.         /** Mute check **/
  291.         if (sys.auth(src) < 1 && sys.getVal('muted' + sys.ip(src)) == 1) {
  292.             sys.stopEvent();
  293.             sys.sendMessage(src, "~~Server~~: You are muted.");
  294.             print("Muted message from " + sys.name(src) + ": " + message);
  295.             return; }
  296.         sys.stopEvent(); /** Stops event to prevent users without the password from viewing **/
  297.         /** Password Check **/
  298.         if (serverpass != password[src] && serverpass != '' && sys.auth(src) == 0) {
  299.             sys.sendMessage(src,'~~Server~~: Please enter the password using /pass password.');
  300.             return; }
  301.         /** Swear Check **/
  302. /**     if (message.toLowerCase().indexOf('fuck') != -1 || message.toLowerCase().indexOf('bitch') != -1 || message.toLowerCase().indexOf('faggot') != -1 || message.toLowerCase().indexOf('penis') != -1 || message.toLowerCase().indexOf('vagina') != -1 || message.toLowerCase().indexOf('nigger') != -1 || message.toLowerCase().indexOf('rape') != -1 || message.toLowerCase().indexOf('nazi') != -1) {
  303. **/         var safemsg = message.replace(/fuck/gi,'****').replace(/nazi/gi,'****').replace(/penis/gi,'****').replace(/bitch/gi,'****').replace(/faggot/gi,'****').replace(/vagina/gi,'****').replace(/nigger/gi,'****').replace(/rape/gi,'****');
  304. /**         sys.stopEvent();
  305.             sys.sendMessage(src, "~~Server~~: Your message was blocked.");
  306.             return; }
  307. **/     if (message != safemsg) {
  308.         print("Filtered message from " + sys.name(src) + ": " + message);
  309.         message = safemsg; }
  310.         /** Flood Check **/
  311.         floodcount[src] += 1;
  312.         sys.callLater('if (floodcount['+src+'] > 0) { floodcount['+src+'] -= 1;}',30);
  313.         if (floodcount[src] > 10 && sys.auth(src) < 1) {
  314.             sys.stopEvent();
  315.             floodcount[src] = 0;
  316.             sys.sendAll("~~Server~~: " + sys.name(src) + " was muted for 5 minutes by ~~Server~~!");
  317.             var rnd = sys.rand(1,9999);
  318.             sys.saveVal('mutechk' + sys.ip(src),rnd);
  319.             sys.callLater("if (sys.getVal('mutechk" + sys.ip(src) +"') == "+ rnd+ " ) { sys.removeVal('muted" + sys.ip(src) +"'); sys.removeVal('mutechk" + sys.ip(src) +"'); sys.sendAll('~~Server~~: " + sys.name(src) + " is no longer muted.'); }",300);
  320.             sys.saveVal('muted' + sys.ip(src),1);
  321.             return; }
  322.         /** Staff Check **/
  323.         var yy = '';
  324.         if (sys.auth(src) == 1) {
  325.             yy = '+'; }
  326.         if (sys.auth(src) == 2 || sys.auth(src) == 3) {
  327.             yy = '~'; }
  328.         if (hyperMode[src] == true && sys.auth(src) != 0) {
  329.             yy = '*** ' + yy; }
  330.         /** Userloop, send messages to users with the password **/
  331.         var cnt = numUsers;
  332.         var user = 0;
  333.         var xx = yy + sys.name(src) +': ' + message;
  334.         print(xx);
  335.         while(user < cnt) {
  336.             if (sys.loggedIn(user) == true) {
  337.                 if (serverpass == password[user] || serverpass == '' || sys.auth(user) > 0) {
  338.                     sys.sendMessage(user,xx); }
  339.             } else {
  340.                 cnt += 1;}
  341.             user += 1; }
  342.         return; }
  343.     /** Commands **/
  344.     if ((message[0] == '/' || message[0] == '!') && message.length > 1)
  345.          {print("Command -- " + sys.name(src) + ": " + message);
  346.         sys.stopEvent();
  347.         var command;
  348.         var commandData;
  349.         var pos = message.indexOf(' ');
  350.         var mcmd = new Array();
  351.         if (pos != -1) {
  352.             command = message.substring(1, pos).toLowerCase();
  353.             commandData = message.substr(pos+1);
  354.             mcmd = commandData.split(':'); }
  355.          else
  356.             { command = message.substr(1).toLowerCase(); }
  357.         var tar = sys.id(commandData);
  358. /** User Commands **/
  359.     /** Password **/
  360.         if (command == "pass" || command == "password") {
  361.             if (serverpass == '') {
  362.                 sys.sendMessage(src,'~~Server~~: The server is not password protected.');
  363.                 return; }              
  364.             password[src] = commandData;
  365.             if (serverpass != password[src]) {
  366.                 sys.sendMessage(src,'~~Server~~: Bad password, please enter the password using /pass password.');  }
  367.             else {
  368.                 sys.sendAll('~~Server~~: '+sys.name(src)+' has joined!'); }
  369.             return; }
  370.     /** Mail **/
  371.         if (command == "sendmail" || command == "smail" || command == "mail") {
  372.             var mail;
  373.             if (mcmd[1] == undefined) {
  374.             sys.sendMessage(src, "~~MailBox~~: Error: No content! Message was not sent!");
  375.             return; }
  376.             mail = mcmd[1];
  377.             if (mail.indexOf('+') == -1) {
  378.                 sys.saveVal('msgque' + mcmd[0].toLowerCase(),sys.getVal('msgque' + mcmd[0].toLowerCase()) + ' + Message from ' + sys.name(src) + ": " + mail);
  379.                 var rcv = sys.id(mcmd[0]);
  380.                 sys.sendMessage(src, "~~MailBox~~: Message sent to user " + mcmd[0] + "!");
  381.                 if (rcv != undefined) {
  382.                     sys.sendMessage(rcv,"~~MailBox~~: New message, type /readmail to view your inbox.");
  383.                     if (sys.away(rcv) == true || inBattle[rcv] == true) {
  384.                         mailWait[rcv] = true; }
  385.                     }
  386.             } else {
  387.                 sys.sendMessage(src, "~~MailBox~~: Error: The + symbol can not be used in mail! Message was not sent!"); }
  388.             return; }
  389.         if (command == "readmail" || command == "rmail") {
  390.             var msg = new Array();
  391.             msg = sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+');
  392.             var length = (sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+').length - 1);
  393.             sys.sendMessage(src,'~~MailBox~~: Here are your messages:');
  394.             for (i = 1; i <= length; i++)
  395.             {sys.sendMessage(src,msg[i]); }
  396.             sys.sendMessage(src,'~~MailBox~~: End of messages.');  
  397.  
  398.             sys.sendMessage(src,'~~MailBox~~: Use /deletemail to clear your inbox. Use "/sendmail USERNAME:MESSAGE" to send a message to another user.');
  399.             return; }
  400.         if (command == "deletemail" || command == "dmail") {
  401.             sys.removeVal('msgque' + sys.name(src).toLowerCase());
  402.             sys.sendMessage(src, "~~Mailbox~~: Mail deleted!");
  403.             return; }
  404.     /** Lists **/
  405.         if (command == "list" || command == "stafflist" || command == "modlist" || command == "l") {
  406.             if (sys.auth(src) >= 1) {
  407.                 var cnt = numUsers;
  408.                 var user = 0;
  409.                 while(user < cnt && user < 300)
  410.                     { if (sys.loggedIn(user) == true) {
  411.                         if (sys.auth(user) >= 1) {
  412.                             sys.sendMessage(src,'~~Server~~: Online staff member ' + sys.name(user) + ' is ' +rank[sys.auth(user)]); }
  413.                     } else {
  414.                         cnt += 1;}
  415.                     user += 1; }
  416.                 }
  417.             else
  418.                 {var cnt = numUsers;
  419.                 var user = 0;
  420.                 while(user < cnt && user < 300)
  421.                     { if (sys.loggedIn(user) == true) {
  422.                         if (sys.auth(user) >= 1 && sys.auth(user) < 4) {
  423.                             sys.sendMessage(src,'~~Server~~: Online staff member ' + sys.name(user) + ' is ' +rank[sys.auth(user)]); }
  424.                     } else {
  425.                         cnt += 1;}
  426.                     user += 1; }
  427.                 }
  428.         return; }
  429.         if (command == "commands" || command == "command" || command == "cmdlist") {
  430.             sys.sendMessage(src,"~~Server~~: Here are the commands:");
  431.             sys.sendMessage(src,"*** User commands ***");
  432.             sys.sendMessage(src,"~~Server~~: The command '/cmdlist': Lists commands.");
  433.             sys.sendMessage(src,"~~Server~~: The command '/sendmail user:message': Sends mail to another player.");
  434.             sys.sendMessage(src,"~~Server~~: The command '/readmail': Shows your mail.");
  435.             sys.sendMessage(src,"~~Server~~: The command '/deletemail': Deletes all your mail.");
  436.             sys.sendMessage(src,"~~Server~~: The command '/list': Lists online staff members.");
  437.             sys.sendMessage(src,"~~Server~~: The command '/pass password': Allows you to join a password protected server if you know the password.");
  438.             sys.sendMessage(src,"~~Server~~: The command '/join': Allows you to join a tournament.");
  439.             sys.sendMessage(src,"~~Server~~: The command '/viewround': Allows you to view a tournament round pairings.");      
  440.             if (sys.auth(src) >= 1) {
  441.             sys.sendMessage(src,"*** Moderator Commands ***"); 
  442.             sys.sendMessage(src,"~~Server~~: The command '/info': Gives various information about a user.");
  443.             sys.sendMessage(src,"~~Server~~: The command '/writenote user:note': Writes a note to a users account.");
  444.             sys.sendMessage(src,"~~Server~~: The command '/viewnotes user': Reads notes from a users account.");
  445.             sys.sendMessage(src,"~~Server~~: The command '/removenotes user': Removes notes from a users account.");
  446.             sys.sendMessage(src,"~~Server~~: The command '/mute user': Mutes a user for 5 minutes.");
  447.             sys.sendMessage(src,"~~Server~~: The command '/fullmute user': Mutes a user for 1 hour.");
  448.             sys.sendMessage(src,"~~Server~~: The command '/permamute user': Mutes a user untill they are unmuted.");
  449.             sys.sendMessage(src,"~~Server~~: The command '/unmute user': Allows a user to talk.");
  450.             sys.sendMessage(src,"~~Server~~: The command '/ban user': Bans a user for 1 hour.");
  451.             sys.sendMessage(src,"~~Server~~: The command '/fullban user': Bans a user for 8 hours.");
  452.             sys.sendMessage(src,"~~Server~~: The command '/unban IP': Removes a ban(IP only).");
  453.             sys.sendMessage(src,"~~Server~~: The command '/kick user': Kicks a user from the chat");
  454.             sys.sendMessage(src,"~~Server~~: The command '/hush': Stops all users from talking.");
  455.             sys.sendMessage(src,"~~Server~~: The command '/unhush': Removes hush.");
  456.             sys.sendMessage(src,"~~Server~~: The command '/stop': Prevents all user from entering battles.");
  457.             sys.sendMessage(src,"~~Server~~: The command '/unstop': Removes stop.");
  458.             sys.sendMessage(src,"~~Server~~: The command '/invisible': Causes rank not to show and commands to become mysterious.");
  459.             sys.sendMessage(src,"~~Server~~: The command '/visible': Removes invisible.");
  460.             sys.sendMessage(src,"~~Server~~: The command '/hyper': Causes your messages to become alerts.");
  461.             sys.sendMessage(src,"~~Server~~: The command '/dehyper': Undoes hyper.");
  462.             sys.sendMessage(src,"~~Server~~: The command '/getpass': Shows you the server password.");
  463.             sys.sendMessage(src,"~~Server~~: The command '/newtour tier:players': Creates a tournament of a tier with a number of players.");
  464.             sys.sendMessage(src,"~~Server~~: The command '/endtour': Allows you to end a tournament.");}
  465.             if (sys.auth(src) >= 2 && sys.auth(src) != 4) {
  466.             sys.sendMessage(src,"*** Admin Commands ***");
  467.             sys.sendMessage(src,"~~Server~~: The command '/setpass': Sets a password on the server.");
  468.             sys.sendMessage(src,"~~Server~~: The command '/removepass': Removes the password.");
  469.             sys.sendMessage(src,"~~Server~~: The command '/restrict': Removes non-staff from the server and prevents them from joining.");
  470.             sys.sendMessage(src,"~~Server~~: The command '/derestrict': Removes restriction from the server.");
  471.             sys.sendMessage(src,"~~Server~~: The command '/permaban user': Bans a user forever, or untill unbanned.");
  472.             sys.sendMessage(src,"~~Server~~: The command '/protect user': Protected user can not be kicked, muted, blocked, or banned.");
  473.             sys.sendMessage(src,"~~Server~~: The command '/deprotect user': Removes protection.");
  474.             sys.sendMessage(src,"~~Server~~: The command '/auth user': Changes a user into a moderator.");
  475.             sys.sendMessage(src,"~~Server~~: The command '/deauth user': Changes a moderator into a user.");
  476.             sys.sendMessage(src,"~~Server~~: The command '/s-kick user': Kicks a user without a message.");
  477.             sys.sendMessage(src,"~~Server~~: The command '/s-mute user': Mutes a user without a message.");
  478.             sys.sendMessage(src,"~~Server~~: The command '/s-ban user': Bans a user without a message.");
  479.             sys.sendMessage(src,"~~Server~~: The command '/s-unmute user': Removes mute without a message.");
  480.             sys.sendMessage(src,"~~Server~~: The command '/s-unban user': Removes ban without a message."); }
  481.             sys.sendMessage(src,"*** End of list ***");
  482.             return; }
  483.     /** Tournament **/
  484.     if (command == "join" || command == "j"){
  485.         if (tourmode == 0){
  486.             sys.sendMessage(src, "~~Server~~: Sorry, you are unable to join because a tournament is not currently running.");
  487.             return; }
  488.         if (inBattle[src] == true){
  489.             sys.sendMessage(src, "~~Server~~: Sorry, you are unable to join because you are in a battle.");
  490.             return; }
  491.         var tourmembername = sys.name(src);
  492.         if (tourmembers.indexOf(tourmembername) in tourmembers){
  493.             sys.sendMessage(src, "~~Server~~: Sorry, you are already in the tournament. You are not able to join more than once.");
  494.             return; }
  495.         if (tourmode == 2){
  496.             sys.sendMessage(src, "~~Server~~: Sorry, you are unable to join because the tournament has passed the sign-up phase.");
  497.             return; }  
  498.         var srctier = sys.tier(src);
  499.         if (tourtier != srctier.toLowerCase()){
  500.             sys.sendMessage(src, "~~Server~~: You are currently not battling in the " + tourtier + " tier. Change your tier to " + tourtier + " to be able to join.");
  501.             return; }
  502.         if (tourcount > 0){
  503.             tourcount--;
  504.             tourmembers.push(tourmembername);
  505.             sys.sendAll('~~Server~~: '+tourmembername + " joined the tournament! " + tourcount + " more spot(s) left!");
  506.             if (tourcount == 0){
  507.                 tourmode = 2;
  508.                 roundnumber = 0;
  509.                 this.roundpairing();}
  510.             return;}
  511.         return; }
  512.     if (command == "viewround" || command == "round") {
  513.         if (tourmode == 0){
  514.             sys.sendMessage(src, "~~Server~~: Sorry, you are unable to view the round because a tournament is not currently running.");
  515.             return;}
  516.         if (tourmode == 1){
  517.             sys.sendMessage(src, "~~Server~~: Sorry, you are unable to view the round because the signing up for the tournament is still in progress.");
  518.             return;}
  519.         receiver = src;
  520.         this.rounddisplay();
  521.         return;}
  522. /** Moderator Commands **/
  523.         if (sys.auth(src) < 1)
  524.              {sys.sendMessage(src, "~~Server~~: The command " + command + " can not be used by normal users or does not exist.");
  525.             return; }
  526.     /**info **/
  527.         if (command == "hyper" || command == "hypermode" || command == "alert" || command == "alertmode" || command == "e") {
  528.             if (hyperMode[src] == true) {
  529.                 sys.sendMessage(src,'~~Server~~: You are already in HyperMode.');
  530.                 return; }
  531.             hyperMode[src] = true;
  532.             sys.sendMessage(src,'~~Server~~: You are now in HyperMode.');
  533.             return; }
  534.         if (command == "dehyper" || command == "dehypermode" || command == "dealert" || command == "dealertmode" || command == "-e") {
  535.             hyperMode[src] = false;
  536.             sys.sendMessage(src,'~~Server~~: You are no longer in HyperMode.');
  537.             return; }
  538.         if (command == "info" || command == "whois" || command == "i") {
  539.             if (tar == undefined)
  540.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  541.                 return; }
  542.             var alts = ''
  543.             var cnt = numUsers;
  544.             var user = 0;
  545.             var einfo = '';
  546.             if (sys.getVal('muted'+sys.ip(tar)) != '') {
  547.             einfo = einfo + ' The user is muted.' }
  548.             if (sys.getVal('protected'+sys.ip(tar)) != '') {
  549.             einfo = einfo + ' The user is protected.' }
  550.             if (hyperMode[tar] == true) {
  551.             einfo = einfo + ' The user is in HyperMode.' }
  552.             while(user < cnt)
  553.                 {if (sys.loggedIn(user) == true) {
  554.                     if (sys.ip(tar) == sys.ip(user))
  555.                          { alts = alts +' ('+ sys.name(user) + ')';}
  556.                 } else {
  557.                     cnt += 1; }
  558.                 user += 1;
  559.                 }
  560.             sys.sendMessage(src,'~~Server~~: '+sys.name(tar)+' is ' + rank[sys.auth(tar)] + '. User has these online accounts.' + alts + '. User\'s IP is (' + sys.ip(tar) +').'+einfo+' The user has ' + (sys.getVal('modnotes' + sys.ip(tar).toLowerCase()).split('+').length - 1) + ' notes to the account.');
  561.             var msg = new Array();
  562.             msg = sys.getVal('modnotes' + sys.ip(tar)).split('+');
  563.             var length = (sys.getVal('modnotes' + sys.ip(tar).toLowerCase()).split('+').length - 1);
  564.             sys.sendMessage(src,'~~Server~~: These are the notes on the account:');
  565.             for (i = 1; i <= length; i++)
  566.             {sys.sendMessage(src,msg[i]); }
  567.             sys.sendMessage(src,'~~Server~~: End of notes.');
  568.             return; }
  569.         if (command == "writenote" || command == "wnote") {
  570.             var point = commandData.indexOf(':');
  571.             var note;
  572.             if (point == -1) {
  573.             sys.sendMessage(src, "~~Server~~: Error: No content! Note was not added!");
  574.             return; }
  575.             note = commandData.substr(commandData.indexOf(':')+1);
  576.             if (note.indexOf('+') == -1) {
  577.                 sys.saveVal('modnotes' + sys.ip(sys.id(mcmd[0])),sys.getVal('modnotes' + sys.ip(sys.id(mcmd[0]))) + ' + Note by ' + sys.name(src) + ": " + note);
  578.                 sys.sendMessage(src, "~~Server~~: Note added to user " + mcmd[0] + "!");
  579.                 } else { sys.sendMessage(src, "~~Server~~: Error: The + symbol can not be used in notes! Note was not added!"); }
  580.             return; }
  581.         if (command == "viewnote" || command == "viewnotes" || command == "vnote") {
  582.             if (tar == undefined)
  583.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  584.                 return; }
  585.             var msg = new Array();
  586.             msg = sys.getVal('modnotes' + sys.ip(tar)).split('+');
  587.             var length = (sys.getVal('modnotes' + sys.ip(tar).toLowerCase()).split('+').length - 1);
  588.             sys.sendMessage(src,'~~Server~~: These are the notes on the account:');
  589.             for (i = 1; i <= length; i++)
  590.             {sys.sendMessage(src,msg[i]); }
  591.             sys.sendMessage(src,'~~Server~~: End of notes.');
  592.             return; }
  593.         if (command == "removenotes" || command == "removenote") {
  594.             if (tar == undefined)
  595.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  596.                 return; }
  597.             sys.removeVal('modnotes' + sys.ip(tar));
  598.             sys.sendMessage(src, "~~Server~~: Notes removed!");
  599.             return; }
  600.         if (command == "getpass" || command == "getpassword") {
  601.             sys.sendMessage(src,'~~Server~~: The password is ('+serverpass+').');
  602.             return; }
  603.     /** Mute **/
  604.         if (command == "mute" || command == "tempmute" || command == "mute5m" || command == "mute5" ||  command == "m" || command == "m5" || command == "m5m" || command == "mt") {
  605.             if (tar == undefined)
  606.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  607.                 return; }
  608.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  609.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be muted.");
  610.                 return; }
  611.             if (sys.auth(tar) > 0)
  612.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be muted.");
  613.                 return; }
  614.             if (sys.auth(src) <= 3) {
  615.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " was muted for 5 minutes by " + sys.name(src) + "!");}
  616.             else
  617.                 { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously muted for 5 minutes !"); }
  618.             var rnd = sys.rand(1,9999);
  619.             sys.saveVal('mutechk' + sys.ip(tar),rnd);
  620.             sys.callLater("if (sys.getVal('mutechk" + sys.ip(tar) +"') == "+ rnd+ " ) { sys.removeVal('muted" + sys.ip(tar) +"'); sys.removeVal('mutechk" + sys.ip(tar) +"'); sys.sendAll('~~Server~~: " + sys.name(tar) + " is no longer muted.'); } ",300);
  621.             sys.saveVal('muted' + sys.ip(tar),1);
  622.             return; }
  623.         if (command == "fullmute" || command == "hourmute" || command == "mute1h" || command == "mutehour" || command == "1hmute" || command == "fm" || command == "m1h" || command == "mf") {
  624.             if (tar == undefined)
  625.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  626.                 return; }
  627.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  628.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be muted.");
  629.                 return; }
  630.             if (sys.auth(tar) > 0)
  631.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be muted.");
  632.                 return; }
  633.             if (sys.auth(src) <= 3) {
  634.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " was muted for 1 hour by " + sys.name(src) + "!");}
  635.             else
  636.                 { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously muted for 1 hour!"); }           
  637.             var rnd = sys.rand(1,9999);
  638.             sys.saveVal('mutechk' + sys.ip(tar),rnd);
  639.             sys.callLater("if (sys.getVal('mutechk" + sys.ip(tar) +"') == "+ rnd+ " ) { sys.removeVal('muted" + sys.ip(tar) +"'); (sys.removeVal('mutechk" + sys.ip(tar) +"'); sys.sendAll('~~Server~~: " + sys.name(tar) + " is no longer muted.'); }",3600)
  640.             sys.saveVal('muted' + sys.ip(tar),1);
  641.             return; }
  642.         if (command == "permamute" || command == "muteforever" || command == "mp" || command == "mi") {
  643.             if (tar == undefined)
  644.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  645.                 return; }
  646.             if (sys.auth(tar) > 0)
  647.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be muted.");
  648.                 return; }
  649.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  650.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be muted.");
  651.                 return; }
  652.             if (sys.auth(src) <= 3) {
  653.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " was muted by " + sys.name(src) + "!");}
  654.             else
  655.                 { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously muted!"); }
  656.             sys.saveVal('muted' + sys.ip(tar),1);
  657.             sys.removeVal('mutechk' + sys.ip(tar));
  658.             return; }
  659.         if (command == "unmute" || command == "-m" || command == "demute" || command == "removemute") {
  660.             if (tar == undefined)
  661.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  662.                 return; }
  663.             if (sys.auth(src) <= 3) {
  664.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " was unmuted by " + sys.name(src) + "!");}
  665.             else
  666.                 { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously unmuted!"); }
  667.             sys.removeVal('muted' + sys.ip(tar));
  668.             sys.removeVal('mutechk' + sys.ip(tar),rnd);
  669.             return; }
  670.     /** Ban **/
  671.         if (command == "unban" || command == "removeban" || command == "-b" || command == "deban") {
  672.             if (sys.auth(src) <= 3) {
  673.                 sys.sendAll("~~Server~~: " + commandData + " was unbanned by " + sys.name(src) + "!");}
  674.             else
  675.                 { sys.sendAll("~~Server~~: " + commandData + " was mysteriously unbanned!"); }
  676.             sys.removeVal('banned' + commandData);
  677.             sys.removeVal('banchk' + commandData);
  678.             return; }
  679.         if (command == "ban" || command == "b" || command == "bh" || command == "ban1") {
  680.             if (tar == undefined)
  681.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  682.                 return; }
  683.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  684.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
  685.                 return; }
  686.             if (sys.auth(tar) > 0)
  687.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
  688.                 return; }
  689.             if (sys.auth(src) <= 3) {
  690.             sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was banned for 1 hour by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was mysteriously banned for 1 hour!"); }
  691.             var rnd = sys.rand(1,9999);
  692.             sys.saveVal('banned' + sys.ip(tar),1);
  693.             sys.saveVal('banchk' + sys.ip(tar),rnd);
  694.             sys.callLater("if (sys.getVal('banchk" + sys.ip(tar) +"') == "+ rnd+ " ) { sys.removeVal('banned" + sys.ip(tar) +"'); sys.removeVal('banchk" + sys.ip(tar) +"'); sys.sendAll('~~Server~~: " + sys.name(tar) + " is no longer banned.'); }",3600);
  695.             var cnt = numUsers;
  696.             var user = 0;
  697.             while(user < cnt)
  698.                 {if (sys.loggedIn(user) == true) {
  699.                     if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
  700.                          { sys.kick(user);}
  701.                 } else {
  702.                     cnt += 1;}
  703.                 user += 1;
  704.                 }
  705.             sys.kick(tar);
  706.             return; }
  707.         if (command == "fullban" || command == "ban8" || command == "longban" || command == "bf" || command == "b8") {
  708.             if (tar == undefined)
  709.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  710.                 return; }
  711.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  712.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
  713.                 return; }
  714.             if (sys.auth(tar) > 0)
  715.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
  716.                 return; }
  717.             if (sys.auth(src) <= 3) {
  718.             sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was banned for 8 hours by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was mysteriously banned for 8 hours!"); } 
  719.             var rnd = sys.rand(1,99999999);
  720.             sys.saveVal('banned' + sys.ip(tar),1);
  721.             sys.saveVal('banchk' + sys.ip(tar),rnd);
  722.             sys.callLater("if (sys.getVal('banchk" + sys.ip(tar) +"') == "+ rnd+ " ) { sys.removeVal('banned" + sys.ip(tar) +"'); sys.removeVal('banchk" + sys.ip(tar) +"'); sys.sendAll('~~Server~~: " + sys.name(tar) + " is no longer banned.'); }",28800);
  723.             var cnt = numUsers;
  724.             var user = 0;
  725.             while(user < cnt)
  726.                 {if (sys.loggedIn(user) == true) {
  727.                     if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
  728.                          { sys.kick(user);}
  729.                 } else {
  730.                     cnt += 1;}
  731.                 user += 1;
  732.                 }
  733.             sys.kick(tar);
  734.             return; }
  735.     /** Kick **/
  736.         if (command == "kick" || command == "k") {
  737.             if (tar == undefined)
  738.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  739.                 return; }
  740.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  741.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
  742.                 return; }
  743.             if (sys.auth(tar) > 0)
  744.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be kicked.");
  745.                 return; }
  746.             if (sys.auth(src) <= 3) {
  747.             sys.sendAll("~~Server~~: " + sys.name(tar) + " was kicked by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously kicked!"); }
  748.             sys.kick(tar);
  749.             return; }
  750.         if (command == "superkick") {
  751.             if (tar == undefined)
  752.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  753.                 return; }
  754.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  755.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
  756.                 return; }
  757.             if (sys.auth(tar) > 0)
  758.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be kicked.");
  759.                 return; }
  760.             if (sys.auth(src) <= 3) {
  761.             sys.sendAll("~~Server~~: " + sys.name(tar) + " was kicked by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously kicked!"); }
  762.             sys.kick(tar);
  763.             var cnt = numUsers;
  764.             var user = 0;
  765.             while(user < cnt)
  766.                 {if (sys.loggedIn(user) == true) {
  767.                     if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
  768.                          { sys.kick(user);}
  769.                 } else {
  770.                     cnt += 1;}
  771.                 user += 1;
  772.                 }
  773.             return; }
  774.     /** Hush **/
  775.         if (command == "hush" || command == "h") {
  776.             if (typeof restrict != 'undefined') {
  777.             sys.sendMessage(src,'~~Server~~: The server is already restricted, to hush the chat first derestrict the server.');
  778.             return; }
  779.             hush = 1;
  780.             if (sys.auth(src) <= 3) {
  781.             sys.sendAll("~~Server~~: The chat has been hushed by " + sys.name(src) + "!");} else { sys.sendAll("~~Server~~: The chat has been mysteriously hushed!"); }
  782.             return; }
  783.         if (command == "unhush" || command == "-h" || command == "dehush") {
  784.             if (typeof restrict != 'undefined') {
  785.             sys.sendMessage(src,'~~Server~~: The server is already restricted, to hush the chat first derestrict the server.');
  786.             return; }
  787.             hush = undefined;
  788.             if (sys.auth(src) <= 3) {
  789.             sys.sendAll("~~Server~~: The chat has been unhushed by " + sys.name(src) + "!");} else { sys.sendAll("~~Server~~: The chat has been mysteriously unhushed!"); }
  790.             return; }
  791.     /** Stop **/
  792.         if (command == "stop" || command == "s") {
  793.             stop = 1;
  794.             if (sys.auth(src) <= 3) {
  795.             sys.sendAll("~~Server~~: The battles have been stoped by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: The battles have been mysteriously stoped!"); }
  796.             return; }
  797.         if (command == "unstop" || command == "destop" || command == "-s") {
  798.             stop = undefined;
  799.             if (sys.auth(src) <= 3) {
  800.             sys.sendAll("~~Server~~: The battles have been resumed by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: The battles have been mysteriously resumed!"); }
  801.             return; }
  802.     /** Invisibillity **/
  803.         if (command == "invisible" && sys.auth(src) == 1) {
  804.             sys.sendMessage(src,'~~Server~~: You are now in invisible mode!');
  805.             sys.changeAuth(src,4);
  806.             return; }
  807.         if (command == "visible" && sys.auth(src) == 4) {
  808.             sys.sendMessage(src,'~~Server~~: You are no longer in invisible mode!');
  809.             sys.changeAuth(src,1);
  810.             return; }
  811.         if (command == "invisible" && sys.auth(src) == 2) {
  812.             sys.sendMessage(src,'~~Server~~: You are now in invisible mode!');
  813.             sys.changeAuth(src,5);
  814.             return; }
  815.         if (command == "visible" && sys.auth(src) == 5) {
  816.             sys.sendMessage(src,'~~Server~~: You are no longer in invisible mode!');
  817.             sys.changeAuth(src,2);
  818.             return; }
  819.         if (command == "invisible" && sys.auth(src) == 3) {
  820.             sys.sendMessage(src,'~~Server~~: You are now in invisible mode!');
  821.             sys.changeAuth(src,6);
  822.             return; }
  823.         if (command == "visible" && sys.auth(src) == 6) {
  824.             sys.sendMessage(src,'~~Server~~: You are no longer in invisible mode!');
  825.             sys.changeAuth(src,3);
  826.             return; }
  827.     /** Lutra Tournmant Script **/
  828.     if (command == "tour" || command == "newtour" || command == "createtour"){
  829.         if (tourmode != 0){
  830.             sys.sendMessage(src, "~~Server~~: Sorry, you are unable to start a tournament because one is still currently running.");
  831.             return; }
  832.         tourtier = mcmd[0].toLowerCase();
  833.         tourcount = parseInt(mcmd[1]);
  834.         if (isNaN(tourcount) || tourcount <= 2){                       
  835.             sys.sendMessage(src, "~~Server~~ You must specify a tournament size of 3 or more.");
  836.             return; }
  837.         var tier = sys.getTierList().toLowerCase().split('\n');
  838.         if (tier.indexOf(tourtier) == -1){
  839.             sys.sendMessage(src, "~~Server~~: Sorry, the server does not recognise the " + mcmd[0] + " tier.");  
  840.             return; }
  841.         tourmode = 1;
  842.         tournumber = tourcount;
  843.         tourcurrentnumber = tournumber;
  844.         tourmembers = new Array();
  845.         tourbattlers = new Array();
  846.         tourlosers = new Array();
  847.         tourdisplayversion = 1;
  848.         this.tourdisplay();
  849.         return; }
  850.     if (command == "endtour") {
  851.         if (tourmode == 0){
  852.             sys.sendMessage(src, "Sorry, you are unable to end a tournament because one is not currently running.");
  853.             return;}
  854.         tourmode = 0;
  855.         sys.sendAll("~~Server~~: The tournament has been cancelled.");
  856.         return; }
  857. if (command == "dq"){
  858.     if (tourmode == 0){
  859.         sys.sendMessage(src, "You are unable to disqualify players because a tournament is not currently running.");
  860.         return; }
  861.     var dqtrgt = mcmd[0].toLowerCase();
  862.     for (var tourmembersname in tourmembers){
  863.         if(tourmembers[tourmembersname].toLowerCase() === dqtrgt){
  864.             var dqbattler = tourmembers[tourmembersname];}
  865.         }
  866.     if (dqbattler === undefined){
  867.         sys.sendMessage(src, "You are unable to disqualify the targeted player because they are not in the tournament.");
  868.         return; }
  869.     var undqbattler;
  870.     if (tourmembers.indexOf(dqbattler) % 2 == 0){
  871.         undqbattler = tourmembers[tourmembers.indexOf(dqbattler)+1]; }
  872.     if (tourmembers.indexOf(dqbattler) % 2 == 1){
  873.         undqbattler = tourmembers[tourmembers.indexOf(dqbattler)-1]; }
  874.     for (var tourlosersindex in tourlosers){
  875.         if (tourlosers[tourlosersindex] == dqtrgt){
  876.             sys.sendMessage(src, "You are unable to disqualify the targeted player because they have already lost in this round.");
  877.             return; }
  878.         }
  879.     if (tourmode == 1){
  880.         tourcount++;
  881.         tourmembers.splice(tourmembers.indexOf(dqbattler),1)
  882.         sys.sendAll(dqbattler + " was removed from the tournament! " + tourcount + " more spot(s) left!");
  883.         return;}
  884.     sys.sendAll("~~Server~~: " + dqbattler + " has been disqualified!");
  885.     this.roundincrease(undqbattler,dqbattler);
  886.     return;}
  887. /** Admin stuff **/
  888.         if (command == "debug" ) {
  889.         /** Use with caution!! Make sure there are no pending connections! **/
  890.         print('Debug init('+numUsers+')');
  891.         numUsers = sys.numPlayers();
  892.         print('Debug complete('+numUsers+')');
  893.         return; }
  894.         if (sys.auth(src) < 2 || sys.auth(src) == 4)
  895.              {sys.sendMessage(src, "~~Server~~: The command " + command + " can not be used by moderators or does not exist.");
  896.             return; }
  897.     /** Password **/
  898.         if (command == "setpass" || command == "setpassword") {
  899.             password[src] = commandData;
  900.             serverpass = commandData;
  901.             if (sys.auth(src) <= 3) {
  902.                 sys.sendAll('~~Server~~: The password was changed by '+sys.name(src)+', please enter the password using /pass password.'); }
  903.             else
  904.                 { sys.sendAll('~~Server~~: The password was mysteriously changed, please enter the password using /pass password.');  }
  905.             return; }
  906.         if (command == "removepass" || command == "removepassword") {
  907.             sys.removeVal('pass:'+sys.name(src));
  908.             password[src] = '';
  909.             serverpass = '';
  910.             if (sys.auth(src) <= 3) {
  911.                 sys.sendAll('~~Server~~: The password was removed by '+sys.name(src)+'.'); }
  912.             else
  913.                 { sys.sendAll('~~Server~~: The password was mysteriously removed.'); }
  914.  
  915.             return; }
  916.     /** Protects **/
  917.         if (command == "protect" || command == "p") {
  918.             if (tar == undefined)
  919.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  920.                 return; }
  921.             if (sys.auth(tar) > 0)
  922.                 {sys.sendMessage(src,"~~Server~~: Moderators and above do not need protection.");
  923.                 return; }
  924.             if (sys.auth(src) <= 3) {
  925.             sys.sendAll("~~Server~~: " + sys.name(tar) + " was protected by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously protected!"); }
  926.             sys.saveVal('protected' + sys.ip(tar),1);
  927.             sys.removeVal('muted' + sys.ip(tar));
  928.             sys.removeVal('banned' + sys.ip(tar));
  929.             sys.removeVal('mutechk' + sys.ip(tar));
  930.             sys.removeVal('banchk' + sys.ip(tar));
  931.             return; }
  932.         if (command == "deprotect" || command == "unprotect" || command == "-p") {
  933.             if (tar == undefined)
  934.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  935.                 return; }
  936.             if (sys.auth(src) <= 3) {
  937.             sys.sendAll("~~Server~~: " + sys.name(tar) + " was deprotected by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously deprotected!"); }
  938.             sys.removeVal('protected' + sys.ip(tar));
  939.             return; }
  940.     /** Restrict **/
  941.         if (command == "restrict" || command == "r") {
  942.             restrict = 1;
  943.             hush = undefined;
  944.             if (sys.auth(src) <= 3) {
  945.             sys.sendAll("~~Server~~: The server has been restricted by " + sys.name(src) + "!"); } else {sys.sendAll("~~Server~~: The server has been mysteriously restricted!"); }
  946.             var cnt = numUsers;
  947.             var user = 0;
  948.             while(user < cnt)
  949.                 {if (sys.loggedIn(user) == true) {
  950.                     if (sys.auth(user) < 1) {
  951.                         sys.sendMessage(user,'~~Server~~: You are not staff and therefore have been kicked as the server has been restricted.');
  952.                         sys.kick(user); }
  953.                     }
  954.                 else {
  955.                     cnt += 1;}
  956.                 user += 1; }
  957.             return; }
  958.         if (command == "derestrict" || command == "-r" || command == "unrestrict") {
  959.             restrict = undefined;
  960.             if (sys.auth(src) <= 3) {
  961.             sys.sendAll("~~Server~~: The server has been derestricted by " + sys.name(src) + "!"); } else {sys.sendAll("~~Server~~: The server has been mysteriously derestricted!"); }
  962.             return; }
  963.     /** Perma Ban **/
  964.         if (command == "permaban" || command == "banx" || command == "ban0" || command == "banforever" || command == "bx") {
  965.             if (tar == undefined)
  966.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  967.                 return; }
  968.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  969.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
  970.                 return; }
  971.             if (sys.auth(tar) > 0)
  972.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
  973.                 return; }
  974.             if (sys.auth(src) <= 3) {
  975.             sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was banned forever by " + sys.name(src) + "!");} else { sys.sendAll("~~Server~~: " + sys.name(tar) + " ("+ sys.ip(tar) + ") was mysteriously banned forever!"); }
  976.             sys.saveVal('banned' + sys.ip(tar),1);
  977.             sys.removeVal('banchk' + sys.ip(tar));
  978.             var cnt = numUsers;
  979.             var user = 0;
  980.             while(user < cnt)
  981.                 {if (sys.loggedIn(user) == true) {
  982.                     if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
  983.                          { sys.kick(user);}
  984.                 } else {
  985.                     cnt += 1;}
  986.                 user += 1;
  987.                 }
  988.             sys.kick(tar);
  989.             return; }
  990.     /** Auth **/
  991.         if (command == "auth" || command == "a") {
  992.             if (tar == undefined)
  993.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  994.                 return; }
  995.             if (sys.auth(tar) >= 2 && sys.auth(tar) != 4)
  996.                 {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
  997.                 return; }
  998.             if (sys.auth(src) <= 3) {
  999.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " was given moderator by " + sys.name(src) + "!");}
  1000.             else
  1001.                 { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously given moderator!"); }
  1002.             sys.changeAuth(tar,1);
  1003.             return; }
  1004.         if (command == "deauth" || command == "-a") {
  1005.             if (tar == undefined)
  1006.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  1007.                 return; }
  1008.             if (sys.auth(tar) >= 2 && sys.auth(tar) != 4)
  1009.                 {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
  1010.                 return; }
  1011.             if (sys.auth(src) <= 3) {
  1012.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " had moderator removed by " + sys.name(src) + "!");}
  1013.             else
  1014.                 {sys.sendAll("~~Server~~: " + sys.name(tar) + " mysterioulsy had moderator removed!");  }
  1015.            
  1016.             sys.changeAuth(tar,0);
  1017.             return; }
  1018. /** Silent Commands(admin) **/
  1019.         if (command == "s-unmute") {
  1020.             if (tar == undefined)
  1021.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  1022.                 return; }
  1023.             if (sys.auth(tar) >= 1)
  1024.             {sys.sendMessage("~~Server~~: You dont have sufficient auth to unmute " + sys.name(tar)+ ".");
  1025.             return; }
  1026.             this.unmute(tar);
  1027.             print(sys.name(tar) + " was silently unmuted by " + sys.name(src) + ".");
  1028.             return; }
  1029.         if (command == "s-unban") {
  1030.             sys.removeVal('banned' + commandData);
  1031.             print(sys.name(tar) + " was silently unbanned by " + sys.name(src) + ".");
  1032.             sys.removeVal('banchk' + commandData);
  1033.             return; }
  1034.         if (command == "s-kick") {
  1035.             if (tar == undefined)
  1036.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  1037.                 return; }
  1038.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  1039.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
  1040.                 return; }
  1041.             if (sys.auth(tar) >= 1)
  1042.                 {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to block " + sys.name(tar) + ".");
  1043.                 return; }
  1044.             sys.kick(tar);
  1045.             print(sys.name(tar) + " was silently kicked by " + sys.name(src) + ".");
  1046.             return; }
  1047.         if (command == "s-mute") {
  1048.             if (tar == undefined)
  1049.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  1050.                 return; }
  1051.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  1052.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be muted.");
  1053.                 return; }
  1054.             if (sys.auth(tar) >= 1)
  1055.                 {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to mute " + sys.name(tar) + ".");
  1056.                 return; }
  1057.             print(sys.name(tar) + " was silently muted by " + sys.name(src) + ".");
  1058.             sys.saveVal('muted' + sys.ip(tar),1);
  1059.             sys.removeVal('mutechk' + sys.ip(tar));
  1060.             return; }
  1061.         if (command == "s-ban") {
  1062.             if (tar == undefined)
  1063.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
  1064.                 return; }
  1065.             if (sys.getVal('protected' + sys.ip(tar)) == 1)
  1066.                 {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
  1067.                 return; }
  1068.             if (sys.auth(tar) > 0)
  1069.                 {sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
  1070.                 return; }
  1071.             print(sys.name(tar) + " was silently banned by " + sys.name(src) + ".");
  1072.             var rnd = sys.rand(1,99999999);
  1073.             sys.saveVal('banned' + sys.ip(tar),1);
  1074.             sys.saveVal('banchk' + sys.ip(tar),rnd);
  1075.             sys.callLater("if (sys.getVal('banchk" + sys.ip(tar) +"') == "+ rnd+ " ) { sys.removeVal('banned" + sys.ip(tar) +"'); sys.removeVal('banchk" + sys.ip(tar) +"'); sys.sendAll('~~Server~~: " + sys.name(tar) + " is no longer banned.'); }",3600);
  1076.             var cnt = numUsers;
  1077.             var user = 0;
  1078.             while(user < cnt)
  1079.                 {if (sys.loggedIn(user) == true) {
  1080.                     if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
  1081.                          { sys.kick(user);}
  1082.                 } else {
  1083.                     cnt += 1;}
  1084.                 user += 1;
  1085.                 }
  1086.             sys.kick(tar);
  1087.             return; }
  1088.         if (sys.auth(src) != 3 && sys.auth(src) != 6)
  1089.              {sys.sendMessage(src, "~~Server~~: The command " + command + " can not be used by admins or does not exist.");
  1090.             return; }
  1091.     /** Master Commands **/
  1092.         if (command == "admin" || command == "*") {
  1093.             if (tar == undefined)
  1094.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  1095.                 return; }
  1096.             if (sys.auth(tar) >= 2 && sys.auth(tar) != 4)
  1097.                 {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
  1098.                 return; }
  1099.             if (sys.auth(src) <= 3) {
  1100.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " was given admin by " + sys.name(src) + "!");}
  1101.             else
  1102.                 { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously given admin!"); }
  1103.             sys.changeAuth(tar,1);
  1104.             return; }
  1105.         if (command == "deadmin" || command == "-*") {
  1106.             if (tar == undefined)
  1107.                 {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
  1108.                 return; }
  1109.             if (sys.auth(tar) == 3 || sys.auth(tar) == 6)
  1110.                 {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
  1111.                 return; }
  1112.             if (sys.auth(src) <= 3) {
  1113.                 sys.sendAll("~~Server~~: " + sys.name(tar) + " had admin removed by " + sys.name(src) + "!");}
  1114.             else
  1115.                 {sys.sendAll("~~Server~~: " + sys.name(tar) + " mysterioulsy had admin removed!");  }
  1116.            
  1117.             sys.changeAuth(tar,1);
  1118.             return; }
  1119.         sys.sendMessage(src, "~~Server~~: The command " + command + " does not exist.");
  1120.         return;
  1121.     }
  1122. }
  1123. ,
  1124. /** Lutra Functions **/
  1125. sendmessage: function (str) {
  1126.           return sys.sendMessage(receiver, str); }
  1127. ,
  1128. tourdisplay: function (){
  1129.     var send;
  1130.     tourdisplayversion == 0 ? send = this.sendmessage : send = sys.sendAll;
  1131.     send("~~Server~~: A Tournament has started! Type /join or !join to enter the tournament! ");
  1132.     send("~~Server~~: PLAYERS: " + tournumber);
  1133.     send("~~Server~~: TYPE: SINGLE ELIMINATION");
  1134.     send("~~Server~~: TIER : " + tourtier.toUpperCase());
  1135.     tourdisplayversion = 0; }
  1136. ,
  1137. roundincrease: function (winnername, losername){
  1138.         tourlosers.push(losername);
  1139.         var tourloser = tourbattlers.indexOf(losername);
  1140.         tourbattlers.splice(tourloser,1);
  1141.         var tourwinner = tourbattlers.indexOf(winnername);
  1142.         tourbattlers.splice(tourwinner,1);
  1143.         tourbattles++;
  1144.         if (winnername != "*bye"){
  1145.             sys.sendAll('~~Server~~: '+winnername + " advances to the next round:");
  1146.             }
  1147.         sys.sendAll('~~Server~~: '+losername + " is out of the tournament.");
  1148.         if (Math.floor(tourcurrentnumber/2) != tourbattles){
  1149.             sys.sendAll("~~Server~~:  " + Math.floor(tourcurrentnumber/2 - tourbattles) + " more match(es) to be completed in this round!");}
  1150.         if (tourcurrentnumber == 2){
  1151.             tourmode = 0;
  1152.             sys.sendAll("~~Server~~: THE WINNER OF THE TOURNAMENT IS : " + winnername);
  1153.             sys.sendAll("~~Server~~:  Congratulations, " + winnername + ", on your success!");
  1154.             return;}
  1155.         if (Math.floor(tourcurrentnumber/2) == tourbattles){
  1156.             if (tourmembers[tourcurrentnumber] == "*bye"){
  1157.                 tourmembers.splice(tourcurrentnumber,1); }
  1158.             tourcurrentnumber = Math.ceil(tourcurrentnumber/2);
  1159.             if (tourcurrentnumber == 2 && winnername == "*bye"){
  1160.                 tourbattles--;
  1161.                 return;}
  1162.             this.roundpairing(); }
  1163.     }
  1164. ,
  1165. roundpairing: function(){
  1166.     tourbattles = 0;
  1167.     while (0 in tourlosers){
  1168.         tourmembers.splice(tourmembers.indexOf(tourlosers[0]),1);
  1169.         tourlosers.splice(0,1);}           
  1170.     roundnumber++;
  1171.     rounddisplayversion = 1;
  1172.     this.shufflefunct(tourmembers);
  1173.     this.rounddisplay();
  1174.     if (tourmembers.length % 2 == 1){
  1175.         tourmembers.push("*bye");
  1176.         sys.sendAll("*** " + tourmembers[tourcurrentnumber-1] + " is randomly selected to go through to the next round!");}
  1177. }
  1178. ,
  1179. shufflefunct: function (myarray) {
  1180.     var i = myarray.length;
  1181.     if(i == 0) return false;
  1182.     while(--i){
  1183.         var j = Math.floor(Math.random()*(i + 1));
  1184.         var tempi = myarray[i];
  1185.         var tempj = myarray[j];
  1186.         myarray[i] = tempj;
  1187.         myarray[j] = tempi;}
  1188.     }
  1189. ,
  1190. tourbattleend : function(winnername, losername){
  1191.     if (tourbattlers.indexOf(losername) in tourbattlers && tourlosers.indexOf(losername) == -1 && tourlosers.indexOf(winnername) == -1){
  1192.         sys.sendAll("~~Server~~:  A tournament match has been completed!");
  1193.         this.roundincrease(winnername, losername);}
  1194. }
  1195. ,
  1196. rounddisplay: function(){
  1197.           var send;
  1198.           rounddisplayversion == 0 ? send = this.sendmessage : send = sys.sendAll;
  1199.           var roundstring;
  1200.           tourcurrentnumber == 2 ? roundstring = "~~Server~~: Final Round !" : roundstring = "~~Server~~: Round " + roundnumber + " !"
  1201.           send(roundstring);
  1202.           for (var tourmembersindex = 0 ; tourmembersindex < tourcurrentnumber-rounddisplayversion; tourmembersindex+=2){
  1203.                     var tourspotone;
  1204.                     var tourspottwo;
  1205.                     tourlosers.indexOf(tourmembers[tourmembersindex+1]) in tourlosers ? tourspotone = "(" + tourmembers[tourmembersindex] + ")" : tourspotone = tourmembers[tourmembersindex];
  1206.                     tourlosers.indexOf(tourmembers[tourmembersindex]) in tourlosers ? tourspottwo = "(" + tourmembers[tourmembersindex+1] + ")" : tourspottwo = tourmembers[tourmembersindex+1];
  1207.                     var tourspotspace = 20 - tourspotone.length;
  1208.                     do {
  1209.                               tourspotone = " " + tourspotone;
  1210.                               tourspotspace--;
  1211.                     }
  1212.                     while (tourspotspace > 0);
  1213.                     send(tourspotone + " VS " + tourspottwo);
  1214.           }
  1215.           rounddisplayversion = 0;
  1216. }
  1217. ,
  1218. /** end **/
  1219. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement