This snippet comes fully configurable and easy to use. You can edit the words in the snippet itself and edit the number of counts with the %x variable. This checks to see how many times the word is said until the user is banned. The snippet also checks events such as on part and on quit to make sure that the variables for a nick is unset.
; Swear kicker
; by simplicity
on @*:text:*:#:{
var %swear = shit,fuck
if ($strip($1-,$gettok(%swear,1-,44))) {
var %x = 3
var %y = 1
inc %swear.num. [ $+ [ $nick ] ]
while (%swear.num. [ $+ [ $nick ] ] isnum %y) {
msg $chan $+($nick,:) Do not swear in $+($chan,$chr(46)) Any more of this conduct and you will be banned.
halt
}
while (%swear.num. [ $+ [ $nick ] ] iswm %x) {
unset %swear.num. [ $+ [ $nick ] ]
ban -k # $nick You have been banned for swearing.
}
}
}
on *:part:#:{
if ($gettok(%swear.num. [ $+ [ $nick ] ],1-,44)) { unset %swear.num. [ $+ [ $nick ] ] }
}
on *:quit:{
if ($gettok(%swear.num. [ $+ [ $nick ] ],1-,44)) { unset %swear.num. [ $+ [ $nick ] ] }
}
Coding is fairly simple, and there are a couple things that can be improved on. Try making the $nick a $wildsite. What if the nick changed nicks? He could evade your kicker. Make the $strip($1-) an $istok so that it doesn\'t retrieve the word from another word that has been combined. And you do not need the %y variable. That could be simply a while (%variable <= %x)
What about if you exit? Everything would still be saved. Add an on :exit event to unset the variables. ( unset %swear.num. )