Ok try this then:
Code:
on *:JOIN:#:{
  if ( $nick == $me ) {
    set %ial $+ # 1
    who #
  }
  else {
    set %ial $+ $nick 1
    userhost $nick
  }
}
raw 352:*:{ 
  if ( $eval(% $+ ial $+ $2,2) ) {
    if ( * isin $7 ) {
      echo 4 -a $6 is an IRCOp
    }
    haltdef
  }
}
raw 315:*:{ 
  if ( $eval(% $+ ial $+ $2,2) ) {
    unset %ial $+ $2
    haltdef
  }
}
raw 302:*:{
  if ( $eval(% $+ ial $+ $remove($gettok($2,1,61),*),2) ) {
    if ( * isin $2 ) {
      echo 4 -a $remove($gettok($2,1,61),*) is an IRCOp
    }
    unset % $+ ial $+ $remove($gettok($2,1,61),*)
    haltdef
  }
}

Replace the echoes with whatever you want to do, of course..