If you use the ^ then you can HALT the window BEFORE it opens instead of having it pop open and then close.
on ^*:open:?:{
if (%PMBlock == ON) {
.msg $nick Your Custom Message.
halt
}
}
Also, For the switch you could have it appear as one entry which becomes more useful as your menu list gets longer.
menu menubar {
PM Blocker is now $iif(%PMBlock,On,Off): $iif(%PMBlock,unset,inc) %PMBlock
}
_____________________________________________________________________________
There is no real need to set the variable to On/Off instead just inc it for a true and unset it to create a false. Then the above code could be:
on ^*:open:?:{
if %PMBlock {
.msg $nick Your Custom Message.
halt
}
}