there are a few ways u could go about doing this
the simplest is probably adding yourself to notify and useing the on unotify event
check to see if its your nick that has left, and if so change your nick to that niick and identify
the problem however will be if u ever wish to change your nick to something else, mIRC will automaticly change it back, perhaps u can add a flag in a /nick alias that unsets after 10 secs or so, that the on unotify event can read to see if it should change your nick back or not
this should be enough information to get you though, but if u require more speak up.
Cobra^