Note: The mainteinance of the scripting examples is discontinued since I no longer have an interest to continue doing so. The pages will remain here, for now, but that might not be the case in the future. You are free to download all the material on these pages and set a up mirror, or even continue the maintenance of the material by enhancing the examples yourself.
All the material in these examples are for the mIRC version 6.03. It is very likely that some or most of these examples won't work in future versions.
Always ban first, kick after. If you kick first, the user may rejoin before you get to ban. You need a working Internal Address List (IAL) in order to set the ban right away. You can get the banmask by using $address(<nick>,<type>). For static hosts it's best to use type 2 (*!*@host.domain) and for dynamic hosts type 3 (*!*ident@*.domain). See /help $mask to list all the available types. When making this alias you should decide whether you want an ability to remove channel operators. If you don't want to remove them, you should add a protection check and on the other hand if you want to be able to remove them, you should deop them first so that they can't remove the ban before being kicked.
I personally use an alias that tries to determine whether the host is dynamic or static. However this starts to be useful only if you are operator on a channel that has really lots and lots of abuse. On normal situations it's usually best to type the banmask manually with /mode or /ban command. A ban enforcement script might be useful in this case.
; Usage: /bk <nick> <message>
alias bk {
; Test if the user's address is in IAL
if ( $address($1,5) != $null ) mode # -o+b $1 $address($1,2)
else ban $active $1 2
; Kick!
kick # $1 $2-
}