|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
OP
Hoopy frood
Joined: May 2003
Posts: 2,265 |
on *:BAN:#genovia:{ if ($bnick isop $chan) { mode # -b $banmask } } doesnt work...
new username: tidy_trax
|
|
|
|
Joined: Jun 2003
Posts: 68
Babel fish
|
Babel fish
Joined: Jun 2003
Posts: 68 |
on *:BAN:#genovia:{ if ($opnick isop $chan) { mode # -b $opnick } }
maybe this works ?
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
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?
|
|
|
|
Joined: Dec 2002
Posts: 774
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 774 |
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??
//if ( khaled isgod ) echo yes | else echo no
|
|
|
|
Joined: Dec 2002
Posts: 2,985
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,985 |
Is the unban protection for yourself? 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.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Maybe this'll help >:D
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
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
OP
Hoopy frood
Joined: May 2003
Posts: 2,265 |
ok thankyou it was because the $banmask had no nickname,but i got it using this
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
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
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. 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.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
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
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
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: 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
}
}
}
|
|
|
|
Joined: May 2003
Posts: 730
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 730 |
/inc -n ???????????? u didn't even specify a variable..
|
|
|
|
Joined: Dec 2002
Posts: 169
Vogon poet
|
Vogon poet
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.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
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
|
|
|
|
|