racer g.city
pkmn
({ afterLogIn : function(source) { sys.sendMessage(source, "Bot: Hello, " + sys.name(source) + "!"); } }) Bot: Hello, XianLao! ({ afterLogIn : function(source) { sys.sendMessage(source, "Bot: Hello, " + sys.name(source) + "!"); } , beforeLogOut : function(source) { sys.sendMessage(source, "Bot: Bye, " + sys.name(source) + "!"); } }) ({ serverStartUp : function() { this.init(); } , init : function() { key = function(a,b) { return a + "*" + sys.name(b); } hasBan = function(id, poke) { return clauses[id].indexOf("*" + poke + "*") != -1; } if (typeof (clauses) == "undefined") { clauses = []; } if (typeof (clauseOn) == "undefined") { clauseOn = []; } if (typeof(impersonation) == "undefined") { sys.setPA ("impersonation"); } if (typeof(muted) == "undefined") { sys.setPA ("muted"); } if (typeof(maxPlayersOnline) == "undefined") { maxPlayersOnline = 0; } /* For little cup */ if (typeof(lilCupLevels) == "undefined") lilCupLevels = []; } , afterNewMessage : function (message) { if (message == "Script Check: OK") { sys.sendAll("ScriptBot: Scripts were updated!"); this.init(); } } , afterLogIn : function(src) { sys.sendMessage(src, "+CommandBot: Use !commands to see the commands!"); if (sys.getVal("muted*" + sys.ip(src)) == "true") muted[src] = true; if (sys.numPlayers() > maxPlayersOnline) { maxPlayersOnline = sys.numPlayers(); } if (maxPlayersOnline > sys.getVal("MaxPlayersOnline")) { sys.saveVal("MaxPlayersOnline", maxPlayersOnline); } sys.sendMessage(src, "+CountBot: Max number of players online was " + sys.getVal("MaxPlayersOnline") + "."); sys.sendMessage(src, ""); this.afterChangeTeam(src); } , afterChangeTeam : function(src) { clauseOn[src] = sys.getVal("clauseOn*" + sys.name(src)) == "true"; clauses[src] = sys.getVal("clauses*" + sys.name(src)); } , beforeChatMessage: function(src, message) { if (sys.auth(src) < 2 && muted[src] == true) { sys.stopEvent(); sys.sendMessage(src, "Bot: you are muted!"); return; } if ((message[0] == '/' || message[0] == '!') && message.length > 1) { print("Command -- " + sys.name(src) + ": " + message); sys.stopEvent(); var command; var commandData; var pos = message.indexOf(' '); if (pos != -1) { command = message.substring(1, pos).toLowerCase(); commandData = message.substr(pos+1); } else { command = message.substr(1).toLowerCase(); } var tar = sys.id(commandData); if (command == "commands" || command == "command") { sys.sendMessage(src, ""); sys.sendMessage(src, "*** Commands ***"); sys.sendMessage(src, "/me [message]: to speak with *** before its name"); sys.sendMessage(src, "/players: to get the number of players online"); if (clauseOn[src]) sys.sendMessage(src, "*** You have pokemon clausing on ***"); else sys.sendMessage(src, "*** You have pokemon clausing off ***"); sys.sendMessage(src, "/on: to turn on your pokemon clausing"); sys.sendMessage(src, "/off: to turn off your pokemon clausing"); sys.sendMessage(src, "/no [pokemon]: to clause that pokemon"); sys.sendMessage(src, "/allow [pokemon]: to allow that pokemon"); sys.sendMessage(src, "/list: to list the pokemons you ban"); sys.sendMessage(src, "/clear: to clear the list of your pokemon bans"); if (sys.auth(src) < 1) return; sys.sendMessage(src, "*** Mod Commands ***"); sys.sendMessage(src, "/imp [person] : to impersonate someone"); sys.sendMessage(src, "/impOff : to stop impersonating."); sys.sendMessage(src, "/sendAll [message] : to send a message to everyone."); sys.sendMessage(src, "/k [person] : to kick someone"); sys.sendMessage(src, "/[mute/unmute] [person] : You know what i mean :p."); if (sys.auth(src) < 2) return; sys.sendMessage(src, "*** Admin Commands ***"); sys.sendMessage(src, "/reset: to reset the server variables (useful when you add a new script)"); sys.sendMessage(src, "/masskick: to clean up the server"); sys.sendMessage(src, "/changeAuth [auth] [person]: to play the mega admin"); sys.sendMessage(src, "/setPA paname: to add a new pa, use with scripting caution"); return; } if (command == "me") { sys.sendAll("*** " + sys.name(src) + " " + commandData); return; } if (command == "players") { sys.sendMessage(src, "CountBot: There are " + sys.numPlayers() + " players online."); return; } if (command == "off") { sys.sendMessage(src, "ClauseBot: You don't ban any pokémons anymore!"); sys.saveVal(key("clauseOn",src), false); clauseOn[src] = false; return; } if (command == "on") { sys.sendMessage(src, "ClauseBot: You turned the pokémon bans on!"); sys.saveVal(key("clauseOn",src), true); clauseOn[src] = true; return; } if (command == "no") { pokenum = sys.pokeNum(commandData); if (pokenum == undefined) { sys.sendMessage(src, "ClauseBot: -" + commandData + "- doesn't exist as a pokémon."); return; } if (hasBan(src, pokenum)) { sys.sendMessage(src, "ClauseBot: you already ban " + commandData + "."); return; } clauses[src] += "*" + pokenum + "*"; sys.saveVal(key("clauses", src), clauses[src]); sys.sendMessage(src, "ClauseBot: you now ban " + commandData); return; } if (command == "allow") { var pokenum = sys.pokeNum(commandData); if (pokenum == undefined) { sys.sendMessage(src, "ClauseBot: -" + commandData + "- doesn't exist as a pokémon."); return; } if (!hasBan(src, pokenum)) { sys.sendMessage(src, "ClauseBot: you already don't ban " + commandData + "."); return; } var pos = clauses[src].indexOf("*"+pokenum+"*"); clauses[src] = clauses[src].substring(0, pos) + clauses[src].substr(pos+("*"+pokenum+"*").length); sys.saveVal(key("clauses", src), clauses[src]); sys.sendMessage(src, "ClauseBot: you now allow " + commandData); return; } if (command == "clear") { clauses[src] = ""; sys.sendMessage(src, "ClauseBot: Your ban list was cleared!"); return; } if (command == "list") { sys.sendMessage(src, ""); sys.sendMessage(src, "ClauseBot: Here is what you ban: "); for (var i = 1; i + 2 < clauses[src].length ; ) { var pos = clauses[src].indexOf('*',i); if (pos == -1) break; sys.sendMessage(src, "Pokémon: " + sys.pokemon(clauses[src].substring(i, pos))); i = pos+2; } return; } if (command == "debug") { sys.sendMessage(src, clauses[src]); return; } /** Moderator Commands **/ if (sys.auth(src) < 1) { sys.sendMessage(src, "CommandBot: The command " + command + " doesn't exist"); return; } if (command == "imp") { impersonation[src] = commandData; sys.sendMessage(src, "Bot: Now you are " + impersonation[src] + "!"); return; } if (command == "impoff") { delete impersonation[src]; sys.sendMessage(src, "Bot: Now you are yourself!"); return; } if (command == "sendall") { sys.sendAll(commandData); return; } if (command == "k") { if (tar == undefined) { return; } sys.sendAll("Bot: " + commandData + " was mysteriously kicked by " + sys.name(src) + "!"); sys.kick(tar); return; } if (command == "mute") { if (tar == undefined) { return; } if (sys.auth(tar) >= sys.auth(src)) { sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + "."); return; } sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!"); muted[tar] = true; return } if (command == "unmute") { if (tar == undefined) { return; } sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!"); muted[tar] = false; return; } if (sys.auth(src) < 2) { return; } /** Admin Commands **/ if (command == "reset") { this.serverStartUp(); sys.sendAll("+Server: The server script variables were reset."); return; } if (command == "masskick") { for (var i = 1; i < 200 && sys.numPlayers() > 0; i++) { if (sys.loggedIn(i)) { sys.kick(i); } } return; } if (command == "setpa") { sys.setPA(commandData); sys.sendMessage(src, "Bot: -" + commandData + "- was set!"); return; } if (command == "changeauth") { var pos = commandData.indexOf(' '); if (pos == -1) { return; } var newauth = commandData.substring(0, pos); var tar = sys.id(commandData.substr(pos+1)); sys.changeAuth(tar, newauth); sys.sendAll("Bot: " + sys.name(src) + " changed auth of " + sys.name(tar) + " to " + newauth); return; } return; } if (typeof impersonation[src] != 'undefined') { sys.stopEvent(); sys.sendAll(impersonation[src] + ": " + message); return; } } , beforeChallengeIssued : function (src, dest, clauses) { /* Challenge Cup Clause */ if (clauses[7] == 1) return; if (clauseOn[dest] == true) { for (var i = 0; i < 6; i++) { if (hasBan(dest, sys.teamPoke(src,i))) { sys.sendMessage(src, "ClauseBot: Your opponent is afraid of " + sys.pokemon(sys.teamPoke(src,i))); sys.stopEvent(); return; } } } if (clauseOn[src] == true) { for (var i = 0; i < 6; i++) { if (hasBan(src, sys.teamPoke(dest,i))) { sys.sendMessage(src, "ClauseBot: You are afraid of some pokemon of the opponent, so I won't let you challenge them."); sys.stopEvent(); return; } } } /* Regular tier checks that can't be made using the built-in server tier system */ if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup") { if (sys.hasTeamMove(src, sys.moveNum("SonicBoom")) || sys.hasTeamMove(src, sys.moveNum("Dragon Rage"))) { sys.sendMessage(src, "+Bot: SonicBoom and Dragon Rage are banned in Little Cup!"); sys.stopEvent(); } if (sys.hasTeamMove(dest, sys.moveNum("SonicBoom")) || sys.hasTeamMove(dest, sys.moveNum("Dragon Rage"))) { sys.sendMessage(src, "+Bot: Your opponent has banned moves SonicBoom or Dragon Rage in Little Cup tier!"); sys.stopEvent(); } if (sys.hasTeamItem(src, sys.itemNum("Berry Juice"))) { sys.sendMessage(src, "+Bot: Berry Juice is banned in Little Cup!"); sys.stopEvent(); } if (sys.hasTeamItem(dest, sys.itemNum("Berry Juice"))) { sys.sendMessage(src, "+Bot: Berry Juice is banned in Little Cup and your opponent has it!"); sys.stopEvent(); } } } , beforeBattleMatchup : function(src,dest,clauses) { if (clauseOn[dest] == true) { for (var i = 0; i < 6; i++) { if (hasBan(dest, sys.teamPoke(src,i))) { sys.stopEvent(); return; } } } if (clauseOn[src] == true) { for (var i = 0; i < 6; i++) { if (hasBan(src, sys.teamPoke(dest,i))) { sys.stopEvent(); return; } } } /* Regular tier checks that can't be made using the built-in server tier system */ if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup") { if (sys.hasTeamMove(src, sys.moveNum("SonicBoom")) || sys.hasTeamMove(src, sys.moveNum("Dragon Rage"))) { sys.stopEvent(); } if (sys.hasTeamMove(dest, sys.moveNum("SonicBoom")) || sys.hasTeamMove(dest, sys.moveNum("Dragon Rage"))) { sys.stopEvent(); } if (sys.hasTeamItem(src, sys.itemNum("Berry Juice"))) { sys.stopEvent(); } if (sys.hasTeamItem(dest, sys.itemNum("Berry Juice"))) { sys.stopEvent(); } } } , beforeBattleStarted : function(src, dest) { /* If this is little cup, the levels are changed to be level 5 */ if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup") { lilCupLevels[src] = [sys.teamPokeLevel(src, 0), sys.teamPokeLevel(src, 1), sys.teamPokeLevel(src, 2), sys.teamPokeLevel(src, 3), sys.teamPokeLevel(src, 4), sys.teamPokeLevel(src, 5)]; lilCupLevels[dest] = [sys.teamPokeLevel(dest, 0), sys.teamPokeLevel(dest, 1), sys.teamPokeLevel(dest, 2), sys.teamPokeLevel(dest, 3), sys.teamPokeLevel(dest, 4), sys.teamPokeLevel(dest, 5)]; for (var i = 0; i < 6; i+=1) { if (sys.teamPokeLevel(src, i) > 5) sys.changePokeLevel(src, i, 5); if (sys.teamPokeLevel(dest, i) > 5) sys.changePokeLevel(dest, i, 5); } } } , afterBattleEnded: function(src, dest) { /* If this is little cup, the levels are to be changed back! */ if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup" && lilCupLevels[src] != undefined && lilCupLevels[dest] != undefined) { for (var i = 0; i < 6; i+=1) { if (sys.teamPokeLevel(src, i) != lilCupLevels[src][i]) sys.changePokeLevel(src, i, lilCupLevels[src][i]); if (sys.teamPokeLevel(dest, i) != lilCupLevels[dest][i]) sys.changePokeLevel(dest, i, lilCupLevels[dest][i]); } } } , beforeLogOut : function (src) { if (muted[src] == true) { sys.saveVal("muted*" + sys.ip(src), "true"); } else { sys.removeVal("muted*" + sys.ip(src)); } } })Bugün 15 ziyaretçi (19 klik) kişi burdaydı!