The on KICK event triggers when a user is kicked from a channel.
Format: on <level>:KICK:<#[,#]>:<commands>
Example: on 1:KICK:#mirc,#irchelp:/msg $nick Oops! ;)
on 5:KICK:#:/invite $knick $chan | /msg $nick Hey, $knick is my friend!
This triggers when a user who has access level 5 is kicked out of any channel. $knick refers to the nickname of the user who was kicked.
You can compare the levels of the kicker and the kicked users by prefixing the line with <,>,<=,=>,<>, or =, in the following way:
on >=2:KICK:#mIRC:/msg $chan $nick kicked $knick (legal)
on 1:KICK:#mIRC:/msg $chan $nick kicked $knick (illegal)
In this situation, if the kickers level is larger than or equal to the kicked users level, then it is a legal kick. Otherwise, it defaults to the second on KICK event which indicates that it is an illegal kick. Remember, this is comparing the kickers and kicked users levels and has nothing to do with the level "2" in the definition.
Note: This event only works on a nickname because the IRC server only sends the nickname of the user being kicked and not an address.