$alevel(#,nick)
Posted by HellRaz0r
Sunday, October 29, 2006
Description: Returns nick's userlevel(srvx)


on *:text:!ping:#:{
  if ($alevel(#,$nick) >= 200) notice $nick Pong!
}
;$alevel(<chan>,<nick>)
alias alevel {
  hadd -mu3 acheck chan $1
  hadd -mu3 acheck nick $2
  ;Increase the pause number slightly if mirc isnt catching the access level in time.
  cs a $1 $2 | pause s 1
  var %access $hget($+(aresult.,$2),access) | .hfree -sw $+(aresult.,$2) | return %access
}
alias pause {
  ;Credit for /pause goes to FiberOPtics
  if ($version < 5.91) halt  
  elseif (!$regex(pause,$1-,/^m?s \d+$/Si)) halt
  elseif ($1 == ms) && ($istok(95 98 ME,$os,32)) halt
  elseif ($2 !isnum 1-) halt

  var %wsh = wsh $+ $ticks, %cmd
  if ($1 == s) %cmd = ping.exe -n $int($calc($2 + 1)) 127.0.0.1
  else %cmd = pathping.exe -n -w 1 -q 1 -h 1 -p $iif($2 > 40,$calc($2 - 40),$2) 127.0.0.1
  .comopen %wsh wscript.shell | .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c %cmd >nul,uint,0,bool,true)
}
on *^:notice:*:?:{
  if ($nick != ChanServ) halt
  var %acheck-chan $hget(acheck,chan), %acheck-nick $hget(acheck,nick)  
  if %acheck-nick {
    if $regex($1-,^.* has access (.*) in .*$) && $nick == ChanServ {
      .hfree -sw acheck
      if (!%acheck-nick) halt
      hadd -mu3 $+(aresult.,%acheck-nick) access $strip($regml(1))
      hadd -mu1 acheck-halt notice 1 | .timeracheck-unhalt 1 1 .hfree -sw acheck-halt
      halt
    }
    elseif $regex($1-,^.* lacks access to .*$) { .hfree -sw acheck | halt }
    elseif $regex($1-,^Account .* has not been registered.$) { .hfree -sw acheck | halt }
    elseif User with nick * does not exist. iswm $1- { .hfree -sw acheck | halt }
  }
  elseif ($regex($1-,^[.*] .*)) && ($hget(acheck-halt,notice)) halt
}
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world