@SR... Jethro aready gave a script 99% like that. all you did was change $Chan to $Active. and added the if ($me is !isno active) actually you said actice. and for it to work he doesn't need to specify what channel. and hopefully they are on the channel they are using it on. your's is redundant to me.
Seems like good work. but as Jethro has said. Not worth the time to continually check the same identifier, checking if $1 is provided over and over, isn't worth the time it takes to do that.