Klee_from_Space

Untitled

Apr 5th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.42 KB | None | 0 0
  1. package mute
  2. {
  3.     function GameConnection::autoAdminCheck(%client)
  4.     {
  5.         if($muted[%client.getBLID()] == true)
  6.         {
  7.             %time = $time[%client.getBLID()];
  8.             $left[%client.getBLID()] = false;
  9.             $muteSchedule[%client.getBLID()] = schedule(%time, 0, muteTimeUp, %client);
  10.         }
  11.     return parent::autoAdminCheck(%client);
  12.     }
  13.    function serverCmdsilence(%client, %victim, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
  14.    {
  15.       if(%client.isAdmin || %client.isSuperAdmin)
  16.       {
  17.          if(%victim $= "")
  18.          {
  19.              messageClient(%client, '',"You must enter a target!");
  20.              return;
  21.          }
  22.          %victim = findClientByName(%victim);
  23.          if(%victim != 0)
  24.          {
  25.             if(%client.isAdmin)
  26.             {
  27.                 if(%victim.isSuperAdmin)
  28.                 {
  29.                     messageClient(%client,'',"You cannot silence super admins!");
  30.                     return;
  31.                 }
  32.             }
  33.             if(%victim.isHost)
  34.             {
  35.                 messageClient(%client, '',"You cannot silence the host!");
  36.                 return;
  37.             }
  38.             if($silence[%victim.getBLID()] == true)
  39.             {
  40.                messageClient(%client,'',"This person has already been silenced.");
  41.                return;
  42.             }
  43.             if($mute[%victim.getBLID()] == true)
  44.             {
  45.                messageClient(%client,'',"This person has already been muted, they cannot be silenced.");
  46.                return;
  47.             }
  48.             %msg = %a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32;
  49.             %msg = strreplace(%msg,"_"," ");
  50.             %msg = stripTrailingSpaces(%msg);
  51.             if(%msg $= "")
  52.             {
  53.                 messageAll( 'MsgAdminForce', '\c3%1\c6 has been silenced by \c3%2\c6!', %victim.name, %client.name);
  54.             }
  55.             else
  56.             {
  57.                 messageAll( 'MsgAdminForce', '\c3%1\c6 has been silenced by \c3%2\c6 for "\c3%3\c6"', %victim.name, %client.name, %msg);
  58.             }
  59.             $silence[%victim.getBLID()] = true;
  60.          }
  61.          else
  62.          {
  63.             messageClient(%client,'',"Player not found!");
  64.          }
  65.       }
  66.       else
  67.       {
  68.           messageClient(%client, '',"You do not have permission to use this command!");
  69.           return;
  70.       }
  71.    }
  72.  
  73.    function serverCmdmute(%client, %victim, %time, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
  74.    {
  75.       if(%client.isAdmin || %client.isSuperAdmin)
  76.       {
  77.          if(%victim $= "")
  78.          {
  79.              messageClient(%client, '',"You must enter a target!");
  80.              return;
  81.          }
  82.          %victim = findClientByName(%victim);
  83.          if(isObject(%victim))
  84.          {
  85.             if (%time < 5 || %time > 999)
  86.             {
  87.                 messageClient(%client, '',"Mute time cannot be less than five or greater than 999!");
  88.                 return;
  89.             }
  90.             if($muted[%victim.getBLID()] == true)
  91.             {
  92.                messageClient(%client,'',"This person has already been muted.");
  93.                return;
  94.             }
  95.             if($silence[%victim.getBLID()] == true)
  96.             {
  97.                messageClient(%client,'',"This person has already been silenced, they cannot be muted.");
  98.                return;
  99.             }
  100.             %msg = %a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32;
  101.             %msg = strreplace(%msg,"_"," ");
  102.             %msg = stripTrailingSpaces(%msg);
  103.            
  104.             if(%msg $= "")
  105.             {
  106.                 messageAll( 'MsgAdminForce', '\c3%1\c6 has been muted by \c3%2\c6 for \c3%3\c6 seconds!', %victim.name, %client.name, %time);
  107.             }
  108.             else
  109.             {
  110.                 messageAll( 'MsgAdminForce', '\c3%1\c6 has been muted by \c3%2\c6 for \c3%3\c6 seconds, "\c3%4\c6"', %victim.name, %client.name, %time, %msg);
  111.             }
  112.             $muted[%victim.getBLID()] = true;
  113.             %time *= 1000;
  114.             $time[%victim.getBLID()] = %time;
  115.             $muteSchedule[%victim.getBLID()] = schedule(%time, 0, muteTimeUp, %victim);
  116.             getMutedtime(%victim);
  117.          }
  118.          else
  119.          {
  120.             messageClient(%client,'',"Player not found!");
  121.          }
  122.       }
  123.       else
  124.       {
  125.           messageClient(%client, '',"You do not have permission to use this command!");
  126.           return;
  127.       }
  128.    }
  129.    function getMutedtime(%client)
  130.    {
  131.         if($time[%client.getBLID()] == 0)
  132.         {
  133.         return;
  134.         }
  135.         %bet = 1000;
  136.         $time[%client.getBLID()] -= 1000;
  137.         $muteSch[%client.getBLID()] = schedule(%bet, 0, getMutedtime, %client);
  138.    }
  139.    function muteTimeUp(%client)
  140.    {
  141.       if($left[%client.getBLID()] = true)
  142.       {
  143.           return;
  144.       }
  145.       $muted[%client.getBLID()] = false;
  146.       messageAll( 'MsgAdminForce', '\c3%1\c6 is no longer muted!', %client.name);
  147.       messageClient(%client, '', '\c3Your mute time is up. You can now talk.');
  148.    }
  149.    function GameConnection::onDrop(%client)
  150.    {
  151.        if($muted[%client.getBLID()] = true)
  152.        {
  153.            cancel($muteSchedule[%client.getBLID()]);
  154.            $left[%client.getBLID()] = true;
  155.        }
  156.        parent::onDrop(%client);
  157.    }
  158.    function serverCmdunSilence(%client, %victim)
  159.    {
  160.       if(%client.isAdmin || %client.isSuperAdmin)
  161.       {
  162.          %victim = findClientByName(%victim);
  163.          if(isObject(%victim))
  164.          {
  165.             if(!$silence[%victim.getBLID()] == true)
  166.             {
  167.                messageClient(%client, '', 'This person is not silenced.');
  168.                return;
  169.             }
  170.             $silence[%victim.getBLID()] = false;
  171.             messageAll( 'MsgAdminForce', '\c3%1\c6 has been unsilenced by \c3%2\c6!', %victim.name, %client.name);
  172.          }
  173.          else
  174.          {
  175.             messageClient(%client,'',"Player not found!");
  176.          }
  177.          return;
  178.       }
  179.       messageClient(%client, '', 'You are not an admin!');
  180.    }
  181.    function serverCmdunMute(%client, %victim)
  182.    {
  183.       if(%client.isAdmin || %client.isSuperAdmin)
  184.       {
  185.          %victim = findClientByName(%victim);
  186.          if(isObject(%victim))
  187.         {
  188.             if($muted[%victim.getBLID()] == false)
  189.             {
  190.                messageClient(%client, '', 'This person is not muted.');
  191.                return;
  192.             }
  193.             $muted[%victim.getBLID()] = false;
  194.             messageAll( 'MsgAdminForce', '\c3%1\c6 has been unmuted by \c3%2\c6!', %victim.name, %client.name);
  195.             cancel($muteSchedule[%victim.getBLID()]);
  196.          }
  197.          else
  198.          {
  199.             messageClient(%client,'',"Player not found!");
  200.          }
  201.          return;
  202.       }
  203.       messageClient(%client, '', 'You are not an admin!');
  204.    }
  205.    function serverCmdmessageSent(%client, %text)
  206.    {
  207.       if($silence[%client.getBLID()] == true)
  208.       {
  209.           messageClient(%client, '', '\c6You have been silenced, you cannot talk until you are unsilenced by an administrator.');
  210.           return;
  211.       }
  212.       if($muted[%client.getBLID()] == true)
  213.       {
  214.          $easy[%client.getBLID()] = $time[%client.getBLID()] / 1000;
  215.          if ($easy[%client.getBLID()] == 1)
  216.          {
  217.              %suffix = "";
  218.          }
  219.          else
  220.          {
  221.              %suffix = "s";
  222.          }
  223.          messageClient(%client,'', '\c6You have been muted, you cannot talk for \c3%1\c6 second%2.', $easy[%client.getBLID()], %suffix);
  224.          return;
  225.       }
  226.       parent::serverCmdmessageSent(%client, %text);
  227.    }
  228. };
  229. activatePackage(mute);
Advertisement
Add Comment
Please, Sign In to add comment