Guest User

Untitled

a guest
Oct 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.04 KB | None | 0 0
  1. ({
  2.  
  3. serverStartUp : function() {
  4. this.init();
  5. }
  6. ,
  7.  
  8. init : function() {
  9. key = function(a,b) {
  10. return a + "*" + sys.name(b);
  11. }
  12.  
  13. hasBan = function(id, poke) {
  14. return clauses[id].indexOf("*" + poke + "*") != -1;
  15. }
  16.  
  17. if (typeof (clauses) == "undefined") {
  18. clauses = [];
  19. }
  20.  
  21. if (typeof (clauseOn) == "undefined") {
  22. clauseOn = [];
  23. }
  24.  
  25. if (typeof(impersonation) == "undefined") {
  26. sys.setPA ("impersonation");
  27. }
  28.  
  29. if (typeof(muted) == "undefined") {
  30. sys.setPA ("muted");
  31. }
  32.  
  33. if (typeof(maxPlayersOnline) == "undefined") {
  34. maxPlayersOnline = 0;
  35. }
  36.  
  37. /* For little cup */
  38. if (typeof(lilCupLevels) == "undefined")
  39. lilCupLevels = [];
  40. }
  41.  
  42. ,
  43.  
  44. afterNewMessage : function (message) {
  45. if (message == "Script Check: OK") {
  46. sys.sendHtmlAll("<font color=red>+<b><i>Gallade</i></f></b>:<font color=Red><b>The scripts were updated by PirateJake92!<b>");
  47. this.init();
  48. }
  49. }
  50.  
  51. ,
  52.  
  53. afterLogIn : function(src) {
  54. sys.sendHtmlMessage(src, "<i><font color=gold><b>Pikachu:</i> Use <i>/commands</i> to see the Poke Star commands!");
  55. sys.sendHtmlMessage(src, "<i><font color=red><b>Gallade:</i> Credit for there scripts go to Zerogravity.");
  56. sys.sendHtmlMessage(src, "<i><font color=brown><b>Eevee:</i> Welcome to Poke Star, " + sys.name(src) + "!");
  57. if (sys.getVal("muted*" + sys.ip(src)) == "true")
  58. muted[src] = true;
  59.  
  60. if (sys.numPlayers() > maxPlayersOnline) {
  61. maxPlayersOnline = sys.numPlayers();
  62. }
  63.  
  64. if (maxPlayersOnline > sys.getVal("MaxPlayersOnline")) {
  65. sys.saveVal("MaxPlayersOnline", maxPlayersOnline);
  66. }
  67.  
  68. sys.sendHtmlMessage(src, "<font color=purple><b><i>Victini:</i> Max number of players online on Poke Star was " + sys.getVal("MaxPlayersOnline") + ".");
  69. sys.sendMessage(src, "");
  70.  
  71. this.afterChangeTeam(src);
  72. }
  73.  
  74. ,
  75.  
  76.  
  77. afterChangeTeam : function(src)
  78. {
  79. clauseOn[src] = sys.getVal("clauseOn*" + sys.name(src)) == "true";
  80. clauses[src] = sys.getVal("clauses*" + sys.name(src));
  81. }
  82.  
  83. ,
  84. beforeChatMessage: function(src, message) {
  85. if (sys.auth(src) < 2 && muted[src] == true) {
  86. sys.stopEvent();
  87. sys.sendhtmlMessage(src, "<font color=purple<i>Victini</i></f> <b>you are muted</b> so you cant talk :P !");
  88. return;
  89. }
  90. if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
  91. print("Command -- " + sys.name(src) + ": " + message);
  92. sys.stopEvent();
  93. var command;
  94. var commandData;
  95. var pos = message.indexOf(' ');
  96.  
  97. if (pos != -1) {
  98. command = message.substring(1, pos).toLowerCase();
  99. commandData = message.substr(pos+1);
  100. } else {
  101. command = message.substr(1).toLowerCase();
  102. }
  103. var tar = sys.id(commandData);
  104.  
  105. if (command == "usercommands" || command == "usercommand") {
  106. sys.sendMessage(src, "");
  107. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f></b>");
  108. sys.sendHtmlMessage(src, "<timestamp/><font color=blue><b><font size=5>***</f><font color=yellow> <font size=5>User Commands</f><font color=blue> <font size=5>***</f>");
  109. sys.sendHtmlMessage(src, "<timestamp/><font color=purple><b>/me [message]</b></f>: <font color=black>to speak with *** before its name</f>");
  110. sys.sendHtmlMessage(src, "<timestamp/><font color=purple><b>/auth</b></f>: <font color=black>to show the authlist</f>");
  111. sys.sendHtmlMessage(src, "<timestamp/><font color=purple><b>/league</b></f>: <font color=black>to show the server league</f>");
  112. sys.sendHtmlMessage(src, "<timestamp/><font color=purple><b>/rules</b></f>: <font color=black>to show the rules</f>");
  113. sys.sendHtmlMessage(src, "<timestamp/><font color=purple><b>/players</f></b>: <font color=black>to get the number of players online");
  114. sys.sendHtmlMessage(src, "<timestamp/><font color=purple><b>/viewjournal</b></f>: <font color=black>to view the book of wonderful comments");
  115. sys.sendHtmlMessage(src, "<timestamp/><font color=purple><b>/signjournal [quote]</b></f>: <font color=black>be apart of the wonderful journal!");
  116. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>/updates</b></f>: <font color=black>view the updates done since the first version");
  117. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f></b>");
  118. return;
  119. }
  120. if (command == "modcommands" || command == "modcommand") {
  121. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f></b>");
  122. sys.sendHtmlMessage(src, "<timestamp/><font color=orange><b><font size=6>*** </f><font color=red><font size=6>Mod Commands </f><font color=Orange><font size=6> ***");
  123. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/imp [person]</f></b> : <font color=black>to impersonate someone");
  124. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/impOff</f></b> : <font color=black>to stop impersonating.");
  125. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/sendAll [message]</f></b> : <font color=black>to send a message to everyone.");
  126. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/sendHtmlAll [message]</f></b> : <font color=black>to send a message to everyone using HTML.");
  127. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/k [person]</f></b> :<font color=black> to kick someone");
  128. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/[mute/unmute] [person]</f></b> : <font color=black>To mute or unmute someone.");
  129. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/protect</f></b> : <font color=black>to protect a user from mutes, bans, or kicks");
  130. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f></b>");
  131. return;
  132. }
  133. if (command == "commands" || command == "command") {
  134. sys.sendHtmlMessage(src, "<timestamp/><font color=pink><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f>");
  135. sys.sendHtmlMessage(src, "<timestamp/><font color=cornflowerblue><b><i><font size=4>*** Commands ***<f>");
  136. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b>/usercommands</f></b>: <font color=black>for users");
  137. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>/modcommands</f></b>: <font color=black>for moderators");
  138. sys.sendHtmlMessage(src, "<timestamp/><font color=blue><b>/admincommands</f></b>: <font color=black>for administrators");
  139. sys.sendHtmlMessage(src, "<timestamp/><font color=gold><b>/ownercommands</f></b>: <font color=black>for owners");
  140. sys.sendHtmlMessage(src, "<timestamp/><font color=pink><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f>");
  141. return;
  142. }
  143. if (command == "admincommands" || command == "admincommand") {
  144. sys.sendHtmlMessage(src, "<timestamp/><font color=yellow><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f>");
  145. sys.sendHtmlMessage(src, "<timestamp/><font color=gold><b><font size=7>***</f><font color=blue> Admin Commands</f> <font color=gold>***</f>");
  146. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>/reset</f></b>: <font color=black>to reset the server variables");
  147. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>/masskick</f></b>: <font color=black>to clean up the server");
  148. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>/setPA paname</f></b>: <font color=black>to add a new pa");
  149. sys.sendHtmlMessage(src, "<timestamp/><font color=red><b>/clearjournal</f></b>: <font color=black>to clear the journal");
  150. sys.sendHtmlMessage(src, "<timestamp/><font color=yellow><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f>");
  151. return;
  152. }
  153. if (command == "ownercommands" || command == "ownercommand") {
  154. sys.sendHtmlMessage(src, "<timestamp/><font color=blue><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f>");
  155. sys.sendHtmlMessage(src, "<timestamp/><font color=green><b><font size=10>***</f> <font color=gold>Owner Commands </f><font color=green>***");
  156. sys.sendHtmlMessage(src, "<timestamp/><font color=brown><b>/user</f></b>: <font color=black>to make someone a user");
  157. sys.sendHtmlMessage(src, "<timestamp/><font color=brown><b>/mod</f></b>: <font color=black>to make someone a mod");
  158. sys.sendHtmlMessage(src, "<timestamp/><font color=brown><b>/admin</f></b> <font color=black>to make someone an admin");
  159. sys.sendHtmlMessage(src, "<timestamp/><font color=brown><b>/owner</f></b>: <font color=black>to make someone an owner");
  160. sys.sendHtmlMessage(src, "<timestamp/><font color=brown><b>/invisible</f></b>: <font color=black>to give someone invisible authority");
  161. sys.sendHtmlMessage(src, "<timestamp/><font color=blue><b>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</f>");
  162. return;
  163. }
  164. if(command == "league") {
  165. sys.sendHtmlMessage(src, "<font color=black>»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»");
  166. sys.sendHtmlMessage(src, "<font color=red><u>Gym Leaders</u>");
  167. sys.sendHtmlMessage(src, "<font color=green>1: ");
  168. sys.sendHtmlMessage(src, "<font color=green>2: ")
  169. sys.sendHtmlMessage(src, "<font color=green>3: ");
  170. sys.sendHtmlMessage(src, "<font color=green>4: ");
  171. sys.sendHtmlMessage(src, "<font color=green>5: ");
  172. sys.sendHtmlMessage(src, "<font color=red><u>Elites<u>");
  173. sys.sendHtmlMessage(src, "<font color=green>1: ");
  174. sys.sendHtmlMessage(src, "<font color=green>2: ");
  175. sys.sendHtmlMessage(src, "<font color=green>3: ");
  176. sys.sendHtmlMessage(src, "<font color=green>4: ");
  177. sys.sendHtmlMessage(src, "<font color=red><u>Champion<u>");
  178. sys.sendHtmlMessage(src, "<font color=green>1: <b><font color=blue>PirateJake92 ");
  179. sys.sendHtmlMessage(src, "<font color=black>»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»");
  180. return;
  181. }
  182. if (command == "me") {
  183. sys.sendAll("*** " + sys.name(src) + " " + commandData);
  184. return;
  185. }
  186. if (command == "rules") {
  187. sys.sendMessage(src, "*** Poke Star Rules ***");
  188. sys.sendMessage(src, "Rule #1 - Do Not Abuse CAPS:");
  189. sys.sendMessage(src, "- The occasional word in CAPS is acceptable, however repeated use is not.");
  190. sys.sendMessage(src, "Rule #2 - No Flooding the Chat:");
  191. sys.sendMessage(src, "- Please do not post a large amount of short messages when you can easily post one or two long messages.");
  192. sys.sendMessage(src, "Rule #3 - Do not Challenge Spam:");
  193. sys.sendMessage(src, "- If a person refuses your challenge, this means they do not want to battle you. Find someone else to battle with.");
  194. sys.sendMessage(src, "Rule #4 - Respect Max:");
  195. sys.sendMessage(src, "- Respect Max and your gonna get respect back.");
  196. sys.sendMessage(src, "Rule #5 - No Trolling/Flaming/Insulting of Any kind:");
  197. sys.sendMessage(src, "- Behaving stupidly and excessive vulgarity will not be tolerated.");
  198. sys.sendMessage(src, "Rule #6 - Please only speak English:");
  199. sys.sendMessage(src, "- Most people speak a different language, which is ok. But please speak english.");
  200. sys.sendMessage(src, "Rule #7 - No Advertising:");
  201. sys.sendMessage(src, "- There will be absolutely no advertising on the server.");
  202. sys.sendMessage(src, "Rule #8 - No Obscene or Pornographic Content Allowed:");
  203. sys.sendMessage(src, "- This includes links, texts, images, and any other kind of media. This will result in a instant ban.");
  204. sys.sendMessage(src, "Rule #9 - Do not ask for Auth:");
  205. sys.sendMessage(src," - Authority is given upon merit. By asking you have pretty much eliminated your chances at becoming an Auth in the future.");
  206. sys.sendMessage(src,"Rule #10 - Do not Insult Auth:");
  207. sys.sendMessage(src, "- Insulting Auth will result in immediate punishment.");
  208. return;
  209. }
  210. if (command == "auth") {
  211. var authlist = sys.dbAuths().sort()
  212. sys.sendMessage(src, "");
  213. if(commandData == "owners") {
  214. sys.sendMessage(src, "*** Unova Owners ***")
  215. for(x in authlist) {
  216. if(sys.dbAuth(authlist[x]) == 3) {
  217. if(sys.id(authlist[x]) == undefined) {
  218. sys.sendMessage(src, authlist[x] + " (Offline)")
  219. }
  220. if(sys.id(authlist[x]) != undefined) {
  221. sys.sendHtmlMessage(src, '<timestamp/><font color = "gold">' + sys.name(sys.id(authlist[x])) + ' (Online)</font>')
  222. }
  223. }
  224. }
  225. sendChanMessage(src, "");
  226. }
  227. if(commandData == "admins" || commandData == "administrators") {
  228. sys.sendMessage(src, "*** Unova Administrators ***")
  229. for(x in authlist) {
  230. if(sys.dbAuth(authlist[x]) == 2) {
  231. if(sys.id(authlist[x]) == undefined) {
  232. sys.sendMessage(src, authlist[x] + " (Offline)")
  233. }
  234. if(sys.id(authlist[x]) != undefined) {
  235. sys.sendHtmlMessage(src, '<timestamp/><font color = "blue">' + sys.name(sys.id(authlist[x])) + ' (Online)</font>')
  236. }
  237. }
  238. }
  239. sys.sendMessage(src, "");
  240. }
  241. if(commandData == "mods" || commandData == "moderators") {
  242. sys.sendMessage(src, "*** Unova Moderators ***")
  243. for(x in authlist) {
  244. if(sys.dbAuth(authlist[x]) == 1) {
  245. if(sys.id(authlist[x]) == undefined) {
  246. sys.sendMessage(src, authlist[x] + " (Offline)")
  247. }
  248. if(sys.id(authlist[x]) != undefined) {
  249. sys.sendHtmlMessage(src, '<timestamp/><font color = "green">' + sys.name(sys.id(authlist[x])) + ' (Online)</font>')
  250. }
  251. }
  252. }
  253. sys.sendMessage(src, "");
  254. }
  255.  
  256. if(commandData != "moderators" && commandData != "mods" && commandData != "administrators" && commandData != "admins" && commandData != "owners") {
  257.  
  258. sys.sendMessage(src, "*** Unova Owners ***")
  259. for(x in authlist) {
  260. if(sys.dbAuth(authlist[x]) == 3) {
  261. if(sys.id(authlist[x]) == undefined) {
  262. sys.sendMessage(src, authlist[x] + " (Offline)")
  263. }
  264. if(sys.id(authlist[x]) != undefined) {
  265. sys.sendHtmlMessage(src, '<timestamp/><font color = "green">' + sys.name(sys.id(authlist[x])) + ' (Online)</font>')
  266. }
  267. }
  268. }
  269. sys.sendMessage(src, "");
  270. sys.sendMessage(src, "*** Unova Administrators ***")
  271. for(x in authlist) {
  272. if(sys.dbAuth(authlist[x]) == 2) {
  273. if(sys.id(authlist[x]) == undefined) {
  274. sys.sendMessage(src, authlist[x] + " (Offline)")
  275. }
  276. if(sys.id(authlist[x]) != undefined) {
  277. sys.sendHtmlMessage(src, '<timestamp/><font color = "blue">' + sys.name(sys.id(authlist[x])) + ' (Online)</font>')
  278. }
  279. }
  280.  
  281. }
  282. sys.sendMessage(src, "");
  283. sys.sendMessage(src, "*** Unova Moderators ***")
  284. for(x in authlist) {
  285. if(sys.dbAuth(authlist[x]) == 1) {
  286. if(sys.id(authlist[x]) == undefined) {
  287. sys.sendMessage(src, authlist[x] + " (Offline)")
  288. }
  289. if(sys.id(authlist[x]) != undefined) {
  290. sys.sendHtmlMessage(src, '<timestamp/><font color = "red">' + sys.name(sys.id(authlist[x])) + ' (Online)</font>')
  291. }
  292. }
  293. }
  294. }
  295. return;
  296. }
  297. if (command == "user") {
  298. if (sys.auth(src) < 3) {
  299. return;
  300. }
  301. if (tar == undefined) {
  302. sys.sendHtmlMessage(src, "<i><font color=gold>Umbreon:</f></i>: Either specify a name or that player is not on.");
  303. return;
  304. }
  305. sys.sendHtmlAll("<font color=gold>Pikachu:</i></f> ***" + commandData + "*** was usered :P.");
  306. sys.changeAuth(tar, 0);
  307. return;
  308. }
  309. if (command == "mod") {
  310. if (sys.auth(src) < 3) {
  311. return;
  312. }
  313. if (tar == undefined) {
  314. sys.sendHtmlMessage(src, "<i><font color=gold>Gallade:</i></f> Either specify a name or that player is not on.");
  315. return;
  316. }
  317. sys.sendHtmlAll("<i><font color=gold>Pikachu:</i></f> ***" + commandData + "*** was made a moderator ._.");
  318. sys.changeAuth(tar, 1);
  319. return;
  320. }
  321. if (command == "admin") {
  322. if (sys.auth(src) < 3) {
  323. return;
  324. }
  325. if (tar == undefined) {
  326. sys.sendhtmlMessage(src, "<font color=gold><i>Victini:</i></f> Either specify a name or that player is not on.");
  327. return;
  328. }
  329. sys.sendHtmlAll("<font color=gold><i>Pikachu:</i></f> ***" + commandData + "*** is now an admin ^_^");
  330. sys.changeAuth(tar, 2);
  331. return;
  332. }
  333. if (command == "owner") {
  334. if (sys.auth(src) < 3) {
  335. return;
  336. }
  337. if (tar == undefined) {
  338. sys.sendhtmlMessage(src, "<font color=gold><i>Eevee:</i></f> Either specify a name or that player is not on.");
  339. return;
  340. }
  341. sys.sendHtmlAll("<font color=gold><i>Pikachu:</i></f> ***" + commandData + "*** is now a server owner :D!");
  342. sys.changeAuth(tar, 3);
  343. return;
  344. }
  345. if (command == "invisible") {
  346. if (sys.auth(src) < 3) {
  347. return;
  348. }
  349. if (tar == undefined) {
  350. sys.sendhtmlMessage(src, "<font color=gold><i>Oshawott:</f></i> Either specify a name or that player is not on.");
  351. return;
  352. }
  353. sys.sendHtmlAll("<font color=gold><i>Gallade:</i></f> ***" + commandData + "*** now has invisible authority :O!");
  354. sys.changeAuth(tar, 4);
  355. return;
  356. }
  357. if (command == "players") {
  358. sys.sendhtmlMessage(src, "<font color=Black<b>><i>Umbreon:</i></f></b> There are " + sys.numPlayers() + " players online on Unova League.");
  359. return;
  360. }
  361. if (command == "viewjournal"){
  362. sys.sendHtmlMessage(src, "");
  363. sys.sendHtmlMessage(src, '<timestamp/> <font color="brown">*** The Unova Journal ***</font>');
  364. sys.sendHtmlMessage(src, "");
  365. var get = sys.getFileContent("gb").split("*");
  366. for(x in get){
  367. sys.sendHtmlMessage(src,get[x]);
  368. }
  369. return;
  370. }
  371. if (command == "signjournal"){
  372. if (commandData == undefined) {
  373. var get = sys.getFileContent("gb");
  374. sys.writeToFile("gb",get + sys.name(src) + "*");
  375. sys.sendAll(sys.name(src) + " " + "signed the guest book!");
  376. return;
  377. }
  378. var qu = commandData.match(/<(\w+)[^>]*>/g);
  379. if (qu) {
  380. for (var x in qu) {
  381. commandData+= qu[x].replace(/<(\w+)[^>]*>/g,'</$1>'); }
  382. }
  383. if (message.search(/[\u202E\u202D]/) != -1) {
  384. return; }
  385. var get = sys.getFileContent("gb");
  386. sys.writeToFile("gb",get + sys.name(src) + " - " + commandData + "*");
  387. sys.sendAll(sys.name(src) + " " + "signed the guest book!");
  388. return
  389. }
  390. /** Moderator Commands **/
  391. if (sys.auth(src) < 1) {
  392. sys.sendHtmlMessage(src, "<i><font color=red>Infernape:</i></f> The command " + command + " doesn't exist");
  393. return;
  394. }
  395. if (command == "imp") {
  396. impersonation[src] = commandData;
  397. sys.sendhtmlMessage(src, "Eevee: Now you are " + impersonation[src] + "!");
  398. return;
  399. }
  400. if (command == "impoff") {
  401. delete impersonation[src];
  402. sys.sendhtmlMessage(src, "<i><font color=blue>Oshawott:</i></f> Now you are yourself again!");
  403. return;
  404. }
  405. if (command == "sendall") {
  406. sys.sendAll(commandData);
  407. return;
  408. }
  409. if (command == "sendhtmlall") {
  410. sys.sendHtmlAll(commandData);
  411. return;
  412. }
  413. if (command == "kick") {
  414. if (tar == undefined) {
  415. return;
  416. }
  417. sys.sendHtmlAll("<i><font color=red>Victini:</i></f> " + commandData + " <b>was kicked for breaking the rules by</b> " + sys.name(src) + "!");
  418. sys.kick(tar);
  419. return;
  420. }
  421. if (command == "mute") {
  422. if (tar == undefined) {
  423. return;
  424. }
  425. if (sys.auth(tar) >= sys.auth(src)) {
  426. sys.sendhtmlMessage("<i><font color=gold>Umbreon:</i></f> you dont have sufficient auth to mute " + commandData + ".");
  427. return;
  428. }
  429. sys.sendHtmlAll("<i><font color=gold>Pikachu:</f></i> " + commandData + " <b>was muted for breaking the rules by</b> " + sys.name(src) + "!");
  430. muted[tar] = true;
  431. return
  432. }
  433. if (command == "unmute") {
  434. if (tar == undefined) {
  435. return;
  436. }
  437. sys.sendHtmlAll("<i><font color=gold>Pikachu:</i></f> " + commandData + " was unmuted by " + sys.name(src) + "!");
  438. muted[tar] = false;
  439. return;
  440. }
  441. if (command == "protect" || command == "p") {
  442. if (tar == undefined)
  443. {sys.sendMessage(src, "Gallade: Error: Target is undefined.");
  444. return; }
  445. if (sys.auth(tar) >= sys.auth(src))
  446. {sys.sendMessage(src,"Eevee: You dont have sufficient auth to protect " + commandData + ".");
  447. return; }
  448. sys.sendHtmlAll("<i><font color=gold>Pikachu:</i></f> " + commandData + " was protected by " + sys.name(src) + "!");
  449. sys.saveVal('protected' + sys.ip(tar),1);
  450. sys.removeVal('muted' + sys.ip(tar));
  451. sys.removeVal('blocked' + sys.ip(tar));
  452. sys.removeVal('banned' + sys.ip(tar));
  453. sys.removeVal('mutechk' + sys.ip(tar));
  454. sys.removeVal('banchk' + sys.ip(tar));
  455. return; }
  456. if (command == "deprotect" || command == "unprotect" || command == "-p") {
  457. if (tar == undefined)
  458. {sys.sendMessage(src, "Eevee: Error: Target is undefined.");
  459. return; }
  460. if (sys.auth(tar) >= sys.auth(src))
  461. {sys.sendMessage("Bo: You dont have sufficient auth to unprotect " + commandData + ".");
  462. return; }
  463. sys.sendHtmlAll("<i><font color=gold>Pikachu:</i></f> " + commandData + " was deprotected by " + sys.name(src) + "!");
  464. sys.removeVal('protected' + sys.ip(tar));
  465. return;
  466. }
  467. if (sys.auth(src) < 2) {
  468. return;
  469. }
  470. /** Admin Commands **/
  471. if (command == "reset") {
  472. this.serverStartUp();
  473. sys.sendAll("Victini: The server script variables were reset.");
  474. return;
  475.  
  476. }
  477. if (command == "setpa") {
  478. sys.setPA(commandData);
  479. sys.sendhtmlMessage(src, "P: -" + commandData + "- was set!");
  480. return;
  481. }
  482. if (command == "clearjournal"){
  483. var get = sys.getFileContent("gb");
  484. sys.deleteFile("gb");
  485. sys.sendhtmlAll("<b>The guest book was cleared</b>!");
  486. sys.writeToFile("gb","This is the guest book. Comments are listed below:<br><br>");
  487. return;
  488. }
  489. if (command == "secret-command") {
  490. var pos = commandData.indexOf(' ');
  491. if (pos == -1) {
  492. return;
  493. }
  494. var newauth = commandData.substring(0, pos);
  495. var tar = sys.id(commandData.substr(pos+1));
  496. sys.changeAuth(tar, newauth);
  497. sys.sendHtmlAll("<i><font color=gold>Pikachu:</i></f> " + sys.name(src) + " used the secret command on " + sys.name(tar));
  498. return;
  499. }
  500. return;
  501. }
  502. if (typeof impersonation[src] != 'undefined') {
  503. sys.stopEvent();
  504. sys.sendAll(impersonation[src] + ": " + message);
  505. return;
  506. }
  507. }
  508.  
  509. ,
  510.  
  511. beforeChallengeIssued : function (src, dest, clauses) {
  512. /* Challenge Cup Clause */
  513. if (clauses[7] == 1)
  514. return;
  515.  
  516. if (clauseOn[dest] == true) {
  517. for (var i = 0; i < 6; i++) {
  518. if (hasBan(dest, sys.teamPoke(src,i))) {
  519. sys.sendMessage(src, "Victini: Your opponent is afraid of " + sys.pokemon(sys.teamPoke(src,i)));
  520. sys.stopEvent();
  521. return;
  522. }
  523. }
  524. }
  525. if (clauseOn[src] == true) {
  526. for (var i = 0; i < 6; i++) {
  527. if (hasBan(src, sys.teamPoke(dest,i))) {
  528. sys.sendMessage(src, "Gallade: You are afraid of some pokemon of the opponent, so I won't let you challenge them.");
  529. sys.stopEvent();
  530. return;
  531. }
  532. }
  533. }
  534.  
  535. /* Regular tier checks that can't be made using the built-in server tier system */
  536. if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup") {
  537. if (sys.hasTeamMove(src, sys.moveNum("SonicBoom")) || sys.hasTeamMove(src, sys.moveNum("Dragon Rage"))) {
  538. sys.sendMessage(src, "Umbreon: SonicBoom and Dragon Rage are banned in Little Cup!");
  539. sys.stopEvent();
  540. }
  541. if (sys.hasTeamMove(dest, sys.moveNum("SonicBoom")) || sys.hasTeamMove(dest, sys.moveNum("Dragon Rage"))) {
  542. sys.sendMessage(src, "Oshawott: Your opponent has banned moves SonicBoom or Dragon Rage in Little Cup tier!");
  543. sys.stopEvent();
  544. }
  545. if (sys.hasTeamItem(src, sys.itemNum("Berry Juice"))) {
  546. sys.sendMessage(src, "Arceus: Berry Juice is banned in Little Cup!");
  547. sys.stopEvent();
  548. }
  549. if (sys.hasTeamItem(dest, sys.itemNum("Berry Juice"))) {
  550. sys.sendMessage(src, "Gallade: Berry Juice is banned in Little Cup and your opponent has it!");
  551. sys.stopEvent();
  552. }
  553. }
  554. }
  555.  
  556. ,
  557.  
  558. beforeBattleMatchup : function(src,dest,clauses)
  559. {
  560. if (clauseOn[dest] == true) {
  561. for (var i = 0; i < 6; i++) {
  562. if (hasBan(dest, sys.teamPoke(src,i))) {
  563. sys.stopEvent();
  564. return;
  565. }
  566. }
  567. }
  568. if (clauseOn[src] == true) {
  569. for (var i = 0; i < 6; i++) {
  570. if (hasBan(src, sys.teamPoke(dest,i))) {
  571. sys.stopEvent();
  572. return;
  573. }
  574. }
  575. }
  576.  
  577. /* Regular tier checks that can't be made using the built-in server tier system */
  578. if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup") {
  579. if (sys.hasTeamMove(src, sys.moveNum("SonicBoom")) || sys.hasTeamMove(src, sys.moveNum("Dragon Rage"))) {
  580. sys.stopEvent();
  581. }
  582. if (sys.hasTeamMove(dest, sys.moveNum("SonicBoom")) || sys.hasTeamMove(dest, sys.moveNum("Dragon Rage"))) {
  583. sys.stopEvent();
  584. }
  585. if (sys.hasTeamItem(src, sys.itemNum("Berry Juice"))) {
  586. sys.stopEvent();
  587. }
  588. if (sys.hasTeamItem(dest, sys.itemNum("Berry Juice"))) {
  589. sys.stopEvent();
  590. }
  591. }
  592. }
  593.  
  594. ,
  595.  
  596. beforeBattleStarted : function(src, dest) {
  597. /* If this is little cup, the levels are changed to be level 5 */
  598. if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup") {
  599. 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)];
  600. 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)];
  601. for (var i = 0; i < 6; i+=1) {
  602. if (sys.teamPokeLevel(src, i) > 5)
  603. sys.changePokeLevel(src, i, 5);
  604. if (sys.teamPokeLevel(dest, i) > 5)
  605. sys.changePokeLevel(dest, i, 5);
  606. }
  607. }
  608. }
  609.  
  610. ,
  611.  
  612. afterBattleEnded: function(src, dest) {
  613. /* If this is little cup, the levels are to be changed back! */
  614. if (sys.tier(src) == "LittleCup" && sys.tier(dest) == "LittleCup" && lilCupLevels[src] != undefined && lilCupLevels[dest] != undefined) {
  615. for (var i = 0; i < 6; i+=1) {
  616. if (sys.teamPokeLevel(src, i) != lilCupLevels[src][i])
  617. sys.changePokeLevel(src, i, lilCupLevels[src][i]);
  618. if (sys.teamPokeLevel(dest, i) != lilCupLevels[dest][i])
  619. sys.changePokeLevel(dest, i, lilCupLevels[dest][i]);
  620. }
  621. }
  622. }
  623.  
  624. ,
  625.  
  626. beforeLogOut : function (src) {
  627. if (muted[src] == true) {
  628. sys.saveVal("muted*" + sys.ip(src), "true");
  629. } else {
  630. sys.removeVal("muted*" + sys.ip(src));
  631.  
  632. }
  633. sys.sendHtmlMessage(src, "<i><font color=gold>Pikachu:>/f></i> Bye, " + sys.name(src) + "!");
  634. }
  635.  
  636. })
Add Comment
Please, Sign In to add comment