mIRC Home    About    Download    Register    News    Help

Print Thread
#42788 18/08/03 07:58 PM
Joined: Dec 2002
Posts: 339
F
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Dec 2002
Posts: 339
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

#42789 18/08/03 08:31 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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.

new username: tidy_trax
#42790 18/08/03 08:36 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
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
#42791 18/08/03 08:39 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
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
#42792 18/08/03 08:48 PM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
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

#42793 18/08/03 08:52 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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.

new username: tidy_trax
#42794 18/08/03 08:55 PM
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
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.

#42795 18/08/03 08:56 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
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
#42796 18/08/03 08:58 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
like ive also said before, some custom alias im so used to using, i forget theyre custom :tongue:


new username: tidy_trax
#42797 18/08/03 09:02 PM
Joined: Dec 2002
Posts: 339
F
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Dec 2002
Posts: 339
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

#42798 18/08/03 09:04 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
np grin


new username: tidy_trax
#42799 19/08/03 04:35 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
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
#42800 19/08/03 04:43 AM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
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 $


#42801 19/08/03 04:50 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
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
#42802 19/08/03 05:12 AM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
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.

#42803 19/08/03 12:06 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
"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
#42804 19/08/03 05:38 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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

Link Copied to Clipboard