to avoid repetition u can use $iif() and u can use tokenize and use $1 untead of $regml(1)
and /ban -k to kick ban user
on @$*:text:/^(\!purge|[+-](f|m))\b/iS:#:{
if !%f {
inc -u4 %f
tokenize 32 $strip($1-)
if ($1 == !purge) && ($2 ison #) {
ban -k # $2 2
notice $2 message's been purged.
}
var %x $pos($1,+,1),%y $right($1,1)
elseif ((%x) && (%y !isincs $chan(#).mode)) || ((!%x) && (%y isincs $chan(#).mode)) {
mode # $1
msg # $nick $+ , # is $iif(%x,now,no longer) $iif(%y = m,in slow mode.,in friends only mode.)
}
}
}