ULX

Author Topic: Better language filter...  (Read 5659 times)

0 Members and 1 Guest are viewing this topic.

Offline Zyklus

  • Full Member
  • ***
  • Posts: 109
  • Karma: 1
Better language filter...
« on: January 14, 2007, 12:49:34 AM »
Before I go to bed tonight, I thought this might be a good idea to talk about... There should be a good regexp language filter that filters a player's message and sends the filtered message to everyone else but the player who typed it.  The original message is sent back to the player who sent it, while for the other players, it is filtered and sent.  The player who sent the message cannot tell if his language is being filtered, since his messages are reflected back.  The other players (depending on if we want the filter to replace with "!@#$" or "dang", "crap", etc.) will receive the filtered message...  Bah, I'm tired let me explain that again...

1.  Player B sends a message containing one or more words that need to be filtered.
2.  The server receives the message.
3.  The server sends the message back to Player B to display on his/her HUD.
4.  The server filters the message.
5.  The server then sends the filtered message to the other players to display on their HUD.

Therefore, Player B does not know if his/her messages were ever filtered.  So, he/she won't try to get around a filter he/she doesn't know about... right?  ;) 


The reason I bring this up is because when I was playing hl1dm a while ago, I happened to be on some n00b server with a (horrible) language filter.  It replaced "noob" with "a good player" and among other things.  Every time I wanted to type noob, I had to put spaces in between the characters just to get my message across.  That was one retarded n o o b server.  Anywho, the moral of the story is, if the player doesn't see the filter, she doesn't know how to get around it.
« Last Edit: January 14, 2007, 12:51:51 AM by Zyklus »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Better language filter...
« Reply #1 on: January 14, 2007, 12:57:56 AM »
Been meaning to do something like this for a long time. :)

I was never able to do it on GM9 because lua doesn't implement the full regex library. Now that we have the ability to do modules though, we could easily implement that full library.

The most difficult parts of a swear filter as I see them are "unleeting" the string, since there's so many possibilities, and figuring out if they're trying to get around the filter with spaces.

Let me know if you need any help doing this! Have a few scraps of code that may or may not help you, and lots of ideas. ;)
Experiencing God's grace one day at a time.

Offline Zyklus

  • Full Member
  • ***
  • Posts: 109
  • Karma: 1
Re: Better language filter...
« Reply #2 on: January 15, 2007, 08:43:57 PM »
Been meaning to do something like this for a long time. :)

I was never able to do it on GM9 because lua doesn't implement the full regex library. Now that we have the ability to do modules though, we could easily implement that full library.

The most difficult parts of a swear filter as I see them are "unleeting" the string, since there's so many possibilities, and figuring out if they're trying to get around the filter with spaces.

Let me know if you need any help doing this! Have a few scraps of code that may or may not help you, and lots of ideas. ;)

... What?  The whole point of the filter is to make sure that the players don't know they are being filtered ;)

Offline Mank

  • Full Member
  • ***
  • Posts: 209
  • Karma: 9
    • Ulysses Mod!
Re: Better language filter...
« Reply #3 on: January 17, 2007, 04:26:44 PM »
... What?  The whole point of the filter is to make sure that the players don't know they are being filtered ;)

I'm not sure he read your post fully.
If you doubt your powers you bring powers to your doubts.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Better language filter...
« Reply #4 on: January 17, 2007, 06:47:55 PM »
I'm not sure he read your post fully.

;)
Experiencing God's grace one day at a time.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Better language filter...
« Reply #5 on: January 17, 2007, 08:20:13 PM »
Code: [Select]
function censor(werdz)
if string.find(werds, "") then
x = string.gsub(werds, "", "***************")
return x
end

Blocks all swear words. Guaranteed.


Offline Mank

  • Full Member
  • ***
  • Posts: 209
  • Karma: 9
    • Ulysses Mod!
Re: Better language filter...
« Reply #6 on: January 18, 2007, 09:41:13 AM »
Code: [Select]
function censor(werdz)
if string.find(werds, "") then
x = string.gsub(werds, "", "***************")
return x
end

Blocks all swear words. Guaranteed.

I'm George Zimmerman creator and founder of the mens warehouse, I guarantee it!

Anyway, I'm suprised you took the time to make a mock lua script xD
If you doubt your powers you bring powers to your doubts.