Why don't you just issue /ignore -p * when you turn %noMSG On and /ignore -pr * when you turn it Off?
Code:

on ^*:OPEN:?: {
  if (%noMSG == On) {
    .msg $nick No contesto Privados en este Momento
    .ignore -pu4 *
    halt 
  }
}