|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
Hi I need help with a ban script that would ban all 10 addresses of a user maybe using the IAL list. I am aware that its not needed to ban all 10 addresses. thanks
Newbie
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
alias banall {
if (!$ial($2)) return
var %i = 1, %addresses
while (%i <= 10) {
%addresses = %addresses $address($2,%i)
if (%i == $modespl) {
mode $1 + $+ $str(b,%i) %addresses
%addresses =
}
inc %i
}
if (%addresses) mode $1 + $+ $str(b,$numtok(%addresses,32)) %addresses
} /banall #channel <nickname>
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
menu nicklist {
Ban All addresses : ban.all $chan $snicks
}
alias ban.all {
var %a = 1, %b = 1
while %b <= $numtok($2-,44) {
kick $1 $gettok($2-,%b,44)
while %a <= 10 {
.ban $1 $gettok($2-,%b,44) %a
inc %a
}
inc %b
}
}
|
|
|
|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
Hi Thanks for all the replies, I tried both and they work but they dont ban all ten addresses? I am looking for a +bbbbbbbbbb on one nick which bans all ten of the nicks addresses. these scripts are just banning two of the addresses. thanks
Newbie
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
I tried it and it bans all ten addresses for me. Are you sure you're using it right? /banall <channel> nickname
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
alias banall {
if (!$ial($2)) return
var %i = 1, %addresses
while (%i <= 10) {
%addresses = %addresses $address($2,%i)
[color:blue]if (%i == $modespl) {[/color]
mode $1 + $+ $str(b,%i) %addresses
%addresses =
}
inc %i
}
if (%addresses) mode $1 + $+ $str(b,$numtok(%addresses,32)) %addresses
} Won't that only hit modespl once? Maybe mod is a better alternative? e.g. $modespl = 3 %i = 1 - %i != 3 %i = 2 - %i != 3 %i = 3 - %i == 3 -- matches here, address is reset, but %i keeps += 1 %i = 4 - %i != 3 %i = 5 - %i != 3 %i = 6 - %i != 3 -- Should match here, we have 3 more modes. ...etc.
-KingTomato
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
OK, then the only way there should be a problem with this is if mIRC or the IRCd is preventing all 10 from being set at once alias ban.all {
.mode $1 +bbbbbbbbbb $2 1 $2 2 $2 3 $2 4 $2 5 $2 6 $2 7 $2 8 $2 9 $2 10
}
Usage /ban.all <channel> <nick> Note: There is no error checking in this.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
You're right. A second counter should fix it: alias banall {
if (!$ial($2)) return
var %i = 1, %g = 1, %addresses
while (%i <= 10) {
%addresses = %addresses $address($2,%i)
if (%g == $modespl) {
mode $1 + $+ $str(b,%g) %addresses
%addresses =
%g = 0
}
inc %g
inc %i
}
if (%addresses) mode $1 + $+ $str(b,$numtok(%addresses,32)) %addresses
}
|
|
|
|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
Hi. Yes i think it may be the IRC server not letting me as it wont ban more then four addresses. On your last script this is the result though.
Haleyj sets mode: +bbbbbb Test!*@* 1!*@* 2!*@* 3!*@* 4!*@* 5!*@*
Newbie
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
The updated version of mine should work on any irc server.
|
|
|
|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
Hello, I tried the updated version of the script and its only banning four addresses. i made sure that the test nick was in the IAL list before doing it.
Newbie
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Hmm you're right. The thing is, if I echo the command it's executing it looks fine: mode #hixxytest +bbbbbb *!*hixxy@cpc3-linc5-0-0-cust974.nott.cable.ntl.com *!*@cpc3-linc5-0-0-cust974.nott.cable.ntl.com *!*hixxy@*.nott.cable.ntl.com *!*@*.nott.cable.ntl.com hixxy!hixxy@cpc3-linc5-0-0-cust974.nott.cable.ntl.com hixxy!*hixxy@cpc3-linc5-0-0-cust974.nott.cable.ntl.com mode #hixxytest +bbbb hixxy!*@cpc3-linc5-0-0-cust974.nott.cable.ntl.com hixxy!*hixxy@*.nott.cable.ntl.com hixxy!*@*.nott.cable.ntl.com *!hixxy@cpc?-linc?-?-?-cust???.nott.cable.ntl.com Even if I copy/paste the command it echos it doesn't work. My only guess is that this is because some of the addresses are already covered by other masks. There's nothing that can be done about this I'm afraid. You can prove this further by typing this: //mode # +bbbbbb $address($me,1) $address($me,2) $address($me,3) $address($me,4) $address($me,5) $address($me,6) I updated the script again as well. alias banall {
if (!$ial($2)) return
var %i = 1, %addresses
while (%i <= 10) {
%addresses = %addresses $address($2,%i)
if ($numtok(%addresses,32) == $modespl) {
mode $1 + $+ $str(b,$numtok(%addresses,32)) %addresses
%addresses =
}
inc %i
}
if (%addresses) mode $1 + $+ $str(b,$numtok(%addresses,32)) %addresses
}
|
|
|
|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
Hi I think you are right as i echoed my addresses using this code //echo -a $address($me,1) and i went through all 10 and some were the same. My question is why does mIRC keep an IAL list of 10 addresses when some are duplicated.
Newbie
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
If you look closely enough you'll see that they're not duplicated, but covered by wildcards in other masks.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
using modulos works nicely as well, instead of an alternate counter or numtok. Most likely (under certain circumstances) faster as well to check a mod of a number, then count the tokens in a string.
if ($calc(%i % $modespl) == 0) { ... }
-KingTomato
|
|
|
|
|