The mask 2 in the ban command makes mIRC look up the address for the nick, then ban using the format you wanted. It shows to you as the nick being banned, but in reality it's the address that's being banned.
The serverop event is for if the server ops you in the channel, rather than a person/bot that's in the channel.
Other errors and requests changed in original code.