Code:
on *:TEXT:!run:*:{
  var %cid = 1
  while ($scon(%x).status) {
    if ($v1 == connected) {
      scon %x
      var %# = 1
      while ($chan(%#)) {
        if ($nick($v1,0) < 3) { part $chan(%#) }
        inc %#
      }
    }
    inc %cid
  }
}