Hi,

you could use this code:
Code:
 
on ^*:OPEN:?:*: if !$istok(%friends,$nick,44) { .msg $nick I'm not accepting private messages right now | halt } 


This is just an example where someone opens a query to you, it will check if it's nickname is in the variable %friends, if it isn't, it will message them with that msg, and simply halt mIRC from opening the queryt. That's why I've used the ON OPEN event.

There are of course many variations possible. You could e.g. use user levels and then use the /auser command. There are always multiple ways of achieving soemthing.

You could also add a 'Pager' that will let you know if someone tried to message you (maybe u forgot to add a friend to the variable %friends) and atleast you will see that someone tried to msg you.

Example:
Code:
#msgblocker on
on ^*:OPEN:?:*:{ 
  if !$istok(%friends,$nick,44) { 
    if !$window(@queries) { window @queries }
    aline -h @queries $timestamp $nick $+ : $1-
    .notice $nick I'm not accepting private messages right now 
    halt 
  } 
}
#msgblocker end
 [color:red]  [/color] 
Menu nicklist {
  Msgblocker
  .Add Nick:{ %friends = $addtok(%friends,$1,44) | echo -a $1 has been added to your friends list }
  .Remove Nick:{ %friends = $remtok(%friends,$1,1,44) | echo -a $1 has been removed from your friends list }
  .-
  .$iif($group(#msgblocker) == on,Disable,Enable) Msgblocker:{
    if ($group(#msgblocker) == on) disable #msgblocker
    else enable #msgblocker
  }
} 


You'll notice that I added a Nicklist popup wiht it, where u can enable/disable this script, and you can add/remove friends.

Note that variables have a limit to the amount of characters they contain. If you have hundreds of friends, you're better of with using for instance a Hash Table.

Example:
Code:
  
#msgblocker on
on ^*:OPEN:?:*:{ 
  if !$hget(friends,$nick) { 
    if !$window(@queries) { window @queries }
    aline -h @queries $timestamp $nick $+ : $1-
    .notice $nick I'm not accepting private messages right now 
    halt 
  }
}

on *:START:{ hmake friends | hload friends $+(",$mircdir,friends.txt,") }
on *:EXIT: hsave -o friends friends.txt 

#msgblocker end
 [color:red]  [/color] 
Menu nicklist {
  Msgblocker
  .Add Nick:{ hadd friends $1 blah | echo -a $1 has been added to your friends list }
  .Remove Nick:{ hdel friends $1 | echo -a $1 has been removed from your friends list }
  .-
  .$iif($group(#msgblocker) == on,Disable,Enable) Msgblocker:{
    if ($group(#msgblocker) == on) disable #msgblocker
    else enable #msgblocker
  }
}


Here you can simply put in an unlimited number of nicknames, as hash tables can store huge amounts of information. When you start mIRC it will load the friends.txt into a hash table, and when exiting mIRC, it will save to file.

Hope this was somewhat helpful to you!

Greetz


Gone.