Don't like ads? PRO users don't see any ads ;-)
Guest

mcptools

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 21.88 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function ghostplayer(%name) {
  2.   //$pref::server::maxplayers++;
  3.   $Server::PlayerCount++;
  4.   %client = new AIConnection () { };
  5.   %client.nameBase = %name;
  6.   %client.name = addTaggedString("\cp\c8" @ %name @ "\co");
  7.   %client.guid = 0;
  8.   %client.isadmin=1;
  9.   addToServerGuidList( %client.guid );
  10.   //ClientGroup.add(%client);
  11.   %client.score=0;
  12.   $gbc++;
  13.   $ghostbots[$gbc]=%client;
  14.    messageAllExcept(%client, -1, 'MsgClientJoin', '\c2%1 joined the game.',
  15.       %client.name,
  16.       %client,
  17.       %client.sendGuid,
  18.       %client.score,
  19.       %client.isAiControlled(),
  20.       %client.isAdmin,
  21.       %client.isSuperAdmin,
  22.       %client.isMod);
  23.   }
  24.  
  25. function msg(%str) { messageAll('msgwhatever', "\c2"@$pref::server::hostername@": \c8"@%str); }
  26.  
  27. function msgf(%str) { messageAll('msgwhatever', %str); }
  28.  
  29. function plist() {
  30.   for( %i = 0; %i < ClientGroup.getCount(); %i++) {
  31.     %client = ClientGroup.getObject(%i);
  32.     echo("Client ID: "@%client@" for "@%client.namebase@"  score of: "@%client.score);
  33.     }
  34. }
  35.  
  36. function chgn(%client,%name)  {
  37.         %client.setPlayerName(%name);
  38.         %client.player.setShapeName(%name);
  39.               messageAll('MsgClientJoin', '',
  40.                           %client.name,
  41.                           %client,
  42.                           %client.sendGuid,
  43.                           %client.score,0,
  44.                           %client.isAdmin,
  45.                           %client.isSuperAdmin,
  46.               %client.isMod);
  47. }
  48. ////////////////////////////////////////////////////////////////////////////
  49. //BY MCP:  This function allows for recusive counting with the type decal.
  50. //         You don't have to worry about this funciton because I use it
  51. //         else where, but if you are interested, it is fed an obj#, a color
  52. //         string, a dealy time in miliseconds, the limit at which the
  53. //         coutner reverts to 0, and the current count of the object.  Yes
  54. //         I know I could have just pulled that off with getskinname(), so
  55. //         shut up. :)
  56. ////////////////////////////////////////////////////////////////////////////
  57. function dcount(%obj,%color,%time,%limit,%count) {
  58.   if (isobject(%obj)) {
  59.     if (%count==10)
  60.       %count=0;
  61. //this wasn't applying %color right in the function that follows, and I like lime -DShiznit
  62.     %obj.setskinname("lime_number_"@%count);
  63.     %count++;
  64.     if (%count>%limit)
  65.       %count=0;
  66.     %obj.cl=schedule(%time,0,dcount,%obj,%color,%time,%limit,%count);
  67.     }
  68. }
  69.  
  70. ////////////////////////////////////////////////////////////////////////////
  71. //BY MCP:  Given the first doorset number in the series of sequential doorset
  72. //         numbers, this function will cancel any schedules pending on the set
  73. //         of decals.
  74. ////////////////////////////////////////////////////////////////////////////
  75. function timerkill(%set) {
  76.   %count = MissionCleanup.getCount();
  77.   for (%i = 1; %i < %count; %i++) {
  78.     %block = MissionCleanup.getObject(%i);
  79.     for (%x = 0; %x <= 6; %x++)
  80.       if (%block.port == %set + %x)
  81.         cancel(%block.cl);
  82.     }
  83. }
  84.  
  85. ////////////////////////////////////////////////////////////////////////////
  86. //BY MCP:  Given the first doorset number in the series of sequential doorset
  87. //         numbers, this function will cancel any schedules pending on the set
  88. //         of decals then it will calulate the the ammount of time each digit
  89. //         must wait before begining its recursive counting.  This is because
  90. //         if there are 15 seconds on the clock then the minitue marker isn't
  91. //         going to wait 60 seconds to invcement like normal.  Instead it will
  92. //         wait for 45 seconds then it will being wiating for 60 seconds for
  93. //         subsequent calls.
  94. //
  95. //         Setup: 1. Set out 7 type decals.
  96. //                2. Put numbers on them, all 0's if you like.
  97. //                3. Assign some bigass doorset number to the 100's of hours
  98. //                   decal that you know no one will use like 78230.
  99. //                4. Increment this number by one and assign it to the 10's
  100. //                   of hours decal. EI: 78231
  101. //                5. Incement and repeat for each lower measure of time.
  102. //                6. In the consol type clocktimer(set#); where set# is your
  103. //                   first set number for the 100's of hours.  EI: 78230
  104. //                *  Lucky for you the save will keep this info for you, so
  105. //                   you will only have to use the command to restart it when
  106. //                   you reload the save file.
  107. ////////////////////////////////////////////////////////////////////////////
  108. function clocktimer(%set) {
  109.   %color=getsubstr(%block.getskinname(),0,5);
  110.   timerkill(%set);
  111.   %count = MissionCleanup.getCount();
  112.   for (%i = 1; %i < %count; %i++) {
  113.     %block = MissionCleanup.getObject(%i);
  114.     for (%x = 0; %x <= 6; %x++) {
  115.       if (%block.port == %set + %x) {
  116.         %myclock[%x]=%block;
  117.         %precount[%x]=getsubstr(%block.getskinname(),13,1);
  118.         %color[%x] = getsubstr(%block.getskinname(),0,5);
  119.         }
  120.       }
  121.     }
  122.  
  123.   %pretime[5]=(10-%precount[6])*1000;
  124.   %precount[6]++;
  125.   if (%precount[6]>9)
  126.     %precount[6]=0;
  127.  
  128.   %pretime[4]=(5-%precount[5])*10000+%pretime[5];
  129.   %precount[5]++;
  130.   if (%precount[5]>5)
  131.     %precount[5]=0;
  132.  
  133.   %pretime[3]=(9-%precount[4])*60000+%pretime[4];
  134.   %precount[4]++;
  135.   if (%precount[4]>9)
  136.     %precount[5]=0;
  137.  
  138.   %pretime[2]=(5-%precount[3])*600000+%pretime[3];
  139.   %precount[3]++;
  140.   if (%precount[3]>5)
  141.     %precount[3]=0;
  142.  
  143.   %pretime[1]=(9-%precount[2])*3600000+%pretime[2];
  144.   %precount[2]++;
  145.   if (%precount[2]>9)
  146.     %precount[2]=0;
  147.  
  148.   %pretime[0]=(9-%precount[1])*36000000+%pretime[1];
  149.   %precount[1]++;
  150.   if (%precount[1]>9)
  151.     %precount[1]=0;
  152.  
  153.   %precount[0]++;
  154.   if (%precount[0]>9)
  155.     %precount[0]=0;
  156.  
  157.   %myclock[0].cl=schedule(%pretime[0],0,dcount,%myclock[0],%color[0],360000000,9,%precount[0]);
  158.   %myclock[1].cl=schedule(%pretime[1],0,dcount,%myclock[1],%color[1],36000000,9,%precount[1]);
  159.   %myclock[2].cl=schedule(%pretime[2],0,dcount,%myclock[2],%color[2],3600000,9,%precount[2]);
  160.   %myclock[3].cl=schedule(%pretime[3],0,dcount,%myclock[3],%color[3],600000,5,%precount[3]);
  161.   %myclock[4].cl=schedule(%pretime[4],0,dcount,%myclock[4],%color[4],60000,9,%precount[4]);
  162.   %myclock[5].cl=schedule(%pretime[5],0,dcount,%myclock[5],%color[5],10000,5,%precount[5]);
  163.   %myclock[6].cl=schedule(1000,0,dcount,%myclock[6],%color[6],1000,9,%precount[6]);
  164. }
  165. ////////////////////////////////////////////////////////////////////////////
  166. //BY MCP:  This is just the recursive function for moving the hands of the
  167. //         clock, but I suppose you could us it for other things such as
  168. //         creating looping fans and such.
  169. ////////////////////////////////////////////////////////////////////////////
  170. function tiktoc (%obj,%delay,%degrees) {
  171.   if (!isobject(%obj))
  172.     return;
  173.   %obj.rotsav=rotaddup(%obj.rotsav,%degrees);
  174.   %obj.settransform(%obj.getposition()@" "@rotconv(%obj.rotsav));
  175.   %obj.cl = schedule(%delay,0,tiktoc,%obj,%delay,%degrees);
  176. }
  177.  
  178. function dingdong (%hrs) {
  179. //sound dongs
  180. //reschedule
  181.   if (%hrs==12)
  182.     %hrs=0;
  183.   else
  184.     %hrs++;
  185.   schedule(1000*60*60,0,dingdong,%hrs);
  186. }
  187.  
  188. ////////////////////////////////////////////////////////////////////////////
  189. //BY MCP:  Given the first doorset number in the series of sequential doorset
  190. //         numbers, this function will cancel any schedules pending on the set
  191. //         clock hands.
  192. ////////////////////////////////////////////////////////////////////////////
  193. function cfk (%set) {
  194.   %count = MissionCleanup.getCount();
  195.   for (%i = 1; %i < %count; %i++) {
  196.     %block = MissionCleanup.getObject(%i);
  197.     if (%block.port == %set)
  198.         cancel(%block.cl);
  199.     else if (%block.port == %set + 1)
  200.         cancel(%block.cl);
  201.     else if (%block.port == %set + 2)
  202.         cancel(%block.cl);
  203.     }
  204. }
  205. ////////////////////////////////////////////////////////////////////////////
  206. //BY MCP:  Given the first doorset number in the series of sequential doorset
  207. //         numbers, this function will cancel any schedules pending on the set
  208. //         of clock hands.  This function is simple but powerful, so don't let
  209. //         it overwelm you.  Unless you need your clock to increment negatively
  210. //         on the selected axis you must put a 1 in for %rev, otherwise you don't
  211. //         have to enter a number at all.  Now this function will start, orient,
  212. //         and resync your clock as it does slowly get off as there is some
  213. //         processing time associated with each tick.  
  214. //         Setup: 1. Make one clock hand at twelve o'clock with the rotation
  215. //                   point in the center of the face.
  216. //                2. Create the rest of the hands with the rotation points all
  217. //                   in the center. Meaning they are all touching there.
  218. //                3. By now you should know what axis you are rotating them on
  219. //                   that identifies what time it is.  Remember it because it will
  220. //                   be the axis you use when you start he clock
  221. //                4. Now pull out your clock and use the command resync(a,b,c,d,e,f);
  222. //                      a = the first doorset number in the series of sequential doorset
  223. //                          numbers which in this case should be the hour hand.
  224. //                      b = number of hours appearing on your system clock (0 for 12)
  225. //                      c = number of minutes that will be on your clock when you start
  226. //                          it.
  227. //                      d = remember that axis I told you to remember? Enter it as a string
  228. //                          here. IE: "x" for the X axis.
  229. //                      e = This is the number of degrees for the axis you are using when
  230. //                          it is pointing at 12 o'clock.  Check your admin panel after you
  231. //                          select that ONE clock hand you pointed to 12 in step 1.
  232. //                      f = If you clock need to move backward along its selected axis
  233. //                          put 1 here otherwise make it 0 or don't bother with it at all.
  234. ////////////////////////////////////////////////////////////////////////////
  235. function resync (%set,%hours,%minutes,%axis,%ori,%rev) {
  236.   cfk (%set);
  237.   %hcount = -1;
  238.   %mcount = -1;
  239.   %scount = -1;
  240.   %count = MissionCleanup.getCount();
  241.   for (%i = 1; %i < %count; %i++) {
  242.     %block = MissionCleanup.getObject(%i);
  243.     if (%block.port == %set)
  244.         %hrs[%hcount++]=%block;
  245.     else if (%block.port == %set + 1)
  246.         %min[%mcount++]=%block;
  247.     else if (%block.port == %set + 2)
  248.         %sec[%scount++]=%block;
  249.     }
  250.   switch$ (%axis) {
  251.     case "x":
  252.         %degrees="1 0 0";
  253.     case "y":
  254.         %degrees="0 1 0";
  255.     case "z":
  256.         %degrees="0 0 1";      
  257.     }
  258.   if (%rev)
  259.     vectorscale(%degrees,-1);
  260.   %pmin=%minutes*6+%ori;
  261.   %phrs=%hours*30+%minutes*0.5+%ori;
  262.   for (%i = 0; %i <= %scount; %i++) {
  263.     switch$ (%axis) {
  264.       case "x":
  265.         %sec[%i].rotsav=vectoradd(vscale(%sec[%i].rotsav,"0 1 1"),%ori @ " 0 0");
  266.       case "y":
  267.         %sec[%i].rotsav=vectoradd(vscale(%sec[%i].rotsav,"1 0 1"),"0 " @ %ori @ " 0");
  268.       case "z":
  269.         %sec[%i].rotsav=vectoradd(vscale(%sec[%i].rotsav,"1 1 0"),"0 0 " @ %ori);
  270.       }
  271.         %sec[%i].cl = schedule(1000,0,tiktoc,%sec[%i],1000,vectorscale(%degrees,6));
  272.     }
  273.   for (%i = 0; %i <= %mcount; %i++) {
  274.     switch$ (%axis) {
  275.       case "x":
  276.         %min[%i].rotsav=vectoradd(vscale(%min[%i].rotsav,"0 1 1"),%pmin @ " 0 0");
  277.       case "y":
  278.         %min[%i].rotsav=vectoradd(vscale(%min[%i].rotsav,"1 0 1"),"0 " @ %pmin @ " 0");
  279.       case "z":
  280.         %min[%i].rotsav=vectoradd(vscale(%min[%i].rotsav,"1 1 0"),"0 0 " @ %pmin);
  281.       }
  282.     %min[%i].settransform(%min[%i].getposition()@" "@rotconv(%min[%i].rotsav));
  283.     %min[%i].cl = schedule(10000,0,tiktoc,%min[%i],10000,%degrees);
  284.     }
  285.  
  286.   for (%i = 0; %i <= %hcount; %i++) {
  287.     switch$ (%axis) {
  288.       case "x":
  289.         %hrs[%i].rotsav=vectoradd(vscale(%hrs[%i].rotsav,"0 1 1"),%phrs @ " 0 0");
  290.       case "y":
  291.         %hrs[%i].rotsav=vectoradd(vscale(%hrs[%i].rotsav,"1 0 1"),"0 " @ %phrs @ " 0");
  292.       case "z":
  293.         %hrs[%i].rotsav=vectoradd(vscale(%hrs[%i].rotsav,"1 1 0"),"0 0 " @ %phrs);
  294.       }
  295.     %hrs[%i].settransform(%hrs[%i].getposition()@" "@rotconv(%hrs[%i].rotsav));
  296.     %hrs[%i].cl=schedule(60000,0,tiktoc,%hrs[%i],60000,vectorscale(%degrees,0.5));
  297.     }
  298. }
  299.  
  300. function vscale(%v1,%v2) {
  301.   %x1=getword(%v1,0);
  302.   %x2=getword(%v2,0);
  303.   %y1=getword(%v1,1);
  304.   %y2=getword(%v2,1);
  305.   %z1=getword(%v1,2);
  306.   %z2=getword(%v2,2);
  307.   %ret = %x1*%x2 SPC %y1*%y2 SPC %z1*%z2;
  308.   return(%ret);
  309. }
  310.  
  311. $numBannedWords=-1;
  312.  
  313. function cleanString(%string) {  
  314.   for(%i=0; %i<=$numBannedWords; %i++)
  315.     %string = Strreplace( %string, $bannedWords[%i], $replacementWord[%i] );      
  316.   return %string;
  317.   }
  318. function serverCmdMessageSent(%client, %text)
  319. {
  320.         %obj = %client.player;
  321.         //fwar play talk animation
  322.     //   if (!%obj.sitting) {
  323.         // %obj.playthread(0, talk);
  324.         // %obj.schedule(strlen(%text) * 50, stopthread, 0);
  325.      //   }
  326.    if(strlen(%text) >= $Pref::Server::MaxChatLen)
  327.       %text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);
  328.       %num = 0;
  329.  
  330.    %text = emoString(%text);
  331.    %clientname = colorPlayerName(%client);
  332.    
  333.    if (!%client.issuperadmin) {
  334.      %text = cleanString(%text);
  335.      for(%word=getWord(%text,%num);%num<getWordcount(%text);%word=getWord(%text,%num++)) {
  336. //    if(%word $= "lag" || %word $= "Iag")
  337. //    return;
  338.     }
  339.    }
  340.  
  341.       if($Pref::Server::FilterSwears)
  342.      %text = filterSwears(%text);
  343.    if (%client.shutup==1) {
  344.         %text = "I am sorry MCP you are right, I will shut up now";
  345.          %client.shutup++;
  346.         }
  347.    else if (%client.shutup==2) {
  348.      %text = "/me shuts up";
  349.          %client.shutup++;
  350.      }
  351.    else if (%client.shutup==3) {
  352.      %text = "/me is really stupid";
  353.          %client.shutup--;
  354.      }
  355.    if (strstr(%text,"/taunt ") == 0) {
  356.      %text = Strreplace( %text, "/taunt ", "");      
  357.      if (%client.bodytype==666 && %client.player.getState() $= "Move")
  358.        %client.player.playAudio(0,"PredTaunt"@%text);
  359.      }
  360.    if(!%client.secure)
  361.      return;
  362.    else if (strstr(%text,"/me ") == 0) {
  363.      %text = Strreplace( %text, "/me ", "");      
  364.      serverIRCchat("*" @ %clientname @ " " @ %text);
  365.      chatMessageAll(%client, '\c1*%1\c1 %2', %clientname, %text);
  366.      return;
  367.      }
  368.    else if (strstr(%text,"/pm ") == 0) {
  369.      %text = Strreplace( %text, "/pm ", "");
  370.      %pmclient = getword(%text,0);
  371.      %text = Strreplace( %text, %pmclient @ " ", "");
  372.      %pmclient = findclientbyname(detagcolors(%pmclient));
  373.      if (isobject(%pmclient)) {
  374.        servercmdpmclient(%client,%pmclient,%text);
  375.         for (%clientnumber = 0; %clientnumber < ClientGroup.getCount(); %clientnumber++) {      
  376.             %victim = ClientGroup.getObject( %clientnumber );    
  377.                 %ip = getRawIP(%victim);
  378.         messageclient(%victim,' ','(From %1 - To %2) %3', nametoid(%client), nametoid(%pmclient), %text);
  379.  
  380.         }
  381.         }
  382.      return;
  383.      }
  384.  
  385.    else if (strstr(%text,"/pull") == 0 && %client.isadmin) {
  386.      switch$ (%client.bodytype) {
  387.          case 1:
  388.           %p = new AIPlayer() {
  389.              dataBlock = MBlue;
  390.              aiPlayer = true;
  391.              client = %client;
  392.           };
  393.          case 2:
  394.           %p = new AIPlayer() {
  395.              dataBlock = MGreen;
  396.              aiPlayer = true;
  397.              client = %client;
  398.           };
  399.          case 3:
  400.           %p = new AIPlayer() {
  401.              dataBlock = MRed;
  402.              aiPlayer = true;
  403.              client = %client;
  404.           };
  405.          case 4:
  406.           %p = new AIPlayer() {
  407.              dataBlock = MYellow;
  408.              aiPlayer = true;
  409.              client = %client;
  410.           };
  411.          case 5:
  412.           %p = new AIPlayer() {
  413.              dataBlock = MBrown;
  414.              aiPlayer = true;
  415.              client = %client;
  416.           };
  417.          case 6:
  418.           %p = new AIPlayer() {
  419.              dataBlock = MGray;
  420.              aiPlayer = true;
  421.              client = %client;
  422.           };
  423.          case 7:
  424.           %p = new AIPlayer() {
  425.              dataBlock = MGrayDark;
  426.              aiPlayer = true;
  427.              client = %client;
  428.           };
  429.          case 8:
  430.           %p = new AIPlayer() {
  431.              dataBlock = MWhite;
  432.              aiPlayer = true;
  433.              client = %client;
  434.          case 9:
  435.           %p = new AIPlayer() {
  436.              dataBlock = MLink;
  437.              aiPlayer = true;
  438.              client = %client;                   
  439.           };
  440.          default:
  441.           %p = new AIPlayer() {
  442.              dataBlock = LightMaleHumanArmor;
  443.              aiPlayer = true;
  444.              client = %client;
  445.           };
  446.          }
  447.          %p.schedule(2000,setTransform,%client.camera.gettransform());
  448.          %p.clearAim();
  449.          %p.owner = getrawip(%client);
  450.          MissionCleanup.add(%p);
  451.          %p.schedule(22000,delete);
  452.           %p.setShapeName(%client.name);
  453.           %p.unMountImage($headSlot);
  454.           %p.unMountImage($visorSlot);
  455.           %p.unMountImage($backSlot);
  456.           %p.unMountImage($leftHandSlot);
  457.           %p.unMountImage($chestSlot);
  458.           %p.unMountImage($faceSlot);
  459.           %p.unMountImage(7);
  460.           %p.setskinname(%client.colorSkin);
  461.           %p.headCode=%client.headCode;
  462.           %p.headCodeColor=gettaggedstring(%client.headCodeColor);
  463.           %p.mountImage(%client.headCode, $headSlot, 1, %client.headCodeColor);
  464.           %p.visorCode=%client.visorCode;
  465.           %p.visorCodeColor=gettaggedstring(%client.visorCodeColor);
  466.           %p.mountImage(%client.visorCode, $visorSlot, 1, %client.visorCodeColor);
  467.           %p.backCode=%client.backCode;
  468.           %p.backCodeColor=gettaggedstring(%client.backCodeColor);
  469.           %p.mountImage(%client.backCode, $backSlot, 1, %client.backCodeColor);
  470.           %p.leftHandCode=%client.leftHandCode;
  471.           %p.leftHandCodeColor=gettaggedstring(%client.leftHandCodeColor);
  472.           %p.mountImage(%client.leftHandCode, $leftHandSlot, 1, %client.leftHandCodeColor);
  473.           %p.chestdecalcode=gettaggedstring(%client.chestdecalcode);
  474.           %p.mountImage(chestShowImage, $chestSlot, 1, %client.chestdecalcode);
  475.           %p.facedecalcode=gettaggedstring(%client.facedecalcode);
  476.           %p.mountImage(faceplateShowImage, $faceSlot, 1, %client.facedecalcode);
  477.           schedule(1000,0,MessageAll,%client, '\c3%1 <<PULL>>', %client.name);
  478.      }
  479. //Put stuff here
  480.    else if (strstr(strLwr(%text),"/wand") == 0) {
  481.      servercmdmagicwand(%client);
  482.      return;
  483.     }
  484.    if (strstr(strLwr(%text),"/motd") == 0) {
  485.      messageClient(%client, 'MsgSomething', "\c2"@$Pref::Server::Motd);
  486.      return;
  487.     }
  488.  
  489.  
  490.    else {
  491.      chatMessageAll(%client, '%1:\c2 %2', %clientname, %text);
  492.      if(!%client.isSpamming)
  493.        serverIRCchat(detagcolors(%clientname)@ ": " @ %text);
  494.      
  495.    }
  496.  
  497.  
  498.    echo(detagcolors(%clientname), ": ", %text);
  499.    if ($away && strstr(%text,$pref::server::hostername) > -1 && $pref::server::awaymsg !$= "")
  500.      chatmessageAll('msgwhatever', "\c2"@$pref::server::hostername@": \c8"@$pref::server::awaymsg);
  501.    if($chatloaded == false)
  502.      createChatfile();
  503.    logchat(detagcolors(%clientname), %text);
  504. }
  505.  
  506. function mp() {
  507.   exec("tbm/server/mcptools.cs");
  508. }
  509. //infinite rotation of bricks for a doorset
  510. function ticset (%degrees,%delay,%set) {
  511.   if (%degrees $= "" || %delay < 100 || %set < 1)
  512.     return;  
  513.   %count = MissionCleanup.getcount();
  514.   for (%i = 1; %i < %count; %i++) {
  515.     %block = MissionCleanup.getObject(%i);
  516.     if (%block.port == %set) {
  517.       cancel(%block.cl);
  518.       %block.cl=schedule(%delay,0,tiktoc,%block,%delay,%degrees);
  519.       }
  520.     }
  521. }
  522.  
  523. //useful honest
  524.  
  525. function findbrick (%ip,%r) {
  526.   %rtn=0;
  527.   %count = MissionCleanup.getcount();
  528.   for (%i = 1; %i < %count; %i++) {
  529.     %block = MissionCleanup.getObject(%i);
  530.     if (%block.owner $= %ip) {
  531.       if (%r == 1) {
  532.                 if (%block.dataBlock.classname $= "brick")
  533.         %block.explode();
  534.         else if (getSubStr(%block.dataBlock, 0, 6) $="Health" ||
  535.                   %block.getClassName() $= "Item" ||
  536.               getSubStr(%block.dataBlock, 0, 2) $="DM" ||
  537.               getSubStr(%block.dataBlock, 0, 8) $="portculy" ||
  538.               getSubStr(%block.dataBlock, 0, 5) $="crown" ||
  539.               getSubStr(%block.dataBlock, 0, 9) $="goalpoint" ||
  540.               %block.getClassName() $= "AIplayer")
  541.         %block.delete();
  542.        
  543.       }
  544.       else if (%r == 2)
  545.         %rtn++;
  546.       else
  547.         echo("Brick found "@%block.getposition());
  548.       }
  549.     }
  550.   if (%r == 2)
  551.     return %rtn;
  552. }
  553.  
  554. function serverCmdspy(%client,%repeat) {
  555.   if (%client.team !$= "") {
  556.      messageClient(%client, 'Msg', "\c2You are on a team and letting you spy would let you cheat.  Sorry.");
  557.      return;
  558.      }
  559. if (%client.isadmin) {
  560.   if (!%repeat)
  561.      %client.spyingon++;
  562.   if (%client.spyingon >= ClientGroup.getcount())
  563.     %client.spyingon=0;
  564.   %cl=ClientGroup.getObject(%client.spyingon).getcontrolobject();
  565.   if (%cl==%client.camera && %client.player)
  566.     %cl=%client.player;
  567.   %client.camera.settransform(vectoradd(vectoradd(%cl.getposition(),"0 0 1"),vectorscale(%cl.getforwardvector(),-3)) SPC rotFromTransform(%cl.gettransform()));
  568.   %client.setcontrolobject(%client.camera);
  569.   }
  570. }
  571.  
  572. function punishmentof (%victim) {
  573.   //what to do if someone tries to build in the host
  574. }
  575.  
  576. function punishment2of (%client, %victim) {
  577.   //what to do if someone tries to spray an admin
  578. }
  579.  
  580.  
  581. function removelastban () {
  582.   $Ban::ip[$Ban::numBans] = "";
  583.   $Ban::numBans--;
  584. }
  585.  
  586. function mban (%ip) {
  587.   $Ban::numBans++;
  588.   $Ban::ip[$Ban::numBans] = %ip;
  589. }
  590.  
  591. function servercmdtoggleJet(%client, %value) {
  592.   if( %client.isAdmin || %client.isSuperAdmin ) {
  593.     if( %value < 20 || %value > 350)
  594.       messageClient(%client, 'MsgAdminForce', '\c2\x96Please pick a value between 20 and 350.');
  595.     else {
  596.       $Pref::Server::Jet = %value;
  597.       for (%player=nametoid(LightMaleHumanArmor); %player<=nametoid(MWhite); %player++) {
  598.         %player.mass = $Pref::Server::Jet;
  599.         %player.jumpForce = 12 * $Pref::Server::Jet;
  600.         }
  601.       messageAll("MsgAdminForce", "\c2\x96Jetpack Force is now\c3 " @%value@ "\c2. Please suicide to gain the new effects.");
  602.       }
  603.     }
  604.   }
  605.  
  606. function findclientbyname(%findclient) {
  607.   %fca = -1;
  608.   for( %i = 0; %i < ClientGroup.getCount(); %i++) {
  609.     %client = ClientGroup.getObject(%i);
  610.     if (%client.namebase $= %findclient)
  611.         %fca = %client;
  612.     }
  613.   return %fca;
  614. }