All pastes #677392 Raw Edit

Someone

public text v1 · immutable
#677392 ·published 2007-08-31 23:38 UTC
rendered paste body
alias power {
  var %tc = 0,%tu = 0,%oc = 0,%po = 0,%i = $scid(0)
  while (%i) {
    scid $scon(%i)
    if ($status == connected) {
      var %c = $chan(0)
      while (%c) {
        inc %tc
        inc %tu $calc($nick($chan(%c),0) -1)
        if ($me isop $chan(%c) || $me ishop $chan(%c)) {
          inc %oc
          inc %po $calc($nick($chan(%c),0) -1)
        }
        dec %c
      }
    }
    dec %i
  }
  set %pc1 $calc( %po / %tu )
  set %pc2 $ceil($calc( %pc1 * 100 ))
  set %pc3 $calc( %oc / %tc )
  set %pc4 $ceil($calc( %pc3 * 100 ))
  scid -r
  if (!$isid) {
    if ($1 == -e) { echo -a $gtd(Stats) you're opped in $sd($+(%oc,/,%tc)) channels on $sd($scid(0)) $iif($scid(0) == 1,network.,networks.) You have the power over $sd($+(%po,/,%tu)) users. }
    else { say I'm opped in $+([,%oc,/,%tc,])$+ channels on $+([,$scid(0),]) $iif($scid(0) == 1,network.,networks.) I have the power over $+([,%po,/,%tu,])$+ users. That is $+([,%pc4,%,]) of channels that I am opped on, and $+([,%pc2,%,]) of users that I control. }
  }
  else { return %po }
}