mIRC Homepage
Posted By: LostShadow On op event not working. - 13/07/07 09:33 PM
Code:
on *:op:#: {
  if ((($opnick == $me) && ($nick != $me) && ($nick != ChanServ))) { 
    /echo -s You have been 12opped by $nick in $chan at $asctime(h:nn:ss) $+ .
  }
}


Works just fine, but when I have..

Code:
on *:op:#: {
  if ($opnick == me) {
    /echo $chan hi
  }
}


(Used ChanServ to op me).

That doesn't trigger, not even the echo..

The 2nd code, I added before the 1st code (if statement only in the same on op event). But the echo won't trigger even though it is first.
Posted By: starbucks_mafia Re: On op event not working. - 13/07/07 09:50 PM
Quote:
on *:op:#: {
if ($opnick == $me) {
/echo $chan hi
}
}
Posted By: weakness Re: On op event not working. - 13/07/07 09:50 PM
lol
Posted By: LostShadow Re: On op event not working. - 13/07/07 10:28 PM
Okay thank you!

Code:
on *:op:#: {
  if (($opnick == $me) && ($nick != $me)) {
    /echo $chan hi
    var %i = 1
    while (%i < 20) {


So when ChanServ ops me, my mIRC freezes. I Ctrl Break, and the line halted was the while line... Did it several times. I don't know why mIRC freezes.
Posted By: RoCk Re: On op event not working. - 13/07/07 10:30 PM
What is the loop for and did you inc %i inside the loop?
Posted By: LostShadow Re: On op event not working. - 13/07/07 10:31 PM
Okay.. I debugged.

I added an echo $chan %i after the var %i = 1 and the while.

1
1
1
1
1

No wonder it stops, mIRC floods infinitely..

I did have the inc... Sometime after...
Posted By: LostShadow Re: On op event not working. - 13/07/07 10:32 PM
Originally Posted By: RoCk
What is the loop for and did you inc %i inside the loop?


So far I got..

Code:
on *:op:#: {
  if (($opnick == $me) && ($nick != $me)) {
    /echo $chan hi
    var %i = 1
    echo $chan %i
    while (%i < 20) {
      echo $chan %i
      if ($address($me,%i) isban $chan) {
        /mode $chan -bbbb $v1 $v1
        inc %i
      }
    }
  }
  <Other stuff>
}
Posted By: RoCk Re: On op event not working. - 13/07/07 10:48 PM
You're trying to remove any channel bans that match your address when you're opped by someone other than yourself?

Code:
on *:OP:#: {
  if (($opnick == $me) && ($nick != $me)) {
    var %i = 1,%bans
    while ($ibl(#,%i)) {
      if ($v1 iswm $address($me,5)) {
        var %bans = %bans $v1
        if ($numtok(%bans,32) == $modespl) {
          .timer 1 %i mode # $+(-,$str(b,$v1)) %bans
          var %bans
        }
      }
      inc %i
    }
    if (%bans) .timer 1 %i mode # $+(-,$str(b,$numtok(%bans,32))) %bans
  }
  ; <Other stuff>
}


~ Edit ~

Fixed mistake & shortened the code a tiny bit. This should really be move to Scripts & Popups.
Posted By: Bekar Re: On op event not working. - 13/07/07 11:03 PM
iswim?
Posted By: RoCk Re: On op event not working. - 13/07/07 11:05 PM
Oops. Fixed .. thanks. smile

It must've been 'i swim' because I've been thinking about going out back and floating in the pool with a cold beer. wink
Posted By: LostShadow Re: On op event not working. - 13/07/07 11:12 PM
Wow Rocks thanks. Well I think this topic can be deleted too.
© mIRC Discussion Forums