mIRC Homepage
Posted By: pheonix unban prot - 16/07/03 09:43 PM
on *:BAN:#genovia:{
if ($bnick isop $chan) {
mode # -b $banmask
}
}
doesnt work...
Posted By: Dr4g0n Re: unban prot - 16/07/03 10:32 PM
on *:BAN:#genovia:{
if ($opnick isop $chan) {
mode # -b $opnick }
}

maybe this works ?
Posted By: codemastr Re: unban prot - 16/07/03 10:36 PM
Uhh no, $opnick has nothing to do with ON BAN.

If I had to guess, it's the $bnick. $bnick is only valid if the ban mask contains a nickname, i.e.:
nick!blah@blah.com - $bnick = nick
*!blah@blah.com - $bnick = $null

Only other thing I can think of is, are you an op?
Posted By: theRat Re: unban prot - 16/07/03 11:23 PM
Code:
var %i = 0, %j = $ialchan($banmask,$chan,0)
while ( %i <= %j ) {
if ( $gettok($ialchan($banmask,$chan,%i),1,33) isop $chan ) {
mode $chan -b $banmask
break
}
inc %i
}



maybe??
Posted By: Watchdog Re: unban prot - 17/07/03 02:02 AM
Is the unban protection for yourself?
Code:
ON *:BAN:#: {
  if ($gettok($ial($me),2,64) isin $2) {
    mode # -b $2
  }
}
This works for a type two ban. If you want to cover other types just go from here. This code is tested and works.

One other thing too, it is also possible to deop whoever tries to ban you but like anything automated, including unban protection, your script could end up fighting another in a resultant mode war. If there are hosts that are banning others for the fun of it then it's probably best if they got themselves demoted.
Posted By: KingTomato Re: unban prot - 17/07/03 04:56 AM
Maybe this'll help >:D
Code:
on !*:BAN:#: {
  ; is it our mask?
  if ($banmask iswm $address($me, 5)) /mode $chan -b $banmask
  ; nick is present
  else if ($bnick isop $chan) /mode $chan -b $banmask
  ; check ial
  else if ($ial($banmask, 0) > 0) {
    var %n = 1
    while ($ial($banmask, %n).nick) {
      if ($ifmatch isop $chan) /mode $chan -b $banmask
      /inc -n
    }
  }
}
Posted By: pheonix Re: unban prot - 17/07/03 08:58 AM
ok thankyou it was because the $banmask had no nickname,but i got it using this grin

Code:
on *:BAN:#genovia:{
var %i 1
while (%i <= $nick($chan,0)) {
if ($banmask == $address($nick($chan,%i),1)) && ($nick($chan,%i) isop $chan) {
mode # -b $banmask
}
inc %i
}
}
Posted By: Jerk Re: unban prot - 17/07/03 06:40 PM
What if the banmask is not in *!*user@host format ($address(nick,1)? Rather than loop through the entire nicklist use $ialchan like theRat's example. Here is slightly different way of doing it.
Code:
on !@*:ban:#:{
  var %i = 1
  while ($ialchan($banmask,$chan,%i).nick) {
    if ($ifmatch isop $chan) {
      mode $chan -b $banmask
      halt
    }
    inc %i
  }
}
That should be much faster than looping through the entire nicklist and it will cover any type of ban. I would stay way from using $bnick entirely.

$bnick is only filled if it is in the banmask itself. Ex:
mode #mirc +b loser!*@*somehost.com -> $bnick is "loser" even if there is no such nickname on the channel.
mode #mirc +b Jerk!*@not.my.real.host -> $bnick is "Jerk" (me) even though the ban does not really match me.
mode #mirc +b *!*@my.real.host -> $bnick is $null even though the ban does match me.
Posted By: KingTomato Re: unban prot - 18/07/03 03:54 AM
Was mine notsufficient? It looped through the ial, and matched if they were an op. Also, is much faster considering that if the $bnick was already found it doesn't loop through the ial.
Posted By: Jerk Re: unban prot - 18/07/03 07:01 AM
Well, he seemed to ignore yours so I posted mine. But to answer your question, yes, i dont like your code. :tongue:
Code:
on !*:BAN:#: {
  ;[color:red]^ forgot the @ prefix.  No need to execute the event if not opped[/color]
  ; is it our mask?
  if ($banmask iswm $address($me, 5)) /mode $chan -b $banmask
  ;[color:red]^ Not really needed.  Your own address would be covered in the $ialchan loop[/color]
  ; nick is present
  else if ($bnick isop $chan) /mode $chan -b $banmask
  ;[color:red]^ $bnick is inaccurate.  Read my above post[/color]
  ; check ial
  else if ($ial($banmask, 0) > 0) {
    ;[color:red]^ Why do this.[/color]
    var %n = 1
    while ($ial($banmask, %n).nick) {
      ;[color:red]^ $ialchan() works better.  There is no need to loop through the entire IAL[/color]
      if ($ifmatch isop $chan) /mode $chan -b $banmask
      /inc -n
    }
  }
}
Posted By: ScatMan Re: unban prot - 18/07/03 07:15 AM
/inc -n
????????????
u didn't even specify a variable..
Posted By: Jerk Re: unban prot - 18/07/03 07:24 AM
It's not my code, it's KingTomato's. It's also just a typo. It should be %n not -n. Perhaps you should read a thread before responding. Had you done that you would realize that he asked me specifically why I thought his example was insufficient. I reposted his code adding in red my comments.

Thanks for making note of the typo though.
Posted By: KingTomato Re: unban prot - 18/07/03 09:28 AM
yes -n shouild be %n, and to answer yours..

First point (@) - valid

"isn't needed, will be covered in ial", well a condition on the provided information would be wuicker then looping through an ial, especially if your ial contains several hundred addresses.

third, the $bnick (obviously) only becomes true if there is a value associated and again is for speed. Its faster to compare a value already present, then to loop through a database of several values.

"who do this" again, speed. Im used to dealing with lamers that try to take over channels, and have experimented with many versions. I and a few used to have a "competition" (myself being the *good guy*) where they used to come in, and try to takeover channel and i had to counteract certain mode changes and moves. What this is leading into, the way i showed was more efficient, with the exception of perhas using ialchan.
© mIRC Discussion Forums