Blockland Forums > Modification Help
Possibility: Ban on spoken word?
<< < (2/3) > >>
Mr.PickleberryMan:
I'm not that good at scripting, but could someone help me with this?

EDIT: Trying to make it......
snowleperd:

--- Quote from: Destiny/Zack0Wack0 on June 21, 2010, 03:40:10 PM ---I wouldn't go as far to ban them automatically, just say a message saying you can't say that word.

--- End quote ---
Win.
Destiny/Zack0Wack0:
Here's my code I wrote a year ago for this sort of thing, if you want to strip the good parts out.

--- Code: ---function serverCmdForbidWords(%client,%player,%word)
{
   %target = findclientbyname(%player);
   for(%i=0; %i<getWordCount(%target.forbidWords); %i++)
   {
      if(getWord(%target.forbidWords,%i) $= %word)
      {
         %unforbid = true;
         break;
      }
   }
   if(%client.isSuperAdmin == 1 && %unforbid == false)
   {
      messageAll('','%1 \c2has forbid \c0%2\c2 of saying the word \c0\"%3\"\c2.',%client.name,%target.name,%word);
      %target.forbidWords = %target.forbidWords SPC %word;
   }
   if(%client.isSuperAdmin == 1 && %unforbid == true)
   {
      messageAll('','%1 \c2has un-forbid \c0%2\c2 of saying the word \c0\"%3\"\c2.',%client.name,%target.name,%word);
      %target.forbidWords = strReplace(%target.forbidWords,%word,"");
   }
}
function serverCmdForbidLetters(%client,%player,%word)
{
   %target = findclientbyname(%player);
   for(%i=0; %i<getWordCount(%target.forbidLetters); %i++)
   {
      if(getWord(%target.forbidLetters,%i) $= %word)
      {
         %unforbid = true;
         break;
      }
   }
   if(%client.isSuperAdmin == 1 && %unforbid == false)
   {
      messageAll('','%1 \c2has forbid \c0%2\c2 of saying the character \c0\"%3\"\c2.',%client.name,%target.name,%word);
      %target.forbidLetters = %target.forbidLetters SPC %word;
   }
   if(%client.isSuperAdmin == 1 && %unforbid == true)
   {
      messageAll('','%1 \c2has un-forbid \c0%2\c2 of saying the character \c0\"%3\"\c2.',%client.name,%target.name,%word);
      %target.forbidLetters = strReplace(%target.forbidLetters,%word,"");
   }
}
function serverCmdForbidSpeak(%client,%player)
{
   if(%client.isSuperAdmin == 0){return;}
   %target = findclientbyname(%player);
   if(%target.isMuted != 1)
   {
      %target.isMuted = 1;
      messageAll('','%1\c2 is now forbiden of speaking.',%target.name);
   }
   else
   {
      %target.isMuted = 0;
      messageAll('','%1\c2 is no longer forbiden of speaking.',%target.name);
   }
}
package ForbidWords
{
   function serverCmdMessageSent(%client,%text)
   {
      if(%client.isMuted == 1)
      {
         messageClient(%client,'','\c2You are muted. Get out.');
         return;
      }
      if(%client.forbidWords !$= "")
      {
      for(%i=0;%i<getWordCount(%text);%i++)
      {
         for(%k=0;%k<getWordCount(%client.forbidWords);%k++)
         {
            if(getWord(%text,%i) $= getWord(%client.forbidWords,%k))
            {
               messageClient(%client,'','You have been forbid of saying the word \c2\"%1\"\c0.',getWord(%text,%i));
               return;
            }
         }
      }
      }
      if(%client.forbidLetters !$= "")
      {
         for(%w=0; %w<strLen(%text); %w++)
         {
            %char = getSubStr(%text,%w,1);
    for(%b=0; %b < getWordCount(%client.forbidLetters); %b++)
            {
               if(getWord(%client.forbidLetters,%b) $= %char)
       {
                  messageClient(%client,'','You have been forbid of using the letter \c2\"%1\"\c0.',%char);
                  return;
               }
            }
         }
      }
      Parent::serverCmdMessageSent(%client,%text);
   }
};
activatePackage(ForbidWords);

--- End code ---
Mr.PickleberryMan:

--- Quote from: Destiny/Zack0Wack0 on June 21, 2010, 08:40:27 PM ---Here's my code I wrote a year ago for this sort of thing, if you want to strip the good parts out.
-code-
Nice. Wait, what is this Package "ForbidWords"?
--- End quote ---
lilboarder32:

--- Quote from: Mr.PickleberryMan on June 21, 2010, 10:03:23 PM ---
--- Quote from: Destiny/Zack0Wack0 on June 21, 2010, 08:40:27 PM ---Here's my code I wrote a year ago for this sort of thing, if you want to strip the good parts out.
-code-
Nice. Wait, what is this Package "ForbidWords"?

--- End quote ---

--- End quote ---
It's so he could overwrite serverCmdMessageSent, check out the sticky about packages if you don't know what they are.
Navigation
Message Index
Next page
Previous page

Go to full version