Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ({
- /** Server Events **/
- serverStartUp : function() {
- this.afterNewMessage("Script Check: OK");
- return; }
- ,
- afterNewMessage : function (message) {
- if (message == "Script Check: OK") {
- sys.sendAll("~~Server~~: Scripts were updated.");
- if (typeof floodcount == "undefined") {
- floodcount = new Array(); }
- if (typeof mailWait == "undefined") {
- mailWait = new Array(); }
- if (typeof inBattle == "undefined") {
- inBattle = new Array();}
- if (typeof hyperMode == "undefined") {
- hyperMode = new Array();}
- if (typeof numUsers == "undefined") {
- numUsers = 0}
- if (typeof ver == 'undefined') {
- ver = 1;
- 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.'); }
- if (typeof password == 'undefined') {
- password = new Array(); }
- if (typeof serverpass == 'undefined') {
- serverpass = ''; }
- if (typeof rank == "undefined") {
- rank = new Array();
- rank[0] = 'a user';
- rank[1] = 'a moderator';
- rank[2] = 'an admin';
- rank[3] = 'an owner';
- rank[4] = 'a moderator(invisible)';
- rank[5] = 'an admin(invisible)';
- rank[6] = 'an owner(invisible)'; }
- if (typeof(variablesset) == "undefined"){
- variablesset = 1;
- tourmode = 0;
- border = "»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»:";}
- }
- if (message.toLowerCase().indexOf(' changed their team, and their name to ') != -1) {
- var eventsrc = new Array();
- eventsrc = message.split(' changed their team, and their name to ');
- this.beforeTeamChange(sys.id(eventsrc[0]),eventsrc[1]); }
- return; }
- ,
- /** Log in and Out **/
- afterLogIn : function(src) {
- numUsers += 1;
- /** Impersonation Check **/
- 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) {
- sys.sendMessage(src,'Invalid name. Change your name.');
- sys.kick(tar);
- return; }
- password[src] = '';
- hyperMode[src] = false;
- inBattle[src] = false;
- mailWait[src] = false;
- floodcount[src] = 0;
- if (sys.auth(src) < 1 && sys.getVal('banned' + sys.ip(src)) == 1) {
- sys.sendAll("~~Server~~: Banned user " + sys.name(src) + ' (' + sys.ip(src) + ') was kicked!');
- sys.kick(src);
- return; }
- if (sys.auth(src) < 1 && (typeof restrict != "undefined")) {
- sys.sendMessage(src,"~~Server~~: The server is in restricted mode and can only be accesed by staff.");
- sys.kick(src);
- return; }
- var str = '~~Server~~: Server status';
- var muteis = sys.getVal('muted' + sys.ip(src));
- var protis = sys.getVal('protected' + sys.ip(src));
- if (typeof(stop) != "undefined")
- { str += ', battles stopped'; }
- if (typeof(hush) != "undefined")
- { str += ', chat hushed'; }
- if (serverpass != "")
- { str += ', password protected'; }
- if (typeof restrict != "undefined")
- { str += ', restricted'; }
- if (str == '~~Server~~: Server status') {
- str = '~~Server~~: Server status, normal' }
- str = str + '.';
- sys.sendMessage(src,str);
- str = '~~Server~~: Your status';
- if (muteis == 1)
- { str += ', muted'; }
- if (protis == 1)
- { str += ', protected'; }
- if (muteis != 1 && protis != 1)
- { str += ', normal'; }
- str += '.';
- sys.sendMessage(src,str +' You are ' + rank[sys.auth(src)] +'.');
- sys.sendMessage(src,'~~Server~~: Type /cmdlist for the commands. Type /rules for the rules');
- if (serverpass != '') {
- if (sys.auth(src) == 0) {
- sys.sendMessage(src,'~~Server~~: The server is password protected, please enter the password using /pass password.'); }
- else {
- sys.sendAll('~~Server~~: '+sys.name(src)+' has joined!'); }
- }
- if (sys.auth(src) >= 1) {
- var cnt = numUsers;
- var user = 0;
- while(user < cnt && user < 300)
- { if (sys.loggedIn(user) == true) {
- if (sys.auth(user) >= 1) {
- sys.sendMessage(src,'~~Server~~: Online staff member ' + sys.name(user) + ' is ' +rank[sys.auth(user)]); }
- }
- else {
- cnt += 1;}
- user += 1; }
- }
- sys.sendMessage(src,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
- /** Lutra's Tourn Script **/
- if (tourmode == 1){
- receiver = src;
- this.tourdisplay();
- sys.sendMessage(src,"~~Server~~: " + tourcount + " space(s) are left!");
- return;}
- if (tourmode == 2){
- sys.sendMessage(src, "~~Server~~: A tournament is currently running.");
- return; }
- }
- ,
- afterLogOut : function (src) {
- numUsers -= 1;
- return;
- }
- ,
- beforeTeamChange : function(src,old) {
- /** Impersonation Check **/
- 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) {
- sys.sendMessage(src,'Invalid name. Change your name.');
- sys.kick(tar);
- return; }
- }
- ,
- /** Moderation Menu **/
- unmute : function(tar){
- sys.removeVal('muted' + sys.ip(tar));
- return; }
- ,
- beforePlayerKick : function(src,tar) {
- sys.stopEvent();
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
- return; }
- if (sys.auth(tar) > 0)
- {sys.sendMessage(src,"~~Server~~: Moderators and above can not be kicked.");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was kicked by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously kicked!"); }
- sys.kick(tar);
- return; }
- ,
- beforePlayerBan : function(src,tar) {
- sys.stopEvent();
- if (sys.auth(src) == 4) {
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
- return; }
- if (sys.auth(tar) > 0)
- {sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
- return; }
- if (sys.auth(src) <= 3) {
- 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!"); }
- var rnd = sys.rand(1,99999999);
- sys.saveVal('banned' + sys.ip(tar),1);
- sys.saveVal('banchk' + sys.ip(tar),rnd);
- 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);
- var cnt = numUsers;
- var user = 0;
- while(user < cnt)
- {if (sys.loggedIn(user) == true) {
- if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
- { sys.kick(user);}
- } else {
- cnt += 1;}
- user += 1;
- }
- sys.kick(tar);
- return; }
- ,
- /** Battles **/
- beforeBattleEnded : function(win, lose, result) {
- inBattle[lose] = false;
- inBattle[win] = false;
- /**if (result == "win" || result == "forfeit") {
- sys.sendAll(sys.name(win) + " won against "+ sys.name(lose)+'.'); } **/
- if (mailWait[win] == true) {
- sys.sendMessage(win,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(win).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
- mailWait[win] = false; }
- if (mailWait[lose] == true) {
- sys.sendMessage(lose,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(lose).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
- mailWait[lose] = false; }
- if (tourmode == 2 && result != "tie"){
- this.tourbattleend(sys.name(win), sys.name(lose));}
- return; }
- ,
- checkhazards : function(id) {
- var stealthrock = sys.moveNum('Stealth Rock');
- var toxicspikes = sys.moveNum('Toxic Spikes');
- var spikes = sys.moveNum('Spikes');
- if (sys.hasTeamMove(id,stealthrock) == true || sys.hasTeamMove(id,spikes) == true || sys.hasTeamMove(id,toxicspikes) == true) {
- return(true); } else { return(false); }
- }
- ,
- beforeBattleMatchup : function(src, tar, clauses) {
- if ( typeof(stop) != "undefined") {
- sys.stopEvent();
- sys.sendMessage(src, "~~Server~~: The battles are stoped.");
- return; }
- var xx = 0;
- if (sys.tier(src) == 'NoHazards' && this.checkhazards(src) == true) {
- sys.sendMessage(src,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
- sys.kick(src);
- sys.sendAll('~~Server~~: '+sys.name(src)+' was kicked by ~~Server~~');
- xx = 1; }
- if (sys.tier(tar) == 'NoHazards' && this.checkhazards(tar) == true) {
- sys.sendMessage(tar,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
- sys.kick(tar);
- sys.sendAll('~~Server~~: '+sys.name(tar)+' was kicked by ~~Server~~');
- xx = 1; }
- if (xx) {
- return; }
- inBattle[src] = true;
- inBattle[tar] = true;
- return; }
- ,
- beforeBattleStarted : function(src, tar, clauses, rated, mode) {
- inBattle[src] = true;
- inBattle[tar] = true;
- return; }
- ,
- afterBattleStarted: function(src, trgt){
- if (tourmode == 2){
- var srctier = sys.tier(src).toLowerCase();
- var trgttier = sys.tier(trgt).toLowerCase();
- var srcname = sys.name(src);
- var trgtname = sys.name(trgt);
- var tourmembershigh = tourmembers.indexOf(srcname);
- var tourmemberslow = tourmembers.indexOf(trgtname);
- if (srctier == trgttier && srctier == tourtier && tourmembershigh in tourmembers && tourmemberslow in tourmembers){
- if (tourmemberslow > tourmembershigh){
- var temphigh = tourmemberslow;
- tourmemberslow = tourmembershigh;
- tourmembershigh = temphigh;
- }
- if (tourmemberslow % 2 == 0 && tourmembershigh == tourmemberslow + 1){
- tourbattlers.push(srcname);
- tourbattlers.push(trgtname);
- }
- }
- }
- }
- ,
- beforeChallengeIssued : function(src, tar, clauses) {
- if ( typeof(stop) != "undefined") {
- sys.stopEvent();
- sys.sendMessage(src, "~~Server~~: The battles are stoped.");
- return; }
- if (sys.tier(src) == 'NoHazards' && this.checkhazards(src) == true) {
- sys.sendMessage(src,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
- sys.kick(src);
- sys.sendAll('~~Server~~: '+sys.name(src)+' was kicked by ~~Server~~.');
- xx = 1; }
- if (sys.tier(tar) == 'NoHazards' && this.checkhazards(tar) == true) {
- sys.sendMessage(tar,'~~Server~~: Your team is invalid for that tier, come back with a valid team!');
- sys.kick(tar);
- sys.sendAll('~~Server~~: '+sys.name(tar)+' was kicked by ~~Server~~.');
- xx = 1; }
- }
- ,
- /** Other **/
- beforePlayerAway : function(src, aa) {
- if (mailWait[src] == 1 && aa == 0) {
- sys.sendMessage(src,"~~MailBox~~: You have " + (sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+').length - 1) + " messages in your inbox, use /readmail to view.");
- mailWait[src] = false; }
- return; }
- ,
- beforeChatMessage: function(src, message) {
- if (message[0] != '/' && message[0] != '!') {
- /** Hush check **/
- if (sys.auth(src) < 1 && typeof(hush) != "undefined") {
- sys.stopEvent();
- sys.sendMessage(src, "~~Server~~: The chat is hushed.");
- print("Hushed message from " + sys.name(src) + ": " + message);
- return; }
- /** Mute check **/
- if (sys.auth(src) < 1 && sys.getVal('muted' + sys.ip(src)) == 1) {
- sys.stopEvent();
- sys.sendMessage(src, "~~Server~~: You are muted.");
- print("Muted message from " + sys.name(src) + ": " + message);
- return; }
- sys.stopEvent(); /** Stops event to prevent users without the password from viewing **/
- /** Password Check **/
- if (serverpass != password[src] && serverpass != '' && sys.auth(src) == 0) {
- sys.sendMessage(src,'~~Server~~: Please enter the password using /pass password.');
- return; }
- /** Swear Check **/
- 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,'****');
- if (message != safemsg) {
- print("Filtered message from " + sys.name(src) + ": " + message);
- message = safemsg; }
- /** Flood Check **/
- floodcount[src] += 1;
- sys.callLater('if (floodcount['+src+'] > 0) { floodcount['+src+'] -= 1;}',30);
- if (floodcount[src] > 10 && sys.auth(src) < 1) {
- sys.stopEvent();
- floodcount[src] = 0;
- sys.sendAll("~~Server~~: " + sys.name(src) + " was muted for 5 minutes by ~~Server~~!");
- var rnd = sys.rand(1,9999);
- sys.saveVal('mutechk' + sys.ip(src),rnd);
- 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);
- sys.saveVal('muted' + sys.ip(src),1);
- return; }
- /** Staff Check **/
- var yy = '';
- if (sys.auth(src) == 1) {
- yy = '+'; }
- if (sys.auth(src) == 2 || sys.auth(src) == 3) {
- yy = '~'; }
- if (hyperMode[src] == true && sys.auth(src) != 0) {
- yy = '*** ' + yy; }
- /** Userloop, send messages to users with the password **/
- var cnt = numUsers;
- var user = 0;
- var xx = yy + sys.name(src) +': ' + message;
- print(xx);
- while(user < cnt) {
- if (sys.loggedIn(user) == true) {
- if (serverpass == password[user] || serverpass == '' || sys.auth(user) > 0) {
- sys.sendMessage(user,xx); }
- } else {
- cnt += 1;}
- user += 1; }
- return; }
- /** Commands **/
- if ((message[0] == '/' || message[0] == '!') && message.length > 1)
- {print("Command -- " + sys.name(src) + ": " + message);
- sys.stopEvent();
- var command;
- var commandData;
- var pos = message.indexOf(' ');
- var mcmd = new Array();
- if (pos != -1) {
- command = message.substring(1, pos).toLowerCase();
- commandData = message.substr(pos+1);
- mcmd = commandData.split(':'); }
- else
- { command = message.substr(1).toLowerCase(); }
- var tar = sys.id(mcmd[0]);
- /** User Commands **/
- /** Password **/
- if (command == "pass" || command == "password") {
- if (serverpass == '') {
- sys.sendMessage(src,'~~Server~~: The server is not password protected.');
- return; }
- password[src] = commandData;
- if (serverpass != password[src]) {
- sys.sendMessage(src,'~~Server~~: Bad password, please enter the password using /pass password.'); }
- else {
- sys.sendAll('~~Server~~: '+sys.name(src)+' has joined!'); }
- return; }
- /** Mail **/
- if (command == "sendmail" || command == "smail" || command == "mail") {
- var mail;
- if (mcmd[1] == undefined) {
- sys.sendMessage(src, "~~MailBox~~: Error: No content! Message was not sent!");
- return; }
- mail = mcmd[1];
- if (mail.indexOf('+') == -1) {
- sys.saveVal('msgque' + mcmd[0].toLowerCase(),sys.getVal('msgque' + mcmd[0].toLowerCase()) + ' + Message from ' + sys.name(src) + ": " + mail);
- var rcv = sys.id(mcmd[0]);
- sys.sendMessage(src, "~~MailBox~~: Message sent to user " + mcmd[0] + "!");
- if (rcv != undefined) {
- sys.sendMessage(rcv,"~~MailBox~~: New message, type /readmail to view your inbox.");
- if (sys.away(rcv) == true || inBattle[rcv] == true) {
- mailWait[rcv] = true; }
- }
- } else {
- sys.sendMessage(src, "~~MailBox~~: Error: The + symbol can not be used in mail! Message was not sent!"); }
- return; }
- if (command == "readmail" || command == "rmail") {
- var msg = new Array();
- msg = sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+');
- var length = (sys.getVal('msgque' + sys.name(src).toLowerCase()).split('+').length - 1);
- sys.sendMessage(src,'~~MailBox~~: Here are your messages:');
- for (i = 1; i <= length; i++)
- {sys.sendMessage(src,msg[i]); }
- sys.sendMessage(src,'~~MailBox~~: End of messages.');
- sys.sendMessage(src,'~~MailBox~~: Use /deletemail to clear your inbox. Use "/sendmail USERNAME:MESSAGE" to send a message to another user.');
- return; }
- if (command == "deletemail" || command == "dmail") {
- sys.removeVal('msgque' + sys.name(src).toLowerCase());
- sys.sendMessage(src, "~~Mailbox~~: Mail deleted!");
- return; }
- /** Lists **/
- if (command == "list" || command == "stafflist" || command == "modlist" || command == "l") {
- if (sys.auth(src) >= 1) {
- var cnt = numUsers;
- var user = 0;
- while(user < cnt && user < 300)
- { if (sys.loggedIn(user) == true) {
- if (sys.auth(user) >= 1) {
- sys.sendMessage(src,'~~Server~~: Online staff member ' + sys.name(user) + ' is ' +rank[sys.auth(user)]); }
- } else {
- cnt += 1;}
- user += 1; }
- }
- else
- {var cnt = numUsers;
- var user = 0;
- while(user < cnt && user < 300)
- { if (sys.loggedIn(user) == true) {
- if (sys.auth(user) >= 1 && sys.auth(user) < 4) {
- sys.sendMessage(src,'~~Server~~: Online staff member ' + sys.name(user) + ' is ' +rank[sys.auth(user)]); }
- } else {
- cnt += 1;}
- user += 1; }
- }
- return; }
- if (command == "rules" || command == "rule" || command == "laws") {
- sys.sendMessage(src,"~~Server~~: Here are the commands:");
- if (command == "commands" || command == "command" || command == "cmdlist") {
- sys.sendMessage(src,"~~Server~~: Here are the commands:");
- sys.sendMessage(src,"*** User commands ***");
- sys.sendMessage(src,"~~Server~~: The command '/cmdlist': Lists commands.");
- sys.sendMessage(src,"~~Server~~: The command '/sendmail user:message': Sends mail to another player.");
- sys.sendMessage(src,"~~Server~~: The command '/readmail': Shows your mail.");
- sys.sendMessage(src,"~~Server~~: The command '/deletemail': Deletes all your mail.");
- sys.sendMessage(src,"~~Server~~: The command '/list': Lists online staff members.");
- sys.sendMessage(src,"~~Server~~: The command '/pass password': Allows you to join a password protected server if you know the password.");
- sys.sendMessage(src,"~~Server~~: The command '/join': Allows you to join a tournament.");
- sys.sendMessage(src,"~~Server~~: The command '/viewround': Allows you to view a tournament round pairings.");
- if (sys.auth(src) >= 1) {
- sys.sendMessage(src,"*** Moderator Commands ***");
- sys.sendMessage(src,"~~Server~~: The command '/info': Gives various information about a user.");
- sys.sendMessage(src,"~~Server~~: The command '/writenote user:note': Writes a note to a users account.");
- sys.sendMessage(src,"~~Server~~: The command '/viewnotes user': Reads notes from a users account.");
- sys.sendMessage(src,"~~Server~~: The command '/removenotes user': Removes notes from a users account.");
- sys.sendMessage(src,"~~Server~~: The command '/mute user:time:unit': Bans a user for time units, time must be a number, and unit must be a unit of time.");
- sys.sendMessage(src,"~~Server~~: Note: You do not have to input a time or unit, it will be 5 minutes by deafault. '/mute user:forever' also works.");
- sys.sendMessage(src,"~~Server~~: The command '/mute user:forever': Mutes a user untill they are unmuted.");
- sys.sendMessage(src,"~~Server~~: The command '/unmute user': Allows a user to talk.");
- sys.sendMessage(src,"~~Server~~: The command '/ban user:time:unit': Bans a user for time units, time must be a number, and unit must be a unit of time.");
- sys.sendMessage(src,"~~Server~~: Note: You do not have to input a time or unit, it will be 1 hour by deafault.");
- sys.sendMessage(src,"~~Server~~: The command '/unban IP': Removes a ban(IP only).");
- sys.sendMessage(src,"~~Server~~: The command '/kick user': Kicks a user from the chat");
- sys.sendMessage(src,"~~Server~~: The command '/hush': Stops all users from talking.");
- sys.sendMessage(src,"~~Server~~: The command '/unhush': Removes hush.");
- sys.sendMessage(src,"~~Server~~: The command '/stop': Prevents all user from entering battles.");
- sys.sendMessage(src,"~~Server~~: The command '/unstop': Removes stop.");
- sys.sendMessage(src,"~~Server~~: The command '/invisible': Causes rank not to show and commands to become mysterious.");
- sys.sendMessage(src,"~~Server~~: The command '/visible': Removes invisible.");
- sys.sendMessage(src,"~~Server~~: The command '/hyper': Causes your messages to become alerts.");
- sys.sendMessage(src,"~~Server~~: The command '/dehyper': Undoes hyper.");
- sys.sendMessage(src,"~~Server~~: The command '/getpass': Shows you the server password.");
- sys.sendMessage(src,"~~Server~~: The command '/newtour tier:players': Creates a tournament of a tier with a number of players.");
- sys.sendMessage(src,"~~Server~~: The command '/endtour': Allows you to end a tournament.");}
- if (sys.auth(src) >= 2 && sys.auth(src) != 4) {
- sys.sendMessage(src,"*** Admin Commands ***");
- sys.sendMessage(src,"~~Server~~: The command '/ban user:forever': Bans a user untill they are unbanned.");
- sys.sendMessage(src,"~~Server~~: The command '/setpass': Sets a password on the server.");
- sys.sendMessage(src,"~~Server~~: The command '/removepass': Removes the password.");
- sys.sendMessage(src,"~~Server~~: The command '/restrict': Removes non-staff from the server and prevents them from joining.");
- sys.sendMessage(src,"~~Server~~: The command '/derestrict': Removes restriction from the server.");
- sys.sendMessage(src,"~~Server~~: The command '/protect user': Protected user can not be kicked, muted, blocked, or banned.");
- sys.sendMessage(src,"~~Server~~: The command '/deprotect user': Removes protection.");
- sys.sendMessage(src,"~~Server~~: The command '/auth user': Changes a user into a moderator.");
- sys.sendMessage(src,"~~Server~~: The command '/deauth user': Changes a moderator into a user.");
- sys.sendMessage(src,"~~Server~~: The command '/s-kick user': Kicks a user without a message.");
- sys.sendMessage(src,"~~Server~~: The command '/s-mute user': Mutes a user without a message.");
- sys.sendMessage(src,"~~Server~~: The command '/s-ban user': Bans a user without a message.");
- sys.sendMessage(src,"~~Server~~: The command '/s-unmute user': Removes mute without a message.");
- sys.sendMessage(src,"~~Server~~: The command '/s-unban user': Removes ban without a message."); }
- sys.sendMessage(src,"*** End of list ***");
- return; }
- /** Tournament **/
- if (command == "join" || command == "j"){
- if (tourmode == 0){
- sys.sendMessage(src, "~~Server~~: Sorry, you are unable to join because a tournament is not currently running.");
- return; }
- if (inBattle[src] == true){
- sys.sendMessage(src, "~~Server~~: Sorry, you are unable to join because you are in a battle.");
- return; }
- var tourmembername = sys.name(src);
- if (tourmembers.indexOf(tourmembername) in tourmembers){
- sys.sendMessage(src, "~~Server~~: Sorry, you are already in the tournament. You are not able to join more than once.");
- return; }
- if (tourmode == 2){
- sys.sendMessage(src, "~~Server~~: Sorry, you are unable to join because the tournament has passed the sign-up phase.");
- return; }
- var srctier = sys.tier(src);
- if (tourtier != srctier.toLowerCase()){
- sys.sendMessage(src, "~~Server~~: You are currently not battling in the " + tourtier + " tier. Change your tier to " + tourtier + " to be able to join.");
- return; }
- if (tourcount > 0){
- tourcount--;
- tourmembers.push(tourmembername);
- sys.sendAll('~~Server~~: '+tourmembername + " joined the tournament! " + tourcount + " more spot(s) left!");
- if (tourcount == 0){
- tourmode = 2;
- roundnumber = 0;
- this.roundpairing();}
- return;}
- return; }
- if (command == "viewround" || command == "round") {
- if (tourmode == 0){
- sys.sendMessage(src, "~~Server~~: Sorry, you are unable to view the round because a tournament is not currently running.");
- return;}
- if (tourmode == 1){
- sys.sendMessage(src, "~~Server~~: Sorry, you are unable to view the round because the signing up for the tournament is still in progress.");
- return;}
- receiver = src;
- this.rounddisplay();
- return;}
- /** Moderator Commands **/
- if (sys.auth(src) < 1)
- {sys.sendMessage(src, "~~Server~~: The command " + command + " can not be used by normal users or does not exist.");
- return; }
- /**info **/
- if (command == "hyper" || command == "hypermode" || command == "alert" || command == "alertmode" || command == "e") {
- if (hyperMode[src] == true) {
- sys.sendMessage(src,'~~Server~~: You are already in HyperMode.');
- return; }
- hyperMode[src] = true;
- sys.sendMessage(src,'~~Server~~: You are now in HyperMode.');
- return; }
- if (command == "dehyper" || command == "dehypermode" || command == "dealert" || command == "dealertmode" || command == "-e") {
- hyperMode[src] = false;
- sys.sendMessage(src,'~~Server~~: You are no longer in HyperMode.');
- return; }
- if (command == "info" || command == "whois" || command == "i") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
- return; }
- var alts = ''
- var cnt = numUsers;
- var user = 0;
- var einfo = '';
- if (sys.getVal('muted'+sys.ip(tar)) != '') {
- einfo = einfo + ' The user is muted.' }
- if (sys.getVal('protected'+sys.ip(tar)) != '') {
- einfo = einfo + ' The user is protected.' }
- if (hyperMode[tar] == true) {
- einfo = einfo + ' The user is in HyperMode.' }
- while(user < cnt)
- {if (sys.loggedIn(user) == true) {
- if (sys.ip(tar) == sys.ip(user))
- { alts = alts +' ('+ sys.name(user) + ')';}
- } else {
- cnt += 1; }
- user += 1;
- }
- 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.');
- var msg = new Array();
- msg = sys.getVal('modnotes' + sys.ip(tar)).split('+');
- var length = (sys.getVal('modnotes' + sys.ip(tar).toLowerCase()).split('+').length - 1);
- sys.sendMessage(src,'~~Server~~: These are the notes on the account:');
- for (i = 1; i <= length; i++)
- {sys.sendMessage(src,msg[i]); }
- sys.sendMessage(src,'~~Server~~: End of notes.');
- return; }
- if (command == "writenote" || command == "wnote") {
- var point = commandData.indexOf(':');
- var note;
- if (point == -1) {
- sys.sendMessage(src, "~~Server~~: Error: No content! Note was not added!");
- return; }
- note = commandData.substr(commandData.indexOf(':')+1);
- if (note.indexOf('+') == -1) {
- sys.saveVal('modnotes' + sys.ip(sys.id(mcmd[0])),sys.getVal('modnotes' + sys.ip(sys.id(mcmd[0]))) + ' + Note by ' + sys.name(src) + ": " + note);
- sys.sendMessage(src, "~~Server~~: Note added to user " + mcmd[0] + "!");
- } else { sys.sendMessage(src, "~~Server~~: Error: The + symbol can not be used in notes! Note was not added!"); }
- return; }
- if (command == "viewnote" || command == "viewnotes" || command == "vnote") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
- return; }
- var msg = new Array();
- msg = sys.getVal('modnotes' + sys.ip(tar)).split('+');
- var length = (sys.getVal('modnotes' + sys.ip(tar).toLowerCase()).split('+').length - 1);
- sys.sendMessage(src,'~~Server~~: These are the notes on the account:');
- for (i = 1; i <= length; i++)
- {sys.sendMessage(src,msg[i]); }
- sys.sendMessage(src,'~~Server~~: End of notes.');
- return; }
- if (command == "removenotes" || command == "removenote") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
- return; }
- sys.removeVal('modnotes' + sys.ip(tar));
- sys.sendMessage(src, "~~Server~~: Notes removed!");
- return; }
- if (command == "getpass" || command == "getpassword") {
- sys.sendMessage(src,'~~Server~~: The password is ('+serverpass+').');
- return; }
- /** Mute **/
- if (command == "mute" || command == "m") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined. Use /test username:time:type, username is the name of the user to mute, time is a number, and type is the unit of time(ex hour or minute).");
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be muted.");
- return; }
- if (sys.auth(tar) > 0)
- {sys.sendMessage(src,"~~Server~~: Moderators and above can not be muted.");
- return; }
- if (mcmd[1] == 'forever' || mcmd[1] == 'permanent') {
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was muted forever by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously muted forever!"); }
- sys.saveVal('muted' + sys.ip(tar),1);
- sys.removeVal('mutechk' + sys.ip(tar));
- return; }
- if (mcmd[1] == 0 || mcmd[1] == 'unmute') {
- sys.removeVal('muted' + sys.ip(tar));
- sys.removeVal('mutechk' + sys.ip(tar));
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was unmuted by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously unmuted!"); }
- return; }
- var typeno = 60;
- var typestr = 'minute';
- if (isNaN (mcmd[1]*1) == true) {
- mcmd[1] = 5;
- mcmd[1] = 'm';}
- mcmd[2] =(typeof mcmd[2] == 'undefined')?'m':mcmd[2];
- mcmd[2] = mcmd[2].toLowerCase();
- mcmd[1] = Math.round(Math.abs(mcmd[1]));
- if (mcmd[2] == 's' || mcmd[2] == 'second' || mcmd[2] == 'seconds' || mcmd[2] == 'sec') {
- typeno = 1;
- typestr = 'second';}
- if (mcmd[2] == 'h' || mcmd[2] == 'hour' || mcmd[2] == 'hours' || mcmd[2] == 'hr') {
- typeno = 3600;
- typestr = 'hour';}
- if (mcmd[2] == 'd' || mcmd[2] == 'day' || mcmd[2] == 'days' || mcmd[2] == 'dy') {
- type = 86400;
- typestr = 'day';}
- if (mcmd[2] == 'w' || mcmd[2] == 'week' || mcmd[2] == 'weeks' || mcmd[2] == 'wk') {
- typeno = 604800;
- typestr = 'week';}
- if (mcmd[1] != 1) {
- typestr = typestr + 's' }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was muted for "+mcmd[1]+ ' ' + typestr + " by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously muted for "+mcmd[1]+ ' ' + typestr + "!"); }
- var rnd = sys.rand(1,9999);
- sys.saveVal('mutechk' + sys.ip(tar),rnd);
- 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.'); } ",typeno * mcmd[1]);
- sys.saveVal('muted' + sys.ip(tar),1);
- return; }
- if (command == "unmute" || command == "-m" || command == "demute" || command == "removemute") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was unmuted by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously unmuted!"); }
- sys.removeVal('muted' + sys.ip(tar));
- sys.removeVal('mutechk' + sys.ip(tar),rnd);
- return; }
- /** Ban **/
- if (command == "unban" || command == "removeban" || command == "-b" || command == "deban") {
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + commandData + " was unbanned by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + commandData + " was mysteriously unbanned!"); }
- sys.removeVal('banned' + commandData);
- sys.removeVal('banchk' + commandData);
- return; }
- if (command == "ban" || command == "b") {
- if (tar == undefined) {
- sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1) {
- sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
- return; }
- if (sys.auth(tar) > 0) {
- sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
- return; }
- print((mcmd[1] == 'forever' || mcmd[1] == 'permanent' && sys.auth(src) >= 2 && sys.auth(src) != 4));
- if ((mcmd[1] == 'forever' || mcmd[1] == 'permanent') && sys.auth(src) >= 2 && sys.auth(src) != 4) {
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was banned forever by " + sys.name(src) + "!"); }
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously banned forever!"); }
- sys.saveVal('banned' + sys.ip(tar),1);
- sys.removeVal('banchk' + sys.ip(tar));
- var cnt = numUsers;
- var user = 0;
- while(user < cnt) {
- if (sys.loggedIn(user) == true) {
- if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
- { sys.kick(user);}
- } else {
- cnt += 1;}
- user += 1;
- }
- sys.kick(tar);
- return; }
- var typeno = 3600;
- var typestr = 'hour';
- if ((mcmd[1] == 'forever' || mcmd[1] == 'permanent') && (sys.auth(src) == 1 || sys.auth(src) == 4)) {
- mcmd[1] = 8;
- mcmd[2] = 'h';
- typeno = 3600;
- typestr = 'hour';
- sys.sendMessage(src, "~~Server~~: Error: You entered a time above the maximum for moderators, the time was lowered to 8 hours."); }
- if (isNaN (mcmd[1]*1) == true || mcmd[1] == 0) {
- mcmd[1] = 1;
- mcmd[2] = 'h';}
- mcmd[2] =(typeof mcmd[2] == 'undefined')?'m':mcmd[2];
- mcmd[2] = mcmd[2].toLowerCase();
- mcmd[1] = Math.round(Math.abs(mcmd[1]));
- if (mcmd[2] == 's' || mcmd[2] == 'second' || mcmd[2] == 'seconds' || mcmd[2] == 'sec') {
- typeno = 1;
- typestr = 'second';}
- if (mcmd[2] == 'm' || mcmd[2] == 'minute' || mcmd[2] == 'minutes' || mcmd[2] == 'min') {
- typeno = 60;
- typestr = 'minute';}
- if (mcmd[2] == 'd' || mcmd[2] == 'day' || mcmd[2] == 'days' || mcmd[2] == 'dy') {
- type = 86400;
- typestr = 'day';}
- if (mcmd[2] == 'w' || mcmd[2] == 'week' || mcmd[2] == 'weeks' || mcmd[2] == 'wk') {
- typeno = 604800;
- typestr = 'week';}
- if ((sys.auth(src) == 1 || sys.auth(src) == 4) && typeno*mcmd[1] > 28800) {
- mcmd[1] = 8;
- mcmd[2] = 'h';
- typeno = 3600;
- typestr = 'hour';
- sys.sendMessage(src, "~~Server~~: Error: You entered a time above the maximum for moderators, the time was lowered to 8 hours.");}
- if (mcmd[1] != 1) {
- typestr = typestr + 's' }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + "("+sys.ip(tar)+ ") was banned for "+mcmd[1]+ ' ' + typestr + " by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + "("+sys.ip(tar)+ ") was mysteriously banned for "+mcmd[1]+ ' ' + typestr + "!"); }
- var rnd = sys.rand(1,9999);
- sys.saveVal('banchk' + sys.ip(tar),rnd);
- 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.'); } ",typeno * mcmd[1]);
- sys.saveVal('banned' + sys.ip(tar),1);
- var cnt = numUsers;
- var user = 0;
- while(user < cnt) {
- if (sys.loggedIn(user) == true) {
- if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
- { sys.kick(user);}
- }
- else {
- cnt += 1;}
- user += 1;
- }
- sys.kick(tar);
- return; }
- /** Kick **/
- if (command == "kick" || command == "k") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
- return; }
- if (sys.auth(tar) > 0)
- {sys.sendMessage(src,"~~Server~~: Moderators and above can not be kicked.");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was kicked by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously kicked!"); }
- sys.kick(tar);
- return; }
- if (command == "superkick") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
- return; }
- if (sys.auth(tar) > 0)
- {sys.sendMessage(src,"~~Server~~: Moderators and above can not be kicked.");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was kicked by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously kicked!"); }
- sys.kick(tar);
- var cnt = numUsers;
- var user = 0;
- while(user < cnt)
- {if (sys.loggedIn(user) == true) {
- if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
- { sys.kick(user);}
- } else {
- cnt += 1;}
- user += 1;
- }
- return; }
- /** Hush **/
- if (command == "hush" || command == "h") {
- if (typeof restrict != 'undefined') {
- sys.sendMessage(src,'~~Server~~: The server is already restricted, to hush the chat first derestrict the server.');
- return; }
- hush = 1;
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: The chat has been hushed by " + sys.name(src) + "!");} else { sys.sendAll("~~Server~~: The chat has been mysteriously hushed!"); }
- return; }
- if (command == "unhush" || command == "-h" || command == "dehush") {
- if (typeof restrict != 'undefined') {
- sys.sendMessage(src,'~~Server~~: The server is already restricted, to hush the chat first derestrict the server.');
- return; }
- hush = undefined;
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: The chat has been unhushed by " + sys.name(src) + "!");} else { sys.sendAll("~~Server~~: The chat has been mysteriously unhushed!"); }
- return; }
- /** Stop **/
- if (command == "stop" || command == "s") {
- stop = 1;
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: The battles have been stoped by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: The battles have been mysteriously stoped!"); }
- return; }
- if (command == "unstop" || command == "destop" || command == "-s") {
- stop = undefined;
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: The battles have been resumed by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: The battles have been mysteriously resumed!"); }
- return; }
- /** Invisibillity **/
- if (command == "invisible" && sys.auth(src) == 1) {
- sys.sendMessage(src,'~~Server~~: You are now in invisible mode!');
- sys.changeAuth(src,4);
- return; }
- if (command == "visible" && sys.auth(src) == 4) {
- sys.sendMessage(src,'~~Server~~: You are no longer in invisible mode!');
- sys.changeAuth(src,1);
- return; }
- if (command == "invisible" && sys.auth(src) == 2) {
- sys.sendMessage(src,'~~Server~~: You are now in invisible mode!');
- sys.changeAuth(src,5);
- return; }
- if (command == "visible" && sys.auth(src) == 5) {
- sys.sendMessage(src,'~~Server~~: You are no longer in invisible mode!');
- sys.changeAuth(src,2);
- return; }
- if (command == "invisible" && sys.auth(src) == 3) {
- sys.sendMessage(src,'~~Server~~: You are now in invisible mode!');
- sys.changeAuth(src,6);
- return; }
- if (command == "visible" && sys.auth(src) == 6) {
- sys.sendMessage(src,'~~Server~~: You are no longer in invisible mode!');
- sys.changeAuth(src,3);
- return; }
- /** Lutra Tournmant Script **/
- if (command == "tour" || command == "newtour" || command == "createtour"){
- if (tourmode != 0){
- sys.sendMessage(src, "~~Server~~: Sorry, you are unable to start a tournament because one is still currently running.");
- return; }
- tourtier = mcmd[0].toLowerCase();
- tourcount = parseInt(mcmd[1]);
- if (isNaN(tourcount) || tourcount <= 2){
- sys.sendMessage(src, "~~Server~~ You must specify a tournament size of 3 or more.");
- return; }
- var tier = sys.getTierList().toLowerCase().split('\n');
- if (tier.indexOf(tourtier) == -1){
- sys.sendMessage(src, "~~Server~~: Sorry, the server does not recognise the " + mcmd[0] + " tier.");
- return; }
- tourmode = 1;
- tournumber = tourcount;
- tourcurrentnumber = tournumber;
- tourmembers = new Array();
- tourbattlers = new Array();
- tourlosers = new Array();
- tourdisplayversion = 1;
- this.tourdisplay();
- return; }
- if (command == "endtour") {
- if (tourmode == 0){
- sys.sendMessage(src, "Sorry, you are unable to end a tournament because one is not currently running.");
- return;}
- tourmode = 0;
- sys.sendAll("~~Server~~: The tournament has been cancelled.");
- return; }
- if (command == "dq"){
- if (tourmode == 0){
- sys.sendMessage(src, "You are unable to disqualify players because a tournament is not currently running.");
- return; }
- var dqtrgt = mcmd[0].toLowerCase();
- for (var tourmembersname in tourmembers){
- if(tourmembers[tourmembersname].toLowerCase() === dqtrgt){
- var dqbattler = tourmembers[tourmembersname];}
- }
- if (dqbattler === undefined){
- sys.sendMessage(src, "You are unable to disqualify the targeted player because they are not in the tournament.");
- return; }
- var undqbattler;
- if (tourmembers.indexOf(dqbattler) % 2 == 0){
- undqbattler = tourmembers[tourmembers.indexOf(dqbattler)+1]; }
- if (tourmembers.indexOf(dqbattler) % 2 == 1){
- undqbattler = tourmembers[tourmembers.indexOf(dqbattler)-1]; }
- for (var tourlosersindex in tourlosers){
- if (tourlosers[tourlosersindex] == dqtrgt){
- sys.sendMessage(src, "You are unable to disqualify the targeted player because they have already lost in this round.");
- return; }
- }
- if (tourmode == 1){
- tourcount++;
- tourmembers.splice(tourmembers.indexOf(dqbattler),1)
- sys.sendAll(dqbattler + " was removed from the tournament! " + tourcount + " more spot(s) left!");
- return;}
- sys.sendAll("~~Server~~: " + dqbattler + " has been disqualified!");
- this.roundincrease(undqbattler,dqbattler);
- return;}
- /** Admin stuff **/
- if (command == "debug" ) {
- /** Use with caution!! Make sure there are no pending connections! **/
- print('Debug init('+numUsers+')');
- numUsers = sys.numPlayers();
- print('Debug complete('+numUsers+')');
- return; }
- if (sys.auth(src) < 2 || sys.auth(src) == 4)
- {sys.sendMessage(src, "~~Server~~: The command " + command + " can not be used by moderators or does not exist.");
- return; }
- /** Password **/
- if (command == "setpass" || command == "setpassword") {
- password[src] = commandData;
- serverpass = commandData;
- if (sys.auth(src) <= 3) {
- sys.sendAll('~~Server~~: The password was changed by '+sys.name(src)+', please enter the password using /pass password.'); }
- else
- { sys.sendAll('~~Server~~: The password was mysteriously changed, please enter the password using /pass password.'); }
- return; }
- if (command == "removepass" || command == "removepassword") {
- sys.removeVal('pass:'+sys.name(src));
- password[src] = '';
- serverpass = '';
- if (sys.auth(src) <= 3) {
- sys.sendAll('~~Server~~: The password was removed by '+sys.name(src)+'.'); }
- else
- { sys.sendAll('~~Server~~: The password was mysteriously removed.'); }
- return; }
- /** Protects **/
- if (command == "protect" || command == "p") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.auth(tar) > 0)
- {sys.sendMessage(src,"~~Server~~: Moderators and above do not need protection.");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was protected by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously protected!"); }
- sys.saveVal('protected' + sys.ip(tar),1);
- sys.removeVal('muted' + sys.ip(tar));
- sys.removeVal('banned' + sys.ip(tar));
- sys.removeVal('mutechk' + sys.ip(tar));
- sys.removeVal('banchk' + sys.ip(tar));
- return; }
- if (command == "deprotect" || command == "unprotect" || command == "-p") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was deprotected by " + sys.name(src) + "!"); } else { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously deprotected!"); }
- sys.removeVal('protected' + sys.ip(tar));
- return; }
- /** Restrict **/
- if (command == "restrict" || command == "r") {
- restrict = 1;
- hush = undefined;
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: The server has been restricted by " + sys.name(src) + "!"); } else {sys.sendAll("~~Server~~: The server has been mysteriously restricted!"); }
- var cnt = numUsers;
- var user = 0;
- while(user < cnt)
- {if (sys.loggedIn(user) == true) {
- if (sys.auth(user) < 1) {
- sys.sendMessage(user,'~~Server~~: You are not staff and therefore have been kicked as the server has been restricted.');
- sys.kick(user); }
- }
- else {
- cnt += 1;}
- user += 1; }
- return; }
- if (command == "derestrict" || command == "-r" || command == "unrestrict") {
- restrict = undefined;
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: The server has been derestricted by " + sys.name(src) + "!"); } else {sys.sendAll("~~Server~~: The server has been mysteriously derestricted!"); }
- return; }
- /** Auth **/
- if (command == "auth" || command == "a") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.auth(tar) >= 2 && sys.auth(tar) != 4)
- {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was given moderator by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously given moderator!"); }
- sys.changeAuth(tar,1);
- return; }
- if (command == "deauth" || command == "-a") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.auth(tar) >= 2 && sys.auth(tar) != 4)
- {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " had moderator removed by " + sys.name(src) + "!");}
- else
- {sys.sendAll("~~Server~~: " + sys.name(tar) + " mysterioulsy had moderator removed!"); }
- sys.changeAuth(tar,0);
- return; }
- /** Silent Commands(admin) **/
- if (command == "s-unmute") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.auth(tar) >= 1)
- {sys.sendMessage("~~Server~~: You dont have sufficient auth to unmute " + sys.name(tar)+ ".");
- return; }
- this.unmute(tar);
- print(sys.name(tar) + " was silently unmuted by " + sys.name(src) + ".");
- return; }
- if (command == "s-unban") {
- sys.removeVal('banned' + commandData);
- print(sys.name(tar) + " was silently unbanned by " + sys.name(src) + ".");
- sys.removeVal('banchk' + commandData);
- return; }
- if (command == "s-kick") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be kicked.");
- return; }
- if (sys.auth(tar) >= 1)
- {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to block " + sys.name(tar) + ".");
- return; }
- sys.kick(tar);
- print(sys.name(tar) + " was silently kicked by " + sys.name(src) + ".");
- return; }
- if (command == "s-mute") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be muted.");
- return; }
- if (sys.auth(tar) >= 1)
- {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to mute " + sys.name(tar) + ".");
- return; }
- print(sys.name(tar) + " was silently muted by " + sys.name(src) + ".");
- sys.saveVal('muted' + sys.ip(tar),1);
- sys.removeVal('mutechk' + sys.ip(tar));
- return; }
- if (command == "s-ban") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined");
- return; }
- if (sys.getVal('protected' + sys.ip(tar)) == 1)
- {sys.sendMessage(src,"~~Server~~: " + sys.name(tar) + " is protected and can not be banned.");
- return; }
- if (sys.auth(tar) > 0)
- {sys.sendMessage(src,"~~Server~~: Moderators and above can not be banned.");
- return; }
- print(sys.name(tar) + " was silently banned by " + sys.name(src) + ".");
- var rnd = sys.rand(1,99999999);
- sys.saveVal('banned' + sys.ip(tar),1);
- sys.saveVal('banchk' + sys.ip(tar),rnd);
- 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);
- var cnt = numUsers;
- var user = 0;
- while(user < cnt)
- {if (sys.loggedIn(user) == true) {
- if (sys.ip(tar) == sys.ip(user) && sys.auth(user) < 1)
- { sys.kick(user);}
- } else {
- cnt += 1;}
- user += 1;
- }
- sys.kick(tar);
- return; }
- if (sys.auth(src) != 3 && sys.auth(src) != 6)
- {sys.sendMessage(src, "~~Server~~: The command " + command + " can not be used by admins or does not exist.");
- return; }
- /** Master Commands **/
- if (command == "admin" || command == "*") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.auth(tar) >= 2 && sys.auth(tar) != 4)
- {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " was given admin by " + sys.name(src) + "!");}
- else
- { sys.sendAll("~~Server~~: " + sys.name(tar) + " was mysteriously given admin!"); }
- sys.changeAuth(tar,1);
- return; }
- if (command == "deadmin" || command == "-*") {
- if (tar == undefined)
- {sys.sendMessage(src, "~~Server~~: Error: Target is undefined.");
- return; }
- if (sys.auth(tar) == 3 || sys.auth(tar) == 6)
- {sys.sendMessage(src,"~~Server~~: You dont have sufficient auth to auth " + sys.name(tar) + ".");
- return; }
- if (sys.auth(src) <= 3) {
- sys.sendAll("~~Server~~: " + sys.name(tar) + " had admin removed by " + sys.name(src) + "!");}
- else
- {sys.sendAll("~~Server~~: " + sys.name(tar) + " mysterioulsy had admin removed!"); }
- sys.changeAuth(tar,1);
- return; }
- sys.sendMessage(src, "~~Server~~: The command " + command + " does not exist.");
- return;
- }
- }
- ,
- /** Lutra Functions **/
- sendmessage: function (str) {
- return sys.sendMessage(receiver, str); }
- ,
- tourdisplay: function (){
- var send;
- tourdisplayversion == 0 ? send = this.sendmessage : send = sys.sendAll;
- send("~~Server~~: A Tournament has started! Type /join or !join to enter the tournament! ");
- send("~~Server~~: PLAYERS: " + tournumber);
- send("~~Server~~: TYPE: SINGLE ELIMINATION");
- send("~~Server~~: TIER : " + tourtier.toUpperCase());
- tourdisplayversion = 0; }
- ,
- roundincrease: function (winnername, losername){
- tourlosers.push(losername);
- var tourloser = tourbattlers.indexOf(losername);
- tourbattlers.splice(tourloser,1);
- var tourwinner = tourbattlers.indexOf(winnername);
- tourbattlers.splice(tourwinner,1);
- tourbattles++;
- if (winnername != "*bye"){
- sys.sendAll('~~Server~~: '+winnername + " advances to the next round:");
- }
- sys.sendAll('~~Server~~: '+losername + " is out of the tournament.");
- if (Math.floor(tourcurrentnumber/2) != tourbattles){
- sys.sendAll("~~Server~~: " + Math.floor(tourcurrentnumber/2 - tourbattles) + " more match(es) to be completed in this round!");}
- if (tourcurrentnumber == 2){
- tourmode = 0;
- sys.sendAll("~~Server~~: THE WINNER OF THE TOURNAMENT IS : " + winnername);
- sys.sendAll("~~Server~~: Congratulations, " + winnername + ", on your success!");
- return;}
- if (Math.floor(tourcurrentnumber/2) == tourbattles){
- if (tourmembers[tourcurrentnumber] == "*bye"){
- tourmembers.splice(tourcurrentnumber,1); }
- tourcurrentnumber = Math.ceil(tourcurrentnumber/2);
- if (tourcurrentnumber == 2 && winnername == "*bye"){
- tourbattles--;
- return;}
- this.roundpairing(); }
- }
- ,
- roundpairing: function(){
- tourbattles = 0;
- while (0 in tourlosers){
- tourmembers.splice(tourmembers.indexOf(tourlosers[0]),1);
- tourlosers.splice(0,1);}
- roundnumber++;
- rounddisplayversion = 1;
- this.shufflefunct(tourmembers);
- this.rounddisplay();
- if (tourmembers.length % 2 == 1){
- tourmembers.push("*bye");
- sys.sendAll("*** " + tourmembers[tourcurrentnumber-1] + " is randomly selected to go through to the next round!");}
- }
- ,
- shufflefunct: function (myarray) {
- var i = myarray.length;
- if(i == 0) return false;
- while(--i){
- var j = Math.floor(Math.random()*(i + 1));
- var tempi = myarray[i];
- var tempj = myarray[j];
- myarray[i] = tempj;
- myarray[j] = tempi;}
- }
- ,
- tourbattleend : function(winnername, losername){
- if (tourbattlers.indexOf(losername) in tourbattlers && tourlosers.indexOf(losername) == -1 && tourlosers.indexOf(winnername) == -1){
- sys.sendAll("~~Server~~: A tournament match has been completed!");
- this.roundincrease(winnername, losername);}
- }
- ,
- rounddisplay: function(){
- var send;
- rounddisplayversion == 0 ? send = this.sendmessage : send = sys.sendAll;
- var roundstring;
- tourcurrentnumber == 2 ? roundstring = "~~Server~~: Final Round !" : roundstring = "~~Server~~: Round " + roundnumber + " !"
- send(roundstring);
- for (var tourmembersindex = 0 ; tourmembersindex < tourcurrentnumber-rounddisplayversion; tourmembersindex+=2){
- var tourspotone;
- var tourspottwo;
- tourlosers.indexOf(tourmembers[tourmembersindex+1]) in tourlosers ? tourspotone = "(" + tourmembers[tourmembersindex] + ")" : tourspotone = tourmembers[tourmembersindex];
- tourlosers.indexOf(tourmembers[tourmembersindex]) in tourlosers ? tourspottwo = "(" + tourmembers[tourmembersindex+1] + ")" : tourspottwo = tourmembers[tourmembersindex+1];
- var tourspotspace = 20 - tourspotone.length;
- do {
- tourspotone = " " + tourspotone;
- tourspotspace--;
- }
- while (tourspotspace > 0);
- send(tourspotone + " VS " + tourspottwo);
- }
- rounddisplayversion = 0;
- }
- ,
- /** end **/
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement