|
Joined: Dec 2002
Posts: 334
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 334 |
Hello, Since we got that big overload of spambots lately we had big problems with small banlists... for example in some network where the ban limit was 100 bans, the banlist was full in less than 5 minutes, so i've been scripting a lot with ban events... I've been wondering is there a way to get the last 3/4 bans of the ban list when the banlist is not full... I know $ibl(#,x)'s... The only think I could guess(not sure i can script it) is check out with $ibl(#,0) how many bans there are store the number into a var and then just unban the number of the var and 2 numbers under the var number... Anyone who knows how exactly to do this and/or got more ides please shoot!! Thanx
|
|
|
|
pheonix
|
pheonix
|
alias uban { if ($ibl(#,0) < 100) { return } var %i $ibl(#,0) var %bans $ibl(#,%i) $ibl(#,$calc(%i - 1)) $ibl(#,$calc(%i - 2))$ibl(#,$calc(%i - 3)) ban -u %bans } alias ban { if ($1 != -u) { ban $1- } else { mode # - $+ $str(b,$calc($0 - 1)) $2- } }
Last edited by pheonix; 18/08/03 08:57 PM.
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
[color:green]; define the max. number of bans in the list[/color]
alias maxbans { return [color:blue]100[/color] }
[color:green]; define the max. number of bans allowed left in the list when clearing[/color]
alias bansallwd { return [color:blue]75[/color] }
[color:green]; you could use the on ban event to check everytime a ban gets added[/color]
on *:BAN:[color:blue]#channel[/color]: {
[color:green]; if the banlist holds 5 open slots or less[/color]
if ($ibl(#,0) >= $calc($maxbans - [color:blue]5[/color])) clearlist $chan
}
[color:green]; or you could use a timer that checks (in this case) every 5 minutes[/color]
on *:CONNECT: {
[color:green]; if the banlist holds 5 open slots or less[/color]
.timerclrclst -o 0 [color:blue]300[/color] if ($!ibl([color:blue]#channel[/color],0) >= $calc($maxbans - [color:blue]5[/color])) clearlist [color:blue]#channel[/color]
}
[color:green]; clear the list[/color]
alias clearlist {
[color:green]; error checking[/color]
if ($1 !ischan) echo -a [color:red]Error in function call to function clearlist - specified argument is not a valid channelname[/color]
else {
[color:green]; set start of loop (end = $bansallwd)[/color]
var %x = $ibl($1,0)
[color:green]; we're gonna be needing this variable later on - it should not exist, but just to be safe...[/color]
unset %b.tmp
while (%x > $bansallwd) {
[color:green]; to prevent a unban flood we're gonna group the unbans in groups of 5[/color]
%b.tmp = $addtok(%b.tmp,$ibl($1,%x),32)
[color:green]; unban when the group hits 5[/color]
if ($numtok(%b.tmp,32) == 5) .mode $1 -bbbbb %b.tmp
[color:green]; clear the variable for the next load[/color]
unset %b.tmp
}
[color:green]; if the bans to be removed isn't a multiple of 5, there will be bans left to undo[/color]
if (%b.tmp) .mode $1 $+(-,$str(b,$numtok(%b.tmp,32))) %b.tmp
[color:green]; always clean up your mess[/color]
unset %b.tmp
}
}
You need to change the parts in blue to your custom values, the rest should pretty much work without changing it. Of course theon connect event and the on ban event don't need to be used both - pick one.
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
pheonix: I assume it is very late for you? That code is complete bull****.
1] /ban is used for creating a ban only, not removing it. 2] The -u flag sets a unban time, which you didn't add so it's bogus. 3] Then you intend to unban em when the banlist hits full, too bad I wanted to add 3 bans at once. 4] Then of course you forgot to specify which channel the bans should be removed in, and last I checked mIRC wasn't psychic. 5] Plus this will flood, why not unban more than one in a single line.
Sheesh, why did you bother posting this at all.
|
|
|
|
ScatMan
|
ScatMan
|
.timerclrclst -o 0 300 if ($!ibl(#channel,0) >= $calc($maxbans - 5)) clearlist #channel u probably meant: .timerclrclst -o 0 300 if ($ibl(#channel,0) >= $!calc($maxbans - 5)) clearlist #channel
|
|
|
|
pheonix
|
pheonix
|
1) added ban -u alias. 4) i made it so it unbans the channel he typed it in..., who said mirc was psychic!?. 5) done in 1 line now.
Last edited by pheonix; 18/08/03 08:55 PM.
|
|
|
|
Joined: Dec 2002
Posts: 2,958
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,958 |
If it was me I would: 1. Make sure I had a bot in the room 24/7 2. Use this: ON *:BAN:#: {
if ($ibl(#RoomName,90) != $null) {
mode #RoomName -bbbbb $ibl(#RoomName,10) $ibl(#RoomName,9) $ibl(#RoomName,8) $ibl(#RoomName,7) $ibl(#RoomName,6)
mode #RoomName -bbbbb $ibl(#RoomName,5) $ibl(#RoomName,4) $ibl(#RoomName,3) $ibl(#RoomName,2) $ibl(#RoomName,1)
}
} This would unban the first 10 when your room gets the 90th ban. Giving you a theoretical breathing space of 20 lusers. Tested and works.
|
|
|
|
Joined: Dec 2002
Posts: 1,518
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,518 |
if u added that alias to your script and your sharing an answer here ..... then u need to also include that newly formed alias along with your answer. because just as u didnt say mirc was able to read minds ,,, neither is the person ur giving the answer too. i have had to ask u this several times to include these custom made aliases u come up with and dont post to help several times now. u would think ud have learned
|
|
|
|
pheonix
|
pheonix
|
like ive also said before, some custom alias im so used to using, i forget theyre custom :tongue:
|
|
|
|
Joined: Dec 2002
Posts: 334
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 334 |
Thank you both loc and pheonix!! I've kinda combined your codes + added some of mine and found out what I wanted exactly... kinda sleepy here never thought using $calc pheonix lol Thanx both again
|
|
|
|
pheonix
|
pheonix
|
np
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
u probably meant: .timerclrclst -o 0 300 if ($ibl(#channel,0) >= $!calc($maxbans - 5)) clearlist #channel
No, I meant the way I said it with the ! - that way the $ibl will be re-evaluated everytime the timer hits. Leave it out and the $ibl will only be evaluated the moment you start the timer which would be pointless.
|
|
|
|
ScatMan
|
ScatMan
|
the evaluation in the timer when u run it evaluate only identifiers/variables and doesn't matter if it's inside /if or not so ($me) won't make it (Scat-Man), it will stay ($me) becuz there is no space before $
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
Youn obviously don't get it. The $maxbans($calc - 5) does never need to be re-evaluated since $maxbans is a constant so there is no ! there. The $ibl(#,0) is NOT a constant, so does need to be re-evaluated, so needs the ! Stop correcting people when you haven't checked it. I did. The ! is definately there for a reason.
|
|
|
|
ScatMan
|
ScatMan
|
u are just wrong.. .timerclrclst -o 0 300 if ($!ibl(#channel,0) >= $calc($maxbans - 5)) clearlist #channel will first evaluate it, and make it like this: "if ($!ibl(#channel,0) >= 95 clearlist #channel" which is wrong syntax for if and will give u an error "if invalid format" when it's triggered.
|
|
|
|
Joined: Mar 2003
Posts: 1,256
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,256 |
"if ($!ibl(#channel,0) >= 95) clearlist #channel"
Which was exactly the point of the code to begin with dude. This is NOT a syntax error is $ibl(#channel,0) will be evaluated everytime the timer sets, which is exactly what I wanted. It will never give an invalid format error for if since the only conditions for a valid if statement are met whether the code would work or not.
|
|
|
|
Joined: Jan 2003
Posts: 2,125
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,125 |
ScatMan is right. Try this: //.timer 1 0 if ($!remove(ab,b) == a) echo -a blah | timers notice how it doesn't echo anything.
Now, try this: //.timer 1 0 if ($remove(ab,b) == a) echo -a blah | timers works
Now, try this: //.timer 1 0 if ( $!remove(ab,b) == a) echo -a blah | timers works too.
Watch the /timers output too.
What ScatMan is trying to tell you is that inside the calling script, if ($something) is not considered an if statement but a parameter to /timer. Consequently, the () pair loses its special meaning as a condition wrapper and this means that the ( won't let $something evaluate because it's touching it.
In short, you should remove the exclamation mark from $ibl().
|
|
|
|
|