You can do something like this:

on *:open:?:*:{
if (!$IsFriend($nick) && $AcceptFromFriendsOnly) {
query $nick Sorry $nick $+ , But I'm Busy ATM!
close -m $nick
}
}

$IsFriend would be your alias to return if the nick who queried you is a friend or not bassed on the passed in nickname.

$AcceptFromFriendsOnly would be your alias to return if your options to ignore others is enabled or not.

The above statement checks to see if:

A: The nick is not a friend,

And

B: The Option To Ignore Queries From Non-Friends Is Enabled

If so, the user is sent a message, and the query window closed!

It is up to you to create those aliases accordingly to your requirement, or you may choose to do it a totaly different way!


Hope it helps

- Chris