Bad Words Script

By Aucun50 on Apr 07, 2009

This script could be 100x better but it was mostly so i could learn to do ini files right, nothing really special add/delete words add/delete channels.

dialog Words {
  title "Bad Words Control Center"
  size -1 -1 150 90
  option dbu
  Box "Add/Del Words" 1, 5 5 140 37
  Combo 2, 10 15 130 10
  Button "Add" 3, 10 28 65 10
  Button "Delete" 4, 75 28 65 10
  Box "Add/Delete Channels" 5, 5 45 140 37
  Combo 6, 10 55 130 10
  Button "Add" 7, 10 68 65 10
  Button "Delete" 8, 75 68 65 10
}
menu * {
  Bad Words
  .Setup/Editor: dialog -m Words Words
  .File: run words.ini
}
on *:dialog:words:*:*: {
  if ($devent == sclick) {
    if ($did == 3) {
      if (!$did(2)) { echo -a ***** Error nothing was put in the line | halt }
      elseif ($did(2) isin $readini(Words.ini,Words,Bad_Words)) { echo -a ***** That word is already in the file | halt }
      else { writeini Words.ini Words Bad_Words $did(2) $readini(Words.ini,Words,Bad_Words) | echo -a ***** You have added " $+ $did(2) $+ " to the file }
    }
    elseif ($did == 4) {
      if (!$did(2)) { echo -a ***** Error nothing was put in the line | halt }
      elseif ($did(2) !isin $readini(Words.ini,Words,Bad_Words)) { echo -a ***** That was not found in the file | halt }
      else { writeini Words.ini Words Bad_Words $remove($readini(Words.ini,Words,Bad_Words),$did(2)) | echo -a ***** You have deleted " $+ $did(2) $+ " from the file }
    }
    elseif ($did == 7) {
      if (!$did(6)) { echo -a ***** Error nothing was put in the line | halt }
      elseif ($chr(35) !isin $did(6)) { echo -a ***** Error $chr(35) was not found in channel name | halt }
      elseif ($did(6) isin $readini(Words.ini,Channels,Channel)) { echo -a ***** That channel is already in the file | halt }
      else { writeini Words.ini Channels Channel $did(6) $readini(Words.ini,Channels,Channel) | echo -a ***** You have added " $+ $did(6) $+ " to the file }
    }
    elseif ($did == 8) {
      if (!$did(6)) { echo -a ***** Error nothing was put in the line | halt }
      elseif ($chr(35) !isin $did(6)) { echo -a ***** Error $chr(35) was not found in channel name | halt }      
      elseif ($did(6) !isin $readini(Words.ini,Channels,Channel)) { echo -a ***** That was not found in the file | halt }
      else { writeini Words.ini Channels Channel $remove($readini(Words.ini,Channels,Channel),$did(6)) | echo -a ***** You have deleted " $+ $did(6) $+ " from the file }
    }
  }
}
on *:TEXT:*:#: {
  if ($chan isin $readini(Words.ini,Channels,Channel)) {
    var %words $readini(Words.ini,Words,Bad_Words)
    var %a = $numtok(%words,32) 
    while (%a) {
      if ( $gettok(%words,%a,32) isin $1- ) && (!%words. [ $+ [ $nick ] ]) { inc -u120 %words. [ $+ [ $nick ] ] | .notice $nick First Warning for Bad Words }
      elseif ( $gettok(%words,%a,32) isin $1- ) && (%words. [ $+ [ $nick ] ] == 1) { inc -u120 %words. [ $+ [ $nick ] ] | .notice $nick Second Warning }
      elseif ( $gettok(%words,%a,32) isin $1- ) && (%words. [ $+ [ $nick ] ] == 2) { kick $chan $nick Language Please | .notice $nick You had two warnings | unset %words. [ $+ [ $nick ] ] } 
      dec %a
    }
  }
}
on *:load: { dialog -m Words Words | echo -a ***** You have loaded Aucun's Bad Words script, if you have any problems contact Aucun at irc.auserv.com.strangled.net. Thanks for using my scripts enjoy }
on *:unload: { echo -a ***** You have unloaded Aucun's Bad Words script, if you didn't like are had a problem with it contact Aucun at irc.auserv.com.strangled.net. Thanks for using my scripts }

Comments

Sign in to comment.
Warriorii   -  Dec 22, 2010

I'm using it in my channel and it is working great. thanks

 Respond  
napa182   -  Apr 08, 2009

what i ment by $input is Ex:

noop $input(Error $chr(35) was not found in channel name,udho,Error!)

use noop along with it. that why it performs no operation.

 Respond  
Aucun50   -  Apr 08, 2009

I don't know how to setup list boxs that well but i'll give it a try, didn't know about $input thanks for the tip.

 Respond  
napa182   -  Apr 08, 2009

maybe use list boxs instead of combos, and maybe use $input instead of echos.

Daxter_Stacker  -  Dec 25, 2014

thx, it work

Sign in to comment

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.