Code:
on @*:text:!register*:#:{
  if ($nick !isop $chan) {    .msg $nick Sorry, but only ops can use this command  }
  elseif ($$2 isop $chan) {    .msg $nick $$2 is already opped  }
  elseif ($$2 !ison $chan) {    .msg $nick $$2 isn't on $chan  }
  elseif (op isin $level($address($$2,8))) {    .msg $nick $$2 is already registered  }
  else {
    var %pass
    while $len(%pass) < 8 {
      var %c = $r(1,3)
      if %c == 1 {        %c = $r(0,9)      }
      elseif (%c == 2) {        %c  = $r(a,z)      }
      else {        %c = $r(A,Z)      }
      %pass = $addtok(%pass,%c,32)
      inc %a
    }
    %pass = $remove(%pass,$chr(32))
    .mode # +o $$2
    .msg $nick You have been granted Ops access by $nick $+ . Your temporary password is %pass $+ .
    .msg $nick We recommend that you change this soon by typing /msg $me !pass <old pass> <new pass>
    .guser -a op $$2 8 $md5(%pass)
  }
}
on op:text:!pass & &:?:{
  if ($md5($$2) === $ulist($address($nick,8)).info) {
    .guser -a op $nick 8 $md5($$3)
    .msg $nick Your password has been changed.
  }
  else {    .msg $nick Sorry, but the password you entered doesn't match my records  }
}
on @op:join:#:{
  .msg $nick Please enter your password to obtain ops status
}
on op:text:*:?:{
  if ($md5($$1) !=== $ulist($address($nick,8)).info) {    .msg $nick Sorry, but the password you entered doesn't match my records  }
  var %a = 1, %b = $comchan($nick,0)
  while %a <= %b {
    if ($me isop $comchan($nick,%a)) && ($nick !isop $v2) {      .mode $v2 +o $nick    }
    inc %a
  }
}