bad words control

By Yoinx on Jan 01, 2005

This is a badwords script that i made. It supports multiple channels. You Either need to restart your client after loading this, or use "/hmake badwords 50" to make the table. Use "/badwords" to start it. Also, if someone uses more than one word in a sentence it will take the action on them. It checks words by token so test wouldnt trigger if test is in your list. Etc. If anyone has any suggestions please post them. edited Fixed it so you cant add the same word twice. And removed the error when trying to add an empty text field. Updated now you can add wildcards to the table. Enough people requested it to add it in.

You can now use /badwords.batchadd to add words from a text file. Make sure that you put *'s in your text file for words you want to have them.

This script as with all of mine is open to anyone for modifications. You dont have to ask, and I only ask that you include some sort of credit or a link back to this snippet.

On *:start: {
  hmake badwords 50
  if ( $isfile($+(",$scriptdirbadwords.hsh,")) ) {
    hload badwords $+(",$scriptdirbadwords.hsh,")
  }
}
on *:exit: {
  hsave -o badwords $+(",$scriptdirbadwords.hsh,")
  hfree badwords
}
dialog badwords {
  title "Bad Words List"
  size -1 -1 170 160
  option dbu
  button "OK", 10, 62 144 37 12, ok cancel
  tab "Words", 30, 0 -2 169 141
  edit "Enter Your Bad Word To Add", 1, 4 14 124 10, tab 30
  box "Current Bad Words list. Double Click a word to remove it.", 3, 2 26 166 112, tab 30
  button "Add Word", 11, 130 14 37 10, tab 30
  list 2, 4 34 162 102, tab 30 sort size
  tab "Options", 31
  check "Warn Before Kicking or Banning", 40, 2 16 134 10, tab 31
  check "Kick User", 41, 2 26 38 10, tab 31
  check "Kick/Ban User", 42, 2 36 54 10, tab 31
  edit "5 Minutes", 43, 116 36 50 10, tab 31
  text "Ban Time In Minutes:", 50, 64 38 51 8, tab 31
  edit "Please Watch Your language.", 45, 50 70 116 20, tab 31 multi autohs
  text "Ban/Kick Reason:", 4, 2 70 43 8, tab 31
  text "Channels to Monitor:", 52, 2 96 163 8, tab 31
  edit "Use # to indicate all channels. Seperate Multiple channels by spaces. IE: #channel1 #channel2  #channel3", 46, 2 104 166 22, tab 31 multi autovs
  text "Warning Message:", 53, 2 48 47 8, tab 31
  edit "Please Watch Your Language. Further abuse will cause actions to be taken.", 47, 50 46 116 20, tab 31 multi
}
alias badwords {
  if ( !$hget(badwords) ) hmake badwords 100
  dialog -m Badwords Badwords
}
on *:dialog:badwords:init:0: {
  if ( $hget(badwords) != $null ) {
    var %x 1
    did -r badwords 2
    while ( %x <= $hget(badwords,0).item ) {
      did -a badwords 2 $hget(badwords,%x).item
      inc %x
    }
  }
  if ( $ini($+(",$scriptdirsettings.ini),Badwords) != $null ) {
    if ( $readini($+(",$scriptdirsettings.ini,"),Badwords,Warn) == 1 ) did -c badwords 40
    if ( $readini($+(",$scriptdirsettings.ini,"),Badwords,Kick) == 1 ) did -c badwords 41
    if ( $readini($+(",$scriptdirsettings.ini,"),Badwords,Ban) == 1 ) did -c badwords 42
    if ( $readini($+(",$scriptdirsettings.ini,"),Badwords,Bantime) != $null ) did -ra badwords 43 $calc( $readini($+(",$scriptdirsettings.ini,"),Badwords,Bantime) / 60 ) Minutes
    if ( $readini($+(",$scriptdirsettings.ini,"),Badwords,Reason) != $null ) did -ra badwords 45 $readini($+(",$scriptdirsettings.ini,"),Badwords,Reason)
    if ( $readini($+(",$scriptdirsettings.ini,"),Badwords,Warnmsg) != $null ) did -ra badwords 47 $readini($+(",$scriptdirsettings.ini,"),Badwords,Warnmsg)
    if ( $readini($+(",$scriptdirsettings.ini,"),Badwords,Channels) != $null ) did -ra badwords 46 $replace($readini($+(",$scriptdirsettings.ini,"),Badwords,Channels),$chr(44),$chr(32))
  }
}
on *:dialog:badwords:dclick:2: {
  hdel badwords $did(badwords,2).seltext
  did -d badwords 2 $did(badwords,2).sel
}

on *:dialog:badwords:sclick:11: {
  if ( $did(badwords,1).text == $null ) {
    did -ra badwords 1 Please Enter Text 
    halt
  }
  if ( $hfind(badwords,$did(badwords,1).text,1) == $null ) {
    if ( $did(badwords,1).edited == $true ) {
      hadd badwords $did(badwords,1).text
      did -a badwords 2 $did(badwords,1).text
      did -j badwords 1
    }
    else {
      did -ra badwords 1 You Must edit this text before clicking add.
      did -j badwords 1
    }
  }
  else {
    did -ra badwords 1 $+(",$did(badwords,1).text,") Already Exists in the List.
    did -j badwords 1
  }
}
on *:dialog:badwords:sclick:41: {
  if ( $did(badwords,41).state == 1 ) && ( $did(badwords,42).state == 1 ) {
    did -u badwords 42
  }
}
on *:dialog:badwords:sclick:42: {
  if ( $did(badwords,42).state == 1 ) && ( $did(badwords,41).state == 1 ) {
    did -u badwords 41
  }
}
on *:dialog:badwords:sclick:10: {
  .writeini $+(",$scriptdirsettings.ini,") Badwords Warn $did(badwords,40).state
  .writeini $+(",$scriptdirsettings.ini,") Badwords Kick $did(badwords,41).state
  .writeini $+(",$scriptdirsettings.ini,") Badwords Ban $did(badwords,42).state
  var %x 1
  if ( $did(badwords,45).text != $null ) {
    while ( %x <= $did(badwords,45).lines ) {
      set %badwords.reason %badwords.reason $did(badwords,45,%x).text
      inc %x
    }
    .writeini $+(",$scriptdirsettings.ini,") Badwords Reason %badwords.reason
    unset %badwords.reason 
  }
  else {
    .remini $+(",$scriptdirsettings.ini,") Badwords Reason 
  }
  var %x 1
  if ( $did(badwords,47).text != $null ) {
    while ( %x <= $did(badwords,47).lines ) {
      set %badwords.warnmsg %badwords.warnmsg $did(badwords,47,%x).text
      inc %x
    }
    .writeini $+(",$scriptdirsettings.ini,") Badwords Warnmsg %badwords.warnmsg
    unset %badwords.warnmsg 
  }
  else {
    .remini $+(",$scriptdirsettings.ini,") Badwords Warnmsg 
  } 
  $iif( $did(badwords,43).text != $null , .writeini $+(",$scriptdirsettings.ini,") Badwords Bantime $calc( $int($did(badwords,43).text) * 60 ) , .remini $+(",$scriptdirsettings.ini,") Badwords Bantime )
  if ( $did(badwords,46).edited ) && ( $did(badwords,46).text != $null ) {
    var %x 1
    while ( %x <= $did(badwords,46).lines ) {
      set %badwords.channels %badwords.channels $did(badwords,46,%x).text
      inc %x
    }
    .writeini $+(",$scriptdirsettings.ini,") Badwords Channels $replace(%badwords.channels,$chr(32),$chr(44)) 
    unset %badwords.channels
  }
  else {
    .remini $+(",$scriptdirsettings.ini,") Badwords Channels 
  }
}

;;;;;;;;on text script section;;;;;;;;;;;;;;
on @*:text:*:$($readini($+(",$scriptdirsettings.ini,"), Badwords, Channels)): {
  var %x 1
  while ( %x <= $numtok($1-,32) ) {
    if ( $hfind(badwords,$gettok($1-,%x,32),1,W) != $null ) {    
      ;;warn;;
      if ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Warn) == 1 ) {
        if ( $hget(badwordswarn,$+($nick,.,$chan)) == $null ) {
          hinc -m badwordswarn $+($nick,.,$chan)
          .Notice $nick $chan $readini($+(",$scriptdirsettings.ini,"), Badwords, Warnmsg)
        }
        else {
          hinc -m badwordswarn $+($nick,.,$chan)
        }
        ;;warned kick;;
        if ( $hget(badwordswarn,$+($nick,.,$chan)) > 1 ) && ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Kick) == 1 ) && ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Ban) == 0 ) {
          .kick $chan $nick $readini($+(",$scriptdirsettings.ini,"), Badwords, Reason )
          hdel badwordswarn $+($nick,.,$chan)
        }
        ;;warned kickban;;
        elseif ( $hget(badwordswarn,$+($nick,.,$chan)) > 1 ) && ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Kick) == 0 ) && ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Ban) == 1 ) {
          .ban $+(-ku,$readini($+(",$scriptdirsettings.ini,"), Badwords, Bantime)) $chan $nick $readini($+(",$scriptdirsettings.ini,"), Badwords, Reason ) $calc( $readini($+(",$scriptdirsettings.ini,"),Badwords,Bantime) / 60 ) Minutes
          hdel badwordswarn $+($nick,.,$chan)
        }
      }
    }
    ;;no warn;;
    if ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Warn) == 0 ) {
      ;;;no warn kick;;;
      if ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Kick) == 1 ) && ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Ban) == 0 ) {
        .kick $chan $nick $readini($+(",$scriptdirsettings.ini,"), Badwords, Reason )
      }
      ;;;no warn kickban
      elseif ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Kick) == 0 ) && ( $readini($+(",$scriptdirsettings.ini,"), Badwords, Ban) == 1 ) {
        .ban $+(-,ku,$readini($+(",$scriptdirsettings.ini,"), badwords, bantime)) $chan $nick $readini($+(",$scriptdirsettings.ini,"), Badwords, Reason ) Banned: $calc( $readini($+(",$scriptdirsettings.ini,"),Badwords,Bantime) / 60 ) Minutes
      }
    }
    inc %x
  }
}
alias badwords.batchadd {
  var %file = $+(",$sfile($scriptdir*.txt,Select your Text file,Batch Add),"))
  if (%file == $null) {
    echo -a You must enter a file.
    halt
  }
  else {
    badwords
    var %x = 1
    while (%x <= $lines(%file)) {
      if ($hfind(badwords,$read(%file,%x),0) == 0) {
        hadd badwords $read(%file,%x)
        did -a badwords 2 $read(%file,%x)
        did -j badwords 1
      }
      inc %x
    }
    echo -a Finished with the batch add.
  }
}
Sign in to comment.
jaytea   -  Aug 10, 2011

[quote] It is kinda neat to see that people are still using stuff I wrote after so long though. [/quote]

there are people out there still using scripts that were made popular in the 90s ;) good to see you again Yoinx!

 Respond  
Yoinx   -  Aug 09, 2011

It is kinda neat to see that people are still using stuff I wrote after so long though.

 Respond  
Yoinx   -  Aug 09, 2011

Np, But i'm going to be working off like 5 year old memory here...

basically... in the directory you put this script in, there should be a settings.ini with a section called [badwords] in it... Make a section called [badwordsadmins] then under that put the nicks you want to be exempt from it as "nick=admin" "nick2=admin" and so on... putting each one on a new line.

Then change the start of the on text from

on @:text::$($readini($+(",$scriptdirsettings.ini,"), Badwords, Channels)): { var %x 1

to

on @:text::$($readini($+(",$scriptdirsettings.ini,"), Badwords, Channels)): { if ( $readini($+(",$scriptdirsettings.ini,"), Badwordsadmins, $nick ) == admin ) { halt } var %x 1

and that should fix it to ignore anything from a nick listed in the settings.ini under badwordsadmins... which again should look like

[Badwordsadmins] nick=admin nick2=admin PyThOn=admin Yoinx=admin

Assuming nick, nick2, PyThOn, and Yoinx where admins.

But, since I'm rusty with this stuff... It could also just not work... or just start banning everyone... so use at your own risk.

 Respond  
PyThOn   -  Aug 09, 2011

lmao if i knew how i would i just started learning all this.

 Respond  
Yoinx   -  Aug 09, 2011

Sorry, I've been out of MIRC scripting for like 5 years now... So I won't be modifying any scripts that I've posted here...

But, here's a tip. For any scripts you find that you want to whitelist people on... just use the access list, and use the = function in that to limit anyone with higher access than your desired access from triggering any of the events...

You could also manually add them to the ini, under an "admins" setting, and at the top of the on text event, just use a readini to check if the nick is in that ini... if it is, just stop the script.

 Respond  
PyThOn   -  Aug 08, 2011

Its gets annoying after a while of admins getting banned Banned or not admins will NEVER be able to receive the same "justice" as a user From using this script

 Respond  
PyThOn   -  Aug 08, 2011

No

 Respond  
ch1zra   -  Aug 08, 2011

it sure can be, but there should be same justice for all :)

 Respond  
PyThOn   -  Aug 08, 2011

Does this have an exception list? If not add one it can be helpfull

 Respond  
[Empty]   -  May 10, 2008

Yoinx .. good yob, but where is global channels ? ;)

 Respond  
DreamLander   -  May 21, 2006

The script can be acces truough MENU BAR if you put, the following code into it:

menu status,menubar { BAD-WORD:.badwords } Good Work,Yoinx.Keep the good stuff coming. My best regards!

 Respond  
ch1zra   -  May 27, 2005

nice script Yoinx :))

 Respond  
Yoinx   -  May 26, 2005

sorry ttteesstteerr it should be fixed now.

 Respond  
ttteesstteerr   -  May 26, 2005

hi there! i get an error * Invalid format: $+ (line 170, badwordscontrol.mrc) (mirc 6.16 @ dalnet - grnet)

 Respond  
brek   -  Mar 26, 2005

Hi Yoinx / i have a problem with your script / i put the bad words but when i quit or exit from a server and i go back to the server then the badwords that i put there was disappear / i think something happen with hash table??? i dont know / pls help / i need your script!! thanks

 Respond  
Yoinx   -  Mar 11, 2005

I updated this a while back to allow for wildcards.

 Respond  
Yoinx   -  Feb 12, 2005

No I made it the way it is for a specific reason, if I had it set to wildcards people would do stuff like add ass then it would kick with normal words that contain that string. I made it the way it is since you can add as many variations of the word as you want, so that it ONLY takes action if it matches exactly to what you dont want to be said.

 Respond  
dreko   -  Feb 12, 2005

this is a great code but if you want to do perfect do for us pls 1. command from menubar 2. words with /example : f?uck* -for the wods fucker,fuckers etc (pls do that things :) )

 Respond  
PCTech   -  Feb 09, 2005

.. have already passed it on to 2 people!

 Respond  
PCTech   -  Feb 09, 2005

This is a very handy script. I am an IRCop on \'a particular server\' and I can see that many of my users would want this.

 Respond  
[-Superboyz-]   -  Jan 21, 2005

oic ... nice bro ^^

 Respond  
Yoinx   -  Jan 10, 2005

You have to restart the client to make the table or use \"/hmake badwords 50\"

 Respond  
[-Superboyz-]   -  Jan 10, 2005
  • /hadd: no such table \'badwords\' (line 63, script1.ini)
 Respond  
Yoinx   -  Jan 01, 2005

Thanks

 Respond  
DarthReven   -  Jan 01, 2005

looks good yonix

 Respond  
LIQUID_NiTrO   -  Jan 01, 2005

Very nice and highly practical. Haven\'t come across a badword script this fancy before.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.