ULX

Author Topic: CenKik - Censoring and Kicking  (Read 24117 times)

0 Members and 1 Guest are viewing this topic.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
CenKik - Censoring and Kicking
« on: January 14, 2014, 05:26:45 PM »
CenKik - 1.1

This addon censors any specified strings and kicks whoever said it.

How to use:
Use chat.

Features:
  • Enable/Disable kicking
  • Enable/Disable censoring
  • Enable/Disable kicking and censoring for mods, admins, and superadmins
  • Editable moderator name

Known Bugs:
  • If capital letters are attached to a censored word, the those letters will be lower case.
    • "I like lolipopsoMUCH!" -> "I like *******somuch!"
  • Reportedly incompatible with team chat. This includes TTT.
  • Reportedly incompatible with chat hook commands.

Thanks:
  • Eccid
  • MrPresident
« Last Edit: August 20, 2014, 11:06:23 AM by Neku »
Out of the Garry's Mod business.

Offline Storm

  • Full Member
  • ***
  • Posts: 220
  • Karma: 4
Re: CenKik - Censoring and Kicking
« Reply #1 on: January 14, 2014, 05:34:13 PM »
Excellent! Thanks so much!

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: CenKik - Censoring and Kicking
« Reply #2 on: January 14, 2014, 05:39:03 PM »
I happened to upload the unused files along with it.

Feel free to delete meowa.luaa and meowII.luaa.
Fixed the download now~
Out of the Garry's Mod business.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: CenKik - Censoring and Kicking
« Reply #3 on: January 14, 2014, 06:24:06 PM »
to fix your bug, you could do this:

string.explode
to separate the sentence by space. Check each entry (you would need to use a for loop as the entries would be in a table at this point).

Once you are done use
string.implode
place them all back together into a sentence and pass that to the chat hook.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: CenKik - Censoring and Kicking
« Reply #4 on: January 14, 2014, 07:32:47 PM »
AND_THEN_EVERYONE_STARTS_BEING_IDIOTS_AND_TALKS_LIKE_THISorTalksLikeThisToAvoidAutoCensor
Of course, at that point, you'd hope that an admin was on who could ban the person for script/rule avoidance.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: CenKik - Censoring and Kicking
« Reply #5 on: January 14, 2014, 07:44:38 PM »
AND_THEN_EVERYONE_STARTS_BEING_IDIOTS_AND_TALKS_LIKE_THISorTalksLikeThisToAvoidAutoCensor
Of course, at that point, you'd hope that an admin was on who could ban the person for script/rule avoidance.

This filters out words regardless of it's case. Of course the drawback is having the entire thing in lower case.

"I lIkE LoLiPoPs!" -> "i like ******s!"
Out of the Garry's Mod business.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: CenKik - Censoring and Kicking
« Reply #6 on: January 14, 2014, 07:50:22 PM »
to fix your bug, you could do this:

string.explode
to separate the sentence by space. Check each entry (you would need to use a for loop as the entries would be in a table at this point).

Once you are done use
string.implode
place them all back together into a sentence and pass that to the chat hook.

Er, I still don't fully understand tables in Lua.
Could you show me how please?

Like, how would I indicate which part of the table to filter out?
Out of the Garry's Mod business.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: CenKik - Censoring and Kicking
« Reply #7 on: January 14, 2014, 08:02:52 PM »
I was replying to MrPres' idea of using spaces as a separator. :)
No spaces, wouldn't censor as expected. But now that I say that, my mind spins and considers a way to even check for multiple words in one 'no space sentence'.
But that then starts even more for loops. CPU hog.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: CenKik - Censoring and Kicking
« Reply #8 on: January 14, 2014, 09:43:16 PM »
Not really Jam. It would work exactly how she is doing it now, except if they tried to do all one string the whole string would be censored.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: CenKik - Censoring and Kicking
« Reply #9 on: January 14, 2014, 09:47:29 PM »
You would just need to use something like..

Code: [Select]
if string.find( string, badword) then
    -censor this word
end

It would find the word even if it were nested inside of another word. You just have to be careful at this point.

Let's say that boom is your bad word, it would think that kaboom was a bad word as well.


Chat censors are never 100% flawless.

Offline Storm

  • Full Member
  • ***
  • Posts: 220
  • Karma: 4
Re: CenKik - Censoring and Kicking
« Reply #10 on: January 15, 2014, 05:39:42 AM »
Is there a way I can change the code to sensor the whole sentence the offending word is in like Eccid's code did? I took his:

if string.find(string.lower(text), b, 1, true) then --Is a word being used?
      if KickWords.censor then text = ";)" end --What to print if censored.

and tried several ways to work it into your addon, but I continually failed.

Here is why I want to censor the whole sentence:
1) profanity rages often contain a lot of foul words in the one sentence. I can't anticipate and block ever word. Also, the offending plyr gets more of a punishment (without kicking) if his entire sentence is blocked and gives up quickly.
2) I use this to block http:, www., ,com, etc. I want the whole link blocked not just that part, which is what Eccid's script did. Otherwise, players will see ***pornhub****, etc

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: CenKik - Censoring and Kicking
« Reply #11 on: January 15, 2014, 06:31:42 AM »
Is there a way I can change the code to sensor the whole sentence the offending word is in like Eccid's code did? I took his:

if string.find(string.lower(text), b, 1, true) then --Is a word being used?
      if KickWords.censor then text = ";)" end --What to print if censored.

and tried several ways to work it into your addon, but I continually failed.

Here is why I want to censor the whole sentence:
1) profanity rages often contain a lot of foul words in the one sentence. I can't anticipate and block ever word. Also, the offending plyr gets more of a punishment (without kicking) if his entire sentence is blocked and gives up quickly.
2) I use this to block http:, www., ,com, etc. I want the whole link blocked not just that part, which is what Eccid's script did. Otherwise, players will see ***pornhub****, etc
That is much easier to do.
for k, v in pairs( badwords ) do
if string.find( text:lower(), v ) then
return string.rep ("*", text:len() )
end
end

Or something like that.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: CenKik - Censoring and Kicking
« Reply #12 on: January 15, 2014, 08:08:30 AM »
Just above
Code: [Select]
kikpls = true
Replace that line with
Code: [Select]
filter = "(=^-^=)"
Out of the Garry's Mod business.

Offline Storm

  • Full Member
  • ***
  • Posts: 220
  • Karma: 4
Re: CenKik - Censoring and Kicking
« Reply #13 on: January 15, 2014, 09:34:57 AM »
This is just what I was looking for and works perfectly! AND i accidentally learned something! Thanks so much!

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: CenKik - Censoring and Kicking
« Reply #14 on: January 15, 2014, 05:04:14 PM »
You would just need to use something like..

Code: [Select]
if string.find( string, badword) then
    -censor this word
end

It would find the word even if it were nested inside of another word. You just have to be careful at this point.

Let's say that boom is your bad word, it would think that kaboom was a bad word as well.


Chat censors are never 100% flawless.

I meant, how would I call a certain value in a table?
Out of the Garry's Mod business.