mIRC Home    About    Download    Register    News    Help

Print Thread
#36770 16/07/03 09:43 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
on *:BAN:#genovia:{
if ($bnick isop $chan) {
mode # -b $banmask
}
}
doesnt work...


new username: tidy_trax
#36771 16/07/03 10:32 PM
Joined: Jun 2003
Posts: 68
D
Babel fish
Offline
Babel fish
D
Joined: Jun 2003
Posts: 68
on *:BAN:#genovia:{
if ($opnick isop $chan) {
mode # -b $opnick }
}

maybe this works ?

#36772 16/07/03 10:36 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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?

#36773 16/07/03 11:23 PM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
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??


Code:
//if ( khaled isgod ) echo yes | else echo no
#36774 17/07/03 02:02 AM
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
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.

#36775 17/07/03 04:56 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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
    }
  }
}


-KingTomato
#36776 17/07/03 08:58 AM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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
}
}


new username: tidy_trax
#36777 17/07/03 06:40 PM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
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.

#36778 18/07/03 03:54 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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.


-KingTomato
#36779 18/07/03 07:01 AM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
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
    }
  }
}

#36780 18/07/03 07:15 AM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
/inc -n
????????????
u didn't even specify a variable..

#36781 18/07/03 07:24 AM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
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.

#36782 18/07/03 09:28 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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.


-KingTomato

Link Copied to Clipboard