rendered paste body; -------------------------------------------------------------------------------------------------
; Swear Kick Add-On - Created by ~*~ Tengauge12 ~*~
; --
; Simple swear-kick add-on that is dialog based for easy configuration. Words are easily configured
; through the dialog, including selecting and individual action per word.
;
; Features:
; Dialog for easy configurtion
; Uses Hash table for fast responces.
; Uses per-word circumstances (ability to specify an action on a per-word basis)
;
; Installation:
; Load this script into any directory, and type /load -rs directory\to\swearing.mrc
; The script will automatically create a swear file (swear.hsh) containging a list of words
; that has been included with this script.
;
; Uninstallation:
; When uninstalled, the dialog and hash table is deleted. From there, just remove this script.
; -------------------------------------------------------------------------------------------------
; -------------------------------------------------------------------------------------------------
; Versions:
; --
; v1.1 (Changes made)
; - Added ability to use wildcards in the filter.
; - fixed unload if script patch had spaces
; - Changed dialog appearance (same feel, different style)
;
; v1.0 (Public Release)
; -------------------------------------------------------------------------------------------------
; -------------------------------------------------------------------------------------------------
; Menu
menu menubar,channel {
Swear Kick
.Configure: /kt_swear
.-
.Unload: /kt_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 kt_swear.loadlst {
/dialog -r $$1 $$2
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 kt_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
/unset %swear.* | ; added per suggestion of tye
.unload -rs $+(",$script,")
.echo -q $input(Swear Kick Script has been unloaded, oi, Script Unloaded)
}
}
alias kt_swear.filter {
return $replace($1-,a,?,e,?,i,?,o,?,u,?)
}
alias kt_swear {
if ($dialog(kt_swear)) /dialog -vie kt_swear kt_swear
else /dialog -m kt_swear kt_swear
}
; -------------------------------------------------------------------------------------------------
; Events
on 1:START: {
/hmake swear 100
if ($isFile(swears.hsh)) /hload -b swear swears.hsh
else {
var %starter = ass asshole b*tch c*nt cock* $&
deuch dick *fuck* hell jerk jackoff $&
n*gg* negro prick* shit*, %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: {
if ($hget(swear)) /hsave -bo swear swears.hsh
}
on 1:UNLOAD: {
if ($hget(swear)) /hfree swear
if ($isFile(swears.hsh)) .remove swears.hsh
}
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)), ?, ., !)
if ($hfind(swear, %curword, 1, W)) {
var %severity = $hget(swear, $ifmatch)
if (%severity == 1) .timerswear 1 1 /msg $chan Please do not use that word ( $+ $kt_swear.filter(%curword) $+ ) in here, $nick
else if (%severity == 2) /kick $chan $nick Kicked for swearing ( $+ $kt_swear.filter(%curword) $+ )
else if (%severity == 3) {
.timerswear 1 1 /msg $chan Please do not use that word ( $+ $kt_swear.filter(%curword) $+ ) 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
; if you liked the old dialog, here it is. just rename it to the
; same as the one below it
dialog kt_swear_old {
title "KingTomato 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 && Exit", 70, 35 65 35 10
button "Cancel", 80, 75 65 35 10, cancel
}
; new dialog
dialog kt_swear {
title "KingTomato Swear Protection"
size -1 -1 140 70
option dbu
text "Swear:", 1, 0 4 30 8, right
combo 10, 35 2 70 60, size drop
link "Add", 30, 108 4 12 8
link "Delete", 20, 122 4 18 8
box "Actions", 2, 0 17 140 35
radio "Warn", 40, 5 27 25 10, group
radio "Kick", 41, 35 27 25 10
radio "Ban", 42, 65 27 25 10
radio "Kick & Ban", 43, 95 27 40 10
check "Kick operators also", 50, 5 38 57 10
text "Ban time:", 3, 85 39 30 8, right
edit "", 60, 117 37 15 10
button "Save && Exit", 70, 54 55 40 10, ok
button "Cacel", 80, 100 55 40 10, cancel
}
on 1:DIALOG:kt_swear:INIT:*: {
/hsave -bo swear swears.hsh
/kt_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:kt_swear:SCLICK:10: {
/kt_swear.loadlst $dname 10 $did(10).seltext
}
on 1:DIALOG:kt_swear:SCLICK:20: {
/hdel swear $did(10).seltext
/kt_swear.loadlst $dname 10
}
on 1:DIALOG:kt_swear:SCLICK:30: {
var %newword = $$?="Enter New Word: $crlf You may also use wild cards (ex: f*cking)"
/hadd swear $gettok(%newword, 1, 32) 1
/kt_swear.loadlst $dname 10 %newword
}
on 1:DIALOG:kt_swear:SCLICK:40: {
if ($did(10).sel != $null) /hadd swear $did(10).seltext 1
}
on 1:DIALOG:kt_swear:SCLICK:41: {
if ($did(10).sel != $null) /hadd swear $did(10).seltext 2
}
on 1:DIALOG:kt_swear:SCLICK:42: {
if ($did(10).sel != $null) /hadd swear $did(10).seltext 3
}
on 1:DIALOG:kt_swear:SCLICK:43: {
if ($did(10).sel != $null) /hadd swear $did(10).seltext 4
}
on 1:DIALOG:kt_swear:SCLICK:50: {
/set %swear.kickop $did(50).state
}
on 1:DIALOG:kt_swear:EDIT:60: {
/set %swear.ban $iif($did(60) == $null, 60, $calc($did(60) * 60))
}
on 1:DIALOG:kt_swear:SCLICK:70: {
/hsave -bo swear swears.hsh
/dialog -c $dname $dname
}
on 1:DIALOG:kt_swear:SCLICK:80: {
/hfree swear
/hmake swear 100
if ($isFile(swears.hsh)) /hload -b swear swears.hsh
}
; EOF - Tengauge12
; -------------------------------------------------------------------------------------------------