Swear Kicker

By xdesoto on Jul 07, 2007

Alt R file new copy snippet paste in new remote

; Menu

menu channel {
  Swear Kick
  .Config: /dl_swear
  .-
  .Unload: /dl_swear.unload
}

; -------------------------------------------------------------------------------------------------
; Alias

; old pop-up method of listing words.  You can use it if thats your preference, just lists the words
; in the popup.  When clicked, a word is deleted.
alias swears {
  if ($$1 == begin) return -
  else if ($$1 == end) return -
  else if ($$1 <= $hget(swear, 0).item) {
    var %severity = $hget(swear, $hget(swear, $$1).item)
    var %action = $iif(%severity == 1, Warn, $iif(%severity == 2, Kick, $iif(%severity == 3, Ban, Kick/Ban)))
    return $hget(swear, $$1).item $chr(9) %action : /hdel swear $hget(swear, $$1).item $chr(124) /echo -a Item Removed
  }
}

alias dl_swear.loadlst {
  var %word 1
  while (%word <= $hget(swear, 0).item) {
    if (%word == 1) /did -r $$1 $$2
    if ($3 == $null) /did $iif(%word == 1, -ca, -a) $$1 $$2 $hget(swear, %word).item 
    else /did $iif($hget(swear, %word).item == $3, -ca, -a) $$1 $$2 $hget(swear, %word).item
    /inc -u0 %word
  }

  /did -u $$1 40,41,42,43
  var %severity = $calc(40 + ($hget(swear, $did($$1, $$2).seltext) - 1))
  /did -c $$1 %severity
}

alias dl_swear.unload {
  if ($$?!="Unload Swear Kick?") {
    if ($$?!="Would you like to remove the hash file containing the swear words also?") && ($isFile(swears.hsh)) $&
      .remove swears.hsh
    .timerswear off
    .timer 1 1 /set -u0 %a = $input(Swear Kick Script has been unloaded, oi, Script Unloaded)
    .unload -rs $script
  }
}

alias dl_swear {
  if ($dialog(dl_swear)) /dialog -vie dl_swear dl_swear
  else /dialog -m dl_Swear dl_swear
}

; -------------------------------------------------------------------------------------------------
; Events

on 1:START: {
  /hmake swear 100
  if ($isFile(swears.hsh)) /hload -b swear swears.hsh
  else {
    var %starter = ass asshole assmunch bitch biatch cunt cock $&
      cocksucking deuch dick fuck fucker fucking hell jerk jackoff $&
      motherfucking nigger nigga niggah negro prick shit shithead $&
      shits shitter, %word = 1
    while (%word <= $numtok(%starter, 32)) {
      /hadd swear $gettok(%starter, %word, 32) 2
      /inc %word
    }
    /hsave -bo swear swears.hsh
  }
  .timerswear 0 300 /hsave -bo swear swears.hsh

  if (%swear.ban == $null) /set %swear.ban 60
}

on 1:EXIT: {
  /hsave -bo swear swears.hsh
}

on 1:UNLOAD: {
  if ($hget(swear)) && ($isFile(swears.hsh)) /hsave -bo swear swears.hsh
  /hfree swear
}

on @1:TEXT:*:#: {
  if ($nick !isop $chan) || (($nick isop $chan) && (%swear.kickop == 1)) {
    var %word = 1, %clean = 0
    while (%word <= $numtok($1-, 32)) {
      var %curword = $remove($strip($gettok($1-, %word, 32), burc), ?, ., !)
      if ($hget(swear, %curword)) {
        var %severity = $ifmatch
        if (%severity == 1) .timerswear 1 1 /notice $chan Please Do Not Use That Word ( $+ $replace(%curword,a,?,e,?,i,?,o,?,u,?) $+ ) In Here, $nick 
        else if (%severity == 2) /kick $chan $nick Kicked for swearing ( $+ $replace(%curword,a,?,e,?,i,?,o,?,u,?) $+ ) 
        else if (%severity == 3) {
          .timerswear 1 1 /notice $chan PLease Do Not Use That Word ( $+ $replace(%curword,a,?,e,?,i,?,o,?,u,?) $+ ) In Here .. $nick ( $+ $duration($iif(%swear.ban == $null, 60, %swear.ban)) ban) 
          /mode $chan +bb $nick $address($nick, 11) | .timer 1 %swear.ban /mode $chan -bb $nick $address($nick, 11)
        }
        else if (%severity == 4) {
          /kick $chan $nick Kicked for swearing ( $+ $replace(%curword,a,?,e,?,i,?,o,?,u,?) $+ ) ( $+ $duration($iif(%swear.ban == $null, 60, %swear.ban)) ban) 
          /mode $chan +bb $nick $address($nick, 11)
          .timer 1 $iif(%swear.ban == $null, 60, %swear.ban) /mode $chan -bb $nick $address($nick, 11)
        }
        else /inc %clean
      }
      if (%clean != %word) %word = $calc($numtok($1-, 32) + 1)
      /inc %word
    }
  }
}

; -------------------------------------------------------------------------------------------------
; Dialog

dialog dl_swear {
  title "Swear Protection"
  size -1 -1 150 80
  option dbu
  text "Words:", 1, 5 6 20 8, right
  combo 10, 30 5 70 50, size drop
  button "Del", 20, 105 5 20 10
  button "Add", 30, 125 5 20 10
  box "Action", 2, 0 15 150 30
  radio "Warn User", 40, 5 22 65 10, group
  radio "Kick User", 41, 75 22 65 10
  radio "Ban User", 42, 5 32 65 10
  radio "Kick/Ban User", 43, 75 32 65 10
  check "Kick Ops Too", 50, 5 49 45 10
  text "Ban Duration:", 4, 70 50 35 8
  edit "", 60, 110 49 20 10
  text "Mins", 5, 130 50 15 8
  button "Save And Exit", 70, 35 65 35 10
  button "Cancel", 80, 75 65 35 10, cancel
}

on 1:DIALOG:dl_swear:INIT:*: {
  /hsave -bo swear swears.hsh
  /dl_swear.loadlst $dname 10
  if (%swear.kickop) /did -c $dname 50
  /did -ra $dname 60 $iif(%swear.ban == $null, 1, $calc(%swear.ban / 60))
}

on 1:DIALOG:dl_swear:SCLICK:10: {
  /dl_swear.loadlst $dname 10 $did(10).seltext
}

on 1:DIALOG:dl_swear:SCLICK:20: {
  /hdel swear $did(10).seltext
  /did -d $dname 10 $did(10).sel
  /dl_swear.loadlst $dname 10
}

on 1:DIALOG:dl_swear:SCLICK:30: {
  var %newword = $$?="Enter New Word:"
  /hadd swear $gettok(%newword, 1, 32) 1
  /dl_swear.loadlst $dname 10 %newword
}

on 1:DIALOG:dl_swear:SCLICK:40: {
  if ($did(10).sel != $null) /hadd swear $did(10).seltext 1
}

on 1:DIALOG:dl_swear:SCLICK:41: {
  if ($did(10).sel != $null) /hadd swear $did(10).seltext 2
}

on 1:DIALOG:dl_swear:SCLICK:42: {
  if ($did(10).sel != $null) /hadd swear $did(10).seltext 3
}

on 1:DIALOG:dl_swear:SCLICK:43: {
  if ($did(10).sel != $null) /hadd swear $did(10).seltext 4
}

on 1:DIALOG:dl_swear:SCLICK:50: {
  /set %swear.kickop $did(50).state
}

on 1:DIALOG:dl_swear:EDIT:60: {
  /set %swear.ban $iif($did(60) == $null, 60, $calc($did(60) * 60))
}

on 1:DIALOG:dl_swear:SCLICK:70: {
  /hsave -bo swear swears.hsh
  /dialog -c $dname $dname
}

on 1:DIALOG:dl_swear:SCLICK:80: {
  /hfree swear
  /hmake swear 100
  if ($isFile(swears.hsh)) /hload -b swear swears.hsh
}

; 
; --------------------------------------------------------------------------------------------

Comments

Sign in to comment.
WIRED   -  Sep 16, 2007

Removed.

 Respond  
kerstt   -  Jul 08, 2007

wohow huge, and nice.
but i think well yeah..
whats wrong with

on $*:TExt:/(word1|word2|word3|etc)/:#: ban -k $chan $nick 2 dont say $regml(1)

7/10

 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.