I'm working on creating a script for my IRCops/Net Admins and I'm having issues with a channel closure script.

I had this script years ago but have been unable to find it what I'm wanting it to do:

When the IRCop needs to close a channel they activate a menu option to enable the script
It asks them for the channel they need to close

Once they input the chan name the script should join them to the channel send a message -oaqvvh everyone on the channel send a message that the channel is in violation of the TOS for the network change the topic set modes msuk on the channel drop the channel from chanserv registration and then kick everyone from the channel with the reason $chan has been closed due to violation of TOS.

I had something close to working but it kept crashing out on me when I ran it.

For anyone who was around back in the MSN chat days think of when the Sysops would come in and close rooms that's similar to what I'm looking for.