Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Chat Filter (https://forums.graalonline.com/forums/showthread.php?t=78914)

xAndrewx 03-03-2008 12:12 PM

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;



cbk1994 03-04-2008 02:41 AM

Been there done that.

http://forums.graalonline.com/forums...ad.php?t=73726

kia345 03-04-2008 03:01 AM

Quote:

Originally Posted by xAndrewx (Post 1377682)
cursed people

I'm so glad I accidentally clicked this thread, I lol'd way harder than I should have.

Tolnaftate2004 03-04-2008 03:22 AM

This is a fairly weak filter. It would probably be better to use all non-word characters as delimiters for tokens (or the like), if you want it to be stronger.

Darklux 03-04-2008 12:19 PM

I don't like swear filters. The one on gk is quite script and people swear or make racist remarks all the time => it does not work at all.

Frankie 03-04-2008 09:41 PM

Pirate day on Era! lmao

cbk1994 03-04-2008 11:07 PM

I like swear filters, but most people do not, so I find it best to add optional clientside filters, though a custom chat system is required.


All times are GMT +2. The time now is 05:34 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.