• Print

Author Topic: Censored words?  (Read 5448 times)

0 Members and 1 Guest are viewing this topic.

Offline Kossan

  • Newbie
  • *
  • Posts: 21
  • Karma: -7
Censored words?
« on: January 05, 2014, 10:46:49 am »
Hello  is there a way to like make it auto so when someone say maybe " you" or something. Could we make it become **** or so? Like auto?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Censored words?
« Reply #1 on: January 05, 2014, 11:49:40 am »
OLD code.
/index.php/topic,3647.0.html
You may be able to update it.
Monitoring for specific words can/will slow down servers though, the larger the list of stuff to look for gets.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Censored words?
« Reply #2 on: January 05, 2014, 12:08:54 pm »
Wrote this up for you real quick-
add as many words to the table as you want, and put it in lua/autorun/server
Code: Lua
  1. local blockedwords = {
  2. "word1",
  3. "word2"
  4. }
  5.  
  6. for k, v in pairs( blockedwords ) do
  7.         table.insert( blockedwords, v:upper() )
  8. end
  9.  
  10. hook.Add( "PlayerSay", "blockswears", function( ply, text, public )
  11.         local replace = text
  12.         for i = 1, #blockedwords do
  13.                 local v = blockedwords[ i ]
  14.                 if string.find( replace, v ) then      
  15.                         replace = string.gsub( replace, v, string.rep( "*", string.len( v ) ) )
  16.                 end
  17.         end
  18.         return replace
  19. end )
  20.  

Offline Storm

  • Full Member
  • ***
  • Posts: 220
  • Karma: 4
Re: Censored words?
« Reply #3 on: January 06, 2014, 03:51:07 pm »
This is great but i do wonder how much it would slow down the server!

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Censored words?
« Reply #4 on: January 06, 2014, 04:30:11 pm »
It won't slow down the server unless you have a lot of bad words to be blocked.

And it won't slow down the server itself, it'll just delay your chat messages.
Out of the Garry's Mod business.

Offline Storm

  • Full Member
  • ***
  • Posts: 220
  • Karma: 4
Re: Censored words?
« Reply #5 on: January 07, 2014, 04:27:02 am »
This doesn't seem to work in TTT.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Censored words?
« Reply #6 on: January 07, 2014, 09:58:59 am »
Yeah it's kind of crappy, I'll make you a good one when I get home.

Offline Storm

  • Full Member
  • ***
  • Posts: 220
  • Karma: 4
Re: Censored words?
« Reply #7 on: January 07, 2014, 12:19:07 pm »
If you do I would use it I think just to censor racist language.

  • Print