Thread: Chat Filter
View Single Post
  #1  
Old 03-03-2008, 12:12 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Chat Filter

I find it the best thing since the slice of bread!

PHP Code:
//#CLIENTSIDE
function onPlayerChats()
{
  if (
player.chat == "unstick me")
  {
    return 
false;
  }
  
  
temp.filters = {
    { {
"no""nah""nay"}, {"ar""yar matey""aye laddy"}},
    { {
"hello""hi""hey""hiya"}, {"'ey matey""avast"}},
    { {
"***"}, {"scallywag""scallywag"}},
    { {
"****"}, {"arrrrrrrrg""fuk""arrg""arrrrrrrrrrrrrrrrrrrg"}},
    { {
"nig""******""ngr""nigro""negro"}, {"blackskinned folk""blacker folk""cursed people"}},
    { {
"****"}, {"scurvy""davey jones waste"}},
    { {
"****""****""dik"}, {"mast""treasure chest"}},
    { {
"douchebag"}, {"waterdog""water dog"}},
    { {
"daz"}, {"black beard""blackbeard"}},
    { {
"staf""staff"}, {"crew""maties"}},
    { {
"vulcan"}, {"deckboy""deck boy"}},
    { {
"yes""yeah""yea"}, {"yar""yaaar"}},
    { {
"people""person""guy""man"}, {"folk""mate"}},
    { {
"there"}, {"ahoy"}},
    { {
"money""cash"}, {"dubloon""dubloons"}}
  };
  
  
temp.chat player.chat.tokenize();
  
  for (
temp.itemp.chat)
  {
    for (
temp.ftemp.filters)
    {
      for (
temp.gtemp.f[0])
      {
        
temp.newChat false;
        
        if (
temp.== temp.i.lower())
        {
          
temp.newChat randomstring(temp.f[1]);
        }
          else
        if (
temp.i.lower().starts(temp.g))
        {
          
temp.newChat randomstring(temp.f[1]) @ temp.i.substring(temp.g.length());
        }
          else
        if (
temp.i.lower().ends(temp.g))
        {
          
temp.newChat temp.i.substring(0temp.g.length()) @ randomstring(temp.f[1]);
        }          
        
        if (
temp.newChat != false)
        {
          
temp.chat.replace(temp.ctemp.newChat);
        }
        
      }
    }
    
temp.c++;
  }
  
  
temp.newChat "";
  
  for (
temp.ctemp.chat)
  {
    
temp.newChat @= temp." ";
  }

  
player.chat temp.newChat;

__________________
Reply With Quote