mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2003
Posts: 157
RuFy Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2003
Posts: 157
Code:
alias massdeop {
  :begindeop
  unset %nicks
  if ($nick($$1,0,o) > 1) {
    var %i = 0
    :checkdeop
    inc %i
    set %curnick $nick($$1, $+ %i $+ ,o)
    if (%curnick != $me) { set %nicks $addtok(%nicks, $+ %curnick $+ ,32) }
    if ($numtok( $+ %nicks $+ ,32) == 3) { .mode $$1 -ooo %nicks | goto begindeop }
    else { goto checkdeop }
  }
  else { goto end }
  :end
}

Usage //massdeop #channel

This code freeze your mIRC and disconnect you for Connection Reset By Peer. shocked

Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
it will always go to :checkdeop

While loops are Alot more easy to debug and to use and look alot cleaner smile , got the hint ? :tongue:


$maybe
Joined: Nov 2003
Posts: 157
RuFy Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2003
Posts: 157
I have already tryied with While Loops.
Result? Same.
Someone can explain me why?

mad

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Show us your while loop code.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You need a way to exit your loop, no matter what style of looping you choose to do.

Example (using your code from above rather than rewriting with WHILE):
Code:
alias massdeop {
  :begindeop
  unset %nicks
  if ($nick($$1,0,o) > 1) {
    var %i = 0
    :checkdeop
    inc %i
    [color:red]if ($nick($$1,0,o) < %i) { halt }[/color]
    set %curnick $nick($$1, $+ %i $+ ,o)
    if (%curnick != $me) { set %nicks $addtok(%nicks, $+ %curnick $+ ,32) }
    if ($numtok( $+ %nicks $+ ,32) == 3) { .mode $$1 -ooo %nicks | goto begindeop }
    else { goto checkdeop }
  }
}


Note that I removed the else { goto end } and :end parts at the end of your script. They do nothing for you.

Also, note that you can do the same addition in a while loop.


*EDIT* Here it is with a WHILE loop... I couldn't just leave it with GOTO. smirk

Code:
alias massdeop {
  var %c = 1
  var %i = $nick($$1,0,o)
  while (%c <= %i && %i > 1) {
    if ($nick($$1,%c,o) != $me) {
      var %nicks = %nicks $nick($$1,%c,o)
    }
    if ($numtok(%nicks,32) == 3) {
      .mode $$1 -ooo %nicks
      unset %nicks
    }
    inc %c
  }
  if (%nick != $null) {
    .mode $$1 -oo %nicks
  }
}


Note that this one also will deop the remaining ops. You previous code will deop groups of 3, but if 1 or 2 remain in %nicks at the end, you wouldn't deop them.

Last edited by Riamus2; 11/10/05 01:31 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Nov 2003
Posts: 157
RuFy Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2003
Posts: 157
Thanks for the help. smile

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Are you sure it's not Riamus you want to be thanking? After all he's the one that gave you code.


Gone.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I don't mind, honestly grin


Link Copied to Clipboard