Poll

Possible?

Yes.
No.

Author Topic: Possibility: Ban on spoken word?  (Read 1496 times)


I had a script that did this once as a joke, it was fun to make people unable to use the basic english words. So, yes it's possible.

I could actually have fun with a mod like this.

Yes, totally possible.

No, most of us will not be your little script monkey and give you every tidbit of code in order.

You would have to check to see whether the message contains word x and then ban / delete their client from the server.

I wouldn't go as far to ban them automatically, just say a message saying you can't say that word.

I'm not that good at scripting, but could someone help me with this?

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

I wouldn't go as far to ban them automatically, just say a message saying you can't say that word.
Win.

Here's my code I wrote a year ago for this sort of thing, if you want to strip the good parts out.
Code: [Select]
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);

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"?

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"?
It's so he could overwrite serverCmdMessageSent, check out the sticky about packages if you don't know what they are.


It's so he could overwrite serverCmdMessageSent, check out the sticky about packages if you don't know what they are.
Oh.

Possible. Mean(depending on the words), yet possible