mIRC Homepage
Posted By: Vinniej Mass op, deop, voice, devoice. - 06/02/06 10:26 AM
Hi,

First of all, I've searched through google, forumsearch etc..

I'm looking for a snippet what does mass op, deop, voice and devoice when im doing ".op *, .deop *, .voice *, .devoice *". Its just for my bot. I only can find some Aliasses, but they wont work for my bot.

Thanks in advance
Posted By: NeUtRoN_StaR Re: Mass op, deop, voice, devoice. - 06/02/06 09:17 PM
so u want something to deop or whatever the entire room minus you im assuming
Posted By: NeUtRoN_StaR Re: Mass op, deop, voice, devoice. - 06/02/06 09:32 PM
[code]
on @N:text:.mdeop:#:{
var %n = 0
var %tn = $nick($chan, 0)
while (%n <= %tn) {
inc %n
if ($nick($chan,%n) != $me) {
mode $chan -o $nick($chan,%n)
}
}
}
[code]

i didnt know how to go about having a wildcard in the text matching section and having it no be interpretted as a wildcard
Posted By: Vinniej Re: Mass op, deop, voice, devoice. - 06/02/06 10:17 PM
I just want a mass op script, rest I can make it self, based on the mass op script.

I still can't find anything on Google.

* is a wildcard :>
Posted By: NeUtRoN_StaR Re: Mass op, deop, voice, devoice. - 06/02/06 10:42 PM
then you should be able to modify what i gave you to your own specifications
Posted By: MikeChat Re: Mass op, deop, voice, devoice. - 06/02/06 11:05 PM
I played with an alias that uses $modespl

give this a try
Code:
on @*:text:!mass *:#channel:{
  if ($nick isop $chan) { multimode $$2 $chan }
  if ($nick !isop $chan) { kick # $nick Don't do that }
}
alias Multimode {
  var %channel = $2
  if ($1 == deop) { 
    var %prefix = -
    var %mode = o
  }
  if ($1 == op) { 
    var %prefix = +
    var %mode = o
  }
  var %all.nicks = $nick(%channel,0), %i = 1
  while (%i &lt;= %all.nicks) {
    var %nic = $nick(%channel,%i)
    sline %channel %nic 
    inc %i
  }
  sline -r %channel $me
  sline -r %channel $nick
  var %modecnt = $modespl
  var %modelst = $snick(%channel)
  var %modenum = $gettok(%modelst,0,44)
  var %i = 1
  var %x = 1
  while (%i &lt;= %modenum) {
    var %listnk = %listnk $gettok(%modelst,%x,44)
    var %lenchk = $gettok(%listnk,0,32)
    if (%lenchk &gt;= %modecnt) {
      mode %channel %prefix $+ $str(%mode,$modespl) %listnk
      var %listnk = ""
    }
    if (%i == %modenum) {
      mode %channel %prefix $+ $str(%mode,$modespl) %listnk
      var %listnk = ""
    }
    inc %i
    inc %x
  }
}


EDIT I left out $chan in the isop checks
Posted By: drc4 Re: Mass op, deop, voice, devoice. - 07/02/06 02:51 AM
I see that you have a couple reply's, but I went ahead and took my own stab at it as well. You can specify * to mass op/deop/voice/devoice or supply a specific user to op/deop/voice/devoice.
Code:
on *:TEXT:.deop *:#ChannelName:{
  if ($$2 == $chr(42)) {
    set %m 1
    set %mt $nick($chan,0)
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) isop $chan) .mode $chan -o $nick($chan,%m)
      inc %m 1
    }
    unset %m
    unset %mt
  }
  else { mode $chan -o $$2 }
}
on *:TEXT:.op *:#ChannelName:{
  if ($$2 == $chr(42)) {
    set %m 1
    set %mt $nick($chan,0)
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) !isop $chan) .mode $chan +o $nick($chan,%m)
      inc %m 1
    }
    unset %m
    unset %mt
  }
  else { mode $chan +o $$2 }
}
on *:TEXT:.devoice *:#ChannelName:{
  if ($$2 == $chr(42)) {
    set %m 1
    set %mt $nick($chan,0)
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) isvoice $chan) .mode $chan -v $nick($chan,%m)
      inc %m 1
    }
    unset %m
    unset %mt
  }
  else { mode $chan -v $$2 }
}
on *:TEXT:.voice *:#ChannelName:{
  if ($$2 == $chr(42)) {
    set %m 1
    set %mt $nick($chan,0)
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) !isvoice $chan) .mode $chan +v $nick($chan,%m)
      inc %m 1
    }
    unset %m
    unset %mt
  }
  else { mode $chan +v $$2 }
}

The usage. ( .deop/.op/.voice/devoice <* or specific user> )
Just change the #ChannelName to the name of your Channel, and you're set. But you may want to add a user level, or a check to see if you're the one submiting the request, so that not everyone can abuse the bot.
Posted By: Vinniej Re: Mass op, deop, voice, devoice. - 07/02/06 11:28 AM
The script from drc4 is working. How to (de)op and (de)voice at the same time (max 6).

//mode #chan +ooooo $nick $nick $nick $nick $nick $nick ?
Posted By: drc4 Re: Mass op, deop, voice, devoice. - 07/02/06 03:46 PM
I'm short on time, but that wouldn't be hard to do. I'm currently in a combat readiness class, and on lunch. If no one attempts to knock this out before me, I'll do so as soon as the DOT is over. No idea when that will be.
Posted By: NeUtRoN_StaR Re: Mass op, deop, voice, devoice. - 07/02/06 10:30 PM
..deopdevoice: { mode # -ooooo $$1 $2 $3 $4 $5
mode # -vvvvv $1 $2 $3 $4 $5
}
i think 5 might be the most u can do at a time
im not sure
if that does turn out to be the case just add another line to each set with $6
Posted By: FiberOPtics Re: Mass op, deop, voice, devoice. - 07/02/06 10:39 PM
How many you can do at a time depends on $modespl. This number can and will vary accross different networks/servers, so it's not a good idea to hard code stuff. Use $modespl
Posted By: drc4 Re: Mass op, deop, voice, devoice. - 07/02/06 10:51 PM
alright, so I've gave it an attempt. First time using $modespl, but it was so simple. Give this a try.
Code:
on *:TEXT:.voice*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) !isvoice $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan + $+ $str(v,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    echo -a mode $chan + $+ $str(v,$modespl) %mn
    unset %m  
    unset %mt
    unset %mm
  } 
  else { mode $chan +v $$2 }
}
on *:TEXT:.devoice*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) isvoice $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan - $+ $str(v,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    echo -a mode $chan - $+ $str(v,$modespl) %mn
    unset %m  
    unset %mt  
    unset %mm
  } 
  else { mode $chan -v $$2 }
}
on *:TEXT:.op*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) !isop $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan + $+ $str(o,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    echo -a mode $chan + $+ $str(o,$modespl) %mn
    unset %m  
    unset %mt 
    unset %mm 
  } 
  else { mode $chan +o $$2 }
}
on *:TEXT:.deop*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) isop $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan - $+ $str(o,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    echo -a mode $chan - $+ $str(o,$modespl) %mn
    unset %m  
    unset %mt
    unset %mm
  } 
  else { mode $chan -o $$2 }
}

Just edit the #Channel, and the rest should work as the other script did. If you have any problems, let me know.
Posted By: Vinniej Re: Mass op, deop, voice, devoice. - 08/02/06 07:52 AM
Well, this one works. But only 1 time and I have to do ".deop *" again for more deops. Same for op, voice and devoice.
Posted By: drc4 Re: Mass op, deop, voice, devoice. - 08/02/06 08:46 AM
Stupid Stupid me lol. I had an echo statement where I tested the script in a large channel. I wasn't the channel owner, therefore I couldn't test the script myself, actually oping/voicing everyone, so I had it echo the command line to me. And I didn't take out one of the instances before I posted it here. My apologie's. The code however should now work, issueing it only once.
Code:
on *:TEXT:.voice*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) !isvoice $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan + $+ $str(v,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    mode $chan + $+ $str(v,$modespl) %mn
    unset %m  
    unset %mt
    unset %mn
  } 
  else { mode $chan +v $$2 }
}
on *:TEXT:.devoice*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) isvoice $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan - $+ $str(v,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    mode $chan - $+ $str(v,$modespl) %mn
    unset %m  
    unset %mt
    unset %mn
  } 
  else { mode $chan -v $$2 }
}
on *:TEXT:.op*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) !isop $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan + $+ $str(o,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    mode $chan + $+ $str(o,$modespl) %mn
    unset %m  
    unset %mt
    unset %mn  
  } 
  else { mode $chan +o $$2 }
}
on *:TEXT:.deop*:#Channel:{
  if ($$2 == $chr(42)) {
    set %ma $modespl
    set %m 1
    set %mm 1
    set %mt $nick($chan,0)  
    while (%m &lt;= %mt) {
      if ($nick($chan,%m) != $me) &amp;&amp; ($nick($chan,%m) isop $chan) { .set %mn %mn $nick($chan,%m) }
      inc %m 1  
      if (%mm == %ma) { mode $chan - $+ $str(o,$modespl) %mn | unset %mm | unset %mn }
      inc %mm 1
    }  
    mode $chan - $+ $str(o,$modespl) %mn
    unset %m  
    unset %mt
    unset %mn 
  } 
  else { mode $chan -o $$2 }
}

Again, my apologies.
Posted By: MikeChat Re: Mass op, deop, voice, devoice. - 08/02/06 04:55 PM
Quote:
I just want a mass op script, rest I can make it self, based on the mass op script.


I have edited my code now to include the half op and voice
usage is simply !mass and theword:
op, deop, hop, dehop, voice or devoice

like !mass op or !mass devoice

the
Code:
on @*:text:!mass *:#channel:{

  if ($nick isop $chan) { multimode $$2 $chan $nick }

  if ($nick !isop $chan) { msg $chan $nick You do not have authorization. }

}

alias Multimode {
  var %channel = $2
  var %nick = $3

  if ($1 == deop) { 
    var %prefix = -
    var %mode = o
  }
  if ($1 == op) { 
    var %prefix = +
    var %mode = o
  }
  if ($1 == dehop) { 
    var %prefix = -
    var %mode = h
  }
  if ($1 == hop) { 
    var %prefix = +
    var %mode = h
  }
  if ($1 == devoice) { 
    var %prefix = -
    var %mode = v
  }
  if ($1 == voice) { 
    var %prefix = +
    var %mode = v
  }

  var %all.nicks = $nick(%channel,0), %i = 1
  while (%i &lt;= %all.nicks) {
    var %nic = $nick(%channel,%i)
    sline %channel %nic 
    inc %i
  }
  sline -r %channel $me
  sline -r %channel %nick
  var %modecnt = $modespl
  var %modelst = $snick(%channel)
  var %modenum = $gettok(%modelst,0,44)
  var %i = 1
  var %x = 1
  while (%i &lt;= %modenum) {
    var %listnk = %listnk $gettok(%modelst,%x,44)
    var %lenchk = $gettok(%listnk,0,32)
    if (%lenchk &gt;= %modecnt) {
      mode %channel %prefix $+ $str(%mode,$modespl) %listnk
      var %listnk = ""
    }
    if (%i == %modenum) {
      mode %channel %prefix $+ $str(%mode,$modespl) %listnk
      var %listnk = ""
    }
    inc %i
    inc %x
  }
}


Some comments on this part of the script
on @*:text:!mass *:#channel:{

you should have an access level on the bot to restrict this to either yourself or you and whatever others
If that level were "1000" the line would be
on @1000:text:!mass *:#channel:{

and then the isop check would not be needed, simply send the info to the alias.
on @1000:text:!mass *:#channel:{
multimode $$2 $chan $nick
}
© mIRC Discussion Forums