mIRC Home    About    Download    Register    News    Help

Topic Options
#42788 - 18/08/03 08:58 PM Banlist...
FunChatter Offline
Fjord artisan

Registered: 11/12/02
Posts: 339
Loc: Athens, Greece
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 smile

Top
#42789 - 18/08/03 09:31 PM Re: Banlist...
pheonix Offline
Hoopy frood

Registered: 06/05/03
Posts: 2265
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- }
}


Edited by pheonix (18/08/03 09:57 PM)
_________________________
new username: tidy_trax

Top
#42790 - 18/08/03 09:36 PM Re: Banlist...
LocutusofBorg Offline
Hoopy frood

Registered: 23/03/03
Posts: 1271
Loc: Sunnydale, CA
Code:
[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) &gt;= $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) &gt;= $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 &gt; $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.
_________________________
DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Top
#42791 - 18/08/03 09:39 PM Re: Banlist...
LocutusofBorg Offline
Hoopy frood

Registered: 23/03/03
Posts: 1271
Loc: Sunnydale, CA
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.
_________________________
DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Top
#42792 - 18/08/03 09:48 PM Re: Banlist...
ScatMan Offline
Hoopy frood

Registered: 06/05/03
Posts: 730
Quote:

.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

Top
#42793 - 18/08/03 09:52 PM Re: Banlist...
pheonix Offline
Hoopy frood

Registered: 06/05/03
Posts: 2265
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.


Edited by pheonix (18/08/03 09:55 PM)
_________________________
new username: tidy_trax

Top
#42794 - 18/08/03 09:55 PM Re: Banlist...
Watchdog Offline
Hoopy frood

Registered: 09/12/02
Posts: 2984
Loc: Hill End, NSW, Australia
If it was me I would:

1. Make sure I had a bot in the room 24/7
2. Use this:
Code:
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.
_________________________
Induced IRC
irc.induced.net

Top
#42795 - 18/08/03 09:56 PM Re: Banlist...
_D3m0n_ Offline
Hoopy frood

Registered: 11/12/02
Posts: 1527
Loc: Florida,USA
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
_________________________
D3m0nnet.com

Top
#42796 - 18/08/03 09:58 PM Re: Banlist...
pheonix Offline
Hoopy frood

Registered: 06/05/03
Posts: 2265
like ive also said before, some custom alias im so used to using, i forget theyre custom :tongue:
_________________________
new username: tidy_trax

Top
#42797 - 18/08/03 10:02 PM Re: Banlist...
FunChatter Offline
Fjord artisan

Registered: 11/12/02
Posts: 339
Loc: Athens, Greece
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 wink

Top
#42798 - 18/08/03 10:04 PM Re: Banlist...
pheonix Offline
Hoopy frood

Registered: 06/05/03
Posts: 2265
np grin
_________________________
new username: tidy_trax

Top
#42799 - 19/08/03 05:35 AM Re: Banlist...
LocutusofBorg Offline
Hoopy frood

Registered: 23/03/03
Posts: 1271
Loc: Sunnydale, CA
Quote:

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.
_________________________
DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Top
#42800 - 19/08/03 05:43 AM Re: Banlist...
ScatMan Offline
Hoopy frood

Registered: 06/05/03
Posts: 730
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 $


Top
#42801 - 19/08/03 05:50 AM Re: Banlist...
LocutusofBorg Offline
Hoopy frood

Registered: 23/03/03
Posts: 1271
Loc: Sunnydale, CA
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.
_________________________
DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Top
#42802 - 19/08/03 06:12 AM Re: Banlist...
ScatMan Offline
Hoopy frood

Registered: 06/05/03
Posts: 730
u are just wrong..
Quote:

.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.

Top
#42803 - 19/08/03 01:06 PM Re: Banlist...
LocutusofBorg Offline
Hoopy frood

Registered: 23/03/03
Posts: 1271
Loc: Sunnydale, CA
"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.
_________________________
DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius

Top
#42804 - 19/08/03 06:38 PM Re: Banlist...
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
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().
_________________________
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Top