|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
This one work, how ever it's slow, any way to tweak this to be faster? care to explain how
on *:ban:#: {
if ($me isop $chan) && ($banmask iswm $address($me,5)) && ($banmask != *!*@*) && ($banmask != *!~*@*) && (%banpro == enabled) {
mode $chan -b $banmask
mode $chan -bo $banmask $nick
kick $chan $nick $eval(%bbanki,2)
.notice $nick Don't ban me on $chan $+ .
}
if ($me !isop $chan) && ($banmask iswm $address($me,5)) && (%ban.pro == Enabled) {
echo -at You got banned, you arent oped in $chan $+ .
}
elseif ($me isop $chan) && ($banmask != *!*@*) && ($banmask != *!~*@*) && (%enforceban == enabled) {
var %banmask = $banmask
if ($ial(%banmask,0).nick == 0) { return }
if ($banmask iswm $address($me,5)) { return }
var %totbu = $ial(%banmask,0).nick
var %stb = 1
while (%stb <= %totbu) {
kick $chan $ial(%banmask,%totbu).nick $eval(%bbankick,2)
inc %stb
}
}
}
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
on *:ban:#: {
if ($me !isop $chan) && ($banmask iswm $address($me,5)) && (%ban.pro == Enabled) {
echo -at You got banned, you arent oped in $chan $+ .
}
if ($me isop $chan) && ($banmask != *!*@*) && ($banmask != *!~*@*) {
if ($banmask iswm $address($me,5)) && (%banpro == enabled) {
mode $chan -bo $banmask $nick
kick $chan $nick $eval(%bbanki,2)
.notice $nick Don't ban me on $chan $+ .
}
elseif (%enforceban == enabled) {
var %stb = $ial($banmask,0).nick
if ($banmask !iswm $address($me,5)) {
while %stb {
kick $chan $ial($banmask, %stb).nick $eval(%bbankick,2)
dec %stb
}
}
}
}
} You can probably see I haven't really changed much. I just re-arranged the if's a bit so that you don't check for the same conditions more than once, I've removed a couple of unnecessary variables ( %banmask and %totbu) and removed a duplicate mode command. There was also a bug in your original code that you were looping over %stb but you were kicking $ial(%banmask, %totbu).nick, so you were kicking the same guy %totbu times. Note that the code I've given you is untested.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Dec 2002
Posts: 503
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 503 |
Also, why use $ial() when you're only going to be acting on $chan anyway? Use $ialchan() instead, much smaller data set. In any case, using $ial() without verifying $comchan() means you could get false-positive's with failed kicks.
var %stb = $ialchan($banmask, $chan, 0)
You should also set %stb inside of the final 'if'. If you're not going to use %stb, why set it.
kick $chan $gettok($ialchan($banmask, $chan, %stb), 1, 33) $eval(%bbankick,2)
.. just a few comments ..
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Good point. Using $ialchan will probably speed it up more than anything I'd changed in the code. I haven't worked with the IAL in a while, looks like I'm a little rusty!
Yeah the variable could be moved inside the if too. I shifted the code about a bit before submitting and I guess I missed that line.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
thankyou for the answers, i look at what you did to the code, then try to rewrite the whole thing
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
Fjord artisan
Joined: Mar 2007
Posts: 218 |
Looking forward to the script release. Gonna be a lot of names from mirc.co.uk forum on the credit list.
|
|
|
|
|