Thread: Language Filter
View Single Post
  #1  
Old 04-28-2007, 11:59 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Language Filter

This is a bad word filter on I worked just for the sake of keeping up my scripting skills (no current jobs).
HTML Code:
-Features
-- If player says a word in the list (not capital sensitive) it is replaced by *
-- Will stop all of the following & more (for example, the word cat):
--- cat
--- scat--- scats
--- s cat
--- s cat s
--- c at
--- ca t
-- Very easy to customize.
This is very easy to customize, all you need to do is add words to this.words; for example:
PHP Code:
this.words = { "word""peace""dude" }; 
can be changed to
PHP Code:
this.words = { "hi""yo""peace""happy" }; 
or so.

You can find this.words in the onCreated function. Here is the code.

Code for Weapon/GUI-Script -Filter:
PHP Code:
// Created by Chris Zakuto
//#CLIENTSIDE
function onCreatedNULL )
{
  
this.words =
  {
    
"mac",
    
"for",
    
"lyfe"
  
};
}
function 
onPlayerChatsNULL )
{
  
  if ( 
temp.chars != NULL )
  {
    
temp.chars.clear();
  }
 
  
temp.chat player.chat;
  if ( 
temp.rchat != NULL )
  {
    
temp.rchat "";
  }
  if ( 
temp.spac != NULL )
  {
    
temp.spac 0;
  }
  for ( 
temp.0temp.temp.chat.length(); temp.++ )
  {
    if ( 
temp.chat.substringtemp.i) != " " )
    {
      
temp.chars.add( { temp.temp.spactemp.chat.substringtemp.i), temp.spac } );
      
temp.rchat temp.rchat temp.chat.substringtemp.i);
    }
    else
    {
      
temp.spac ++;
    }
  }
  for ( 
temp.atemp.chars )
  {
    
temp.= ( temp.rchat.length() - temp.a[0] ) + 1;
    
    for ( 
temp.0temp.temp.ntemp.++ )
    {
      for ( 
temp.ythis.words )
      {
        if ( 
temp.== temp.rchat.substringtemp.a[0], temp.) )
        {
          
temp.filter temp.rchat.substringtemp.a[0], temp.);
          
temp.filter2 temp.filter.length();
          if ( 
temp.zz != NULL )
          {
            
temp.zz "";
          }
          for ( 
temp.var = 0temp.var < temp.filter2temp.var ++ )
          {
            
temp.zz temp.zz "*";
          }
          
player.chat "[*]";
        }
      }
    }
  }

__________________

Last edited by cbk1994; 04-29-2007 at 10:12 PM..
Reply With Quote