mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#51239 25/09/03 03:40 AM
D
Direkii
Direkii
D
Well i just made a community successful and alot of people are spamming... and i just want to know howto make a script so that when someone says like to much like 4 lines in 5 secs it kicks em...

P
pheonix
pheonix
P
on *:TEXT:*:#:{
inc -u5 %flood. [ $+ [ $nick ] ]
if (%flood . [ $+ [ $nick ] ] <= 4) { return }
else { ban -k $chan $nick }
}

Joined: Mar 2003
Posts: 1,256
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,256
To pheonix:
Curious - why do you use

if (%flood . [ $+ [ $nick ] ] <= 4) { return }
else { ban -k $chan $nick }

and not

if (%flood . [ $+ [ $nick ] ] == 5) { ban -k $chan $nick }

?

As it is ony obsolete if-statement less, it should be a tad faster. And especially in these kinds of scripts, you really can't afford to waste a few microseconds on a pointless if statement. Also - I would recommend adding a masktype to your /ban command, or it will ban nick!*identd@host.domain, which is so easy to get around...

To Direkii
Also -- I suggest setting a temporary ignore - if the user keeps flooding and does it decently he might flood you off before the command gets executed.

Code:
on @*:TEXT:*:#:{
  inc -u5 %flood. [ $+ [ $nick ] ]
  if (%flood . [ $+ [ $nick ] ] == 5) { 
    ignore -u5 *!*@*
    ban -k $chan $nick 3 Stop flooding dude
  }
} 


P
pheonix
pheonix
P
ive had problems before where(due to lag) mirc has completely missed the var becoming a 5.

B
bloupx
bloupx
B
your code was, is , and will always be crappy as you do not have the experience many others on here do, if you can't paste good code, don't paste anything!

P
pheonix
pheonix
P
Quote:

as you do not have the experience many others on here do

1: how do you know this?
2: i gave a reason why i posted that.

D
DeadlySin
DeadlySin
D
Fight Fight !! lol leave pheonix alone he only trying to help :tongue: grin

Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
Code:
; -------------------------------------------------------------------------------------------------
; Protections

#protect.flood off

on @1:TEXT:*:#: {
  ; ----------------------------------- Flood (Repeated Messages)
  ; This is a simple protection that looks for a user repeating the
  ; same message, and if it finds that person, first will warn, then
  ; will set a mute ban, next kick, then ban
  ; ----------------------------------- Flood (Repeated Messages)
  if (%text. [ $+ [ $nick ] ] != $1-) /set -u300 %text. [ $+ [ $nick ] ] $1-
  else {
    ; Increase number of duplicate messages
    /inc -u5 %flood. [ $+ [ $nick ] ]
    ;check how many times we've had to see that message
    if (%flood. [ %+ [ %nick ] ] == 3) {
      /unset %flood. [ $+ [ $nick ] ]
      ; increase number of times we've had to deal with this person
      /inc -u1800 %warn. [ $+ [ $nick ] ]
      ; take action
      /takeaction $chan $nick Flood Flooding (5 lines, 3 seconds)
    }
  }
}

#protect.flood end

#protect.spam off

on @1:TEXT:*:#: {
  ; ----------------------------------- Spam (Repeated Gibberish)
  ; This is also a simple protection, as it will find a person typing
  ; several lines, but with any line of text.  This has the same actions
  ; as the flood protection, but is 7 lines in 5 seconds.
  ; ----------------------------------- Spam (Repeated Gibberish)
  /inc -u5 %spam. [ $+ [ $nick ] ]
  ; they passed limit
  if (%spam. [ $+ [ $nick ] ] == 7) {
    /unset %spam. [ $+ [ $nick ] ]
    ; increase times dealt with
    /inc -u1800 %warn. [ $+ [ $nick ] ]
    ; take action
    /takeaction $chan $nick Spam Spamming (7 lines, 5 seconds)
  }
}

#protect.spam end

; -------------------------------------------------------------------------------------------------
; Aliases

; take action - use when %warn.(name) has been declaired
; syntax: /takeaction &lt;channel&gt; &lt;nickname&gt; &lt;action&gt; &lt;reason(if kicked)&gt;
; Example: /takeaction #king-tomato ChanSys Flood Flooding (7 lines, 5 seconds)
alias -l takeaction {
  ; set some easy-to-use variables
  /set -u0 %chan $1
  /set -u0 %nick $2
  /set -u0 %word $3
  /set -u0 %reason $4-

  ; Now, to take action
  if (%warn. [ $+ [ %nick ] ] == 1) {
    ; warning
    /msg %chan Please do not %word the channel $nick $+ . Further to do so will result in kicks and/or bans.
  }
  else if (%warn. [ $+ [ %nick ] ] &lt;= 3) {
    ; mute ban
    /mode %chan -ov+b %nick %nick $address(%nick, 1)
  }
  else if (%warn. [ $+ [ %nick ] ] &lt;= 6) {
    ; kick
    /mode $chan -ov $nick $nick
    /kick $chan %nick %reason
  }
  else if (%warn. [ $+ [ %nick ] ] != $null) {
    /mode %chan -ov+b %nick %nick $address(%nick, 11)
    /kick %chan %nick Banned! %reason
  }
}

Joined: Mar 2003
Posts: 1,256
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,256
Quote:
1: how do you know this?

A: Seeing a lot of bad code from you.

Quote:
2: i gave a reason why i posted that.

A: which was about as meaningful as trying to explain relativity to a horse. Lag has nothing to do with a script not working at 5 but working at 4. If you're lagged, your anti-flood script won't work at all. True, a decent flood with seriously thwart your client's effectiveness, but the difference between 4 and 5 is hardly enough to fix that. The problem was not the 4 in your script. The problem was the pointless if statement that is wasting valuable time when trying to deal with a flood.

P
pheonix
pheonix
P
mine checks if its more than or equal to 5, so if mine misses a 5, it will work when it becomes a 6, but yours checks if its only 5, if your script misses the 5, it does nothing.
speed isnt everything..

Quote:
Seeing a lot of bad code from you.

i paste good code if i test it first, normally i dont test it..

B
bloupx
bloupx
B
i see your crappy code all over the messageboards all day, some of it doesn't even work, that's how i know?

P
pheonix
pheonix
P
because i didnt test it...
i barely ever test code on here.
you must be 1 of the people who NEVER make mistakes in their code and NEVER have to correct it :tongue:

Joined: Aug 2003
Posts: 136
M
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 136
Hey the day people get paid for helping out here is the day your comments might be taken seriously, please to rag on others, because you have "skills" and others dont.

Joined: Mar 2003
Posts: 1,256
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,256
The script NEVER misses the 5. Not unless you increment the variable with 2 instead of 1.

Quote:
i paste good code if i test it first, normally i dont test it..

Then you should make a habit out of not posting stuff you haven't tested. Obviously that doesn't work well for you.
Quote:
i barely ever test code on here

Then -- without attempting a personal insult -- stop wasting people's time. People who ask for help don't care about code that doesn't work, nor does it help them.

P
pheonix
pheonix
P
Quote:
The script NEVER misses the 5. Not unless you increment the variable with 2 instead of 1.

like i said, my script increased the variable to a 5, i had a flood protection script to work when it became a 5 and it missed it, there were no errors in the script because the exact same code worked a couple of hours later. (i think it was lag)

Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
Quote:
if (%flood . [ $+ [ $nick ] ] == 5) {

Well, your code is wrong too, although it seems like a typo. :tongue:

Also, I wouldn't ignore *!*@*, sure it prevents 100% the displaying of messages, but:
1) It doesn't prevent me of receiving them anyway (check the debug info). /silence does, but I don't know if it's supported on most networks, so I won't use it here;
2) Innocent people might message me during that interval, so I'd rather just ignore the related address, for more than 5s. If I get attacked by floodclones, well, /ignore wouldn't completely block them from my connection anyway, also they could attack me after 6+s too and I'd still see their messages, so..

About the code itself since it was first shown, I think the variable name should contain the channel too, not only the nick - also, not the nick at all, but rather its address. BTW, [ ] brackets aren't needed everywhere/everytime.

Code:
on @*:TEXT:*:#:{
  inc -u5 $+(%,flood;,$address,;,$chan)
  if ( [ [ $+(%,flood;,$address,;,$chan) ] ] &gt; 4) { 
    ban -k $chan $nick 3 Stop flooding dude
    ignore -u60 $nick 3
  }
} 


Edit: some tweaks, I'm really obsessed with tweaks.. tweaks tweaks tweaks

Last edited by cold; 27/09/03 05:31 AM.
Joined: Mar 2003
Posts: 1,256
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,256
%flood . [ $+ [ $nick ] ] is a perfectly good way to set a variable, so I'm not sure what you mean with that comment.

/silence is not a mIRC command, but is provided by the network you are on, so it does'work on some (like DALnet) and not others (like Efnet)

Third, if you are worried about users sending you a valid message in those 5 measely seconds you are ignoring everything, then you should get your priorities straightened out. If a channel flood occurs, the only thing that matters is stopping it. And if you're that worried about missing a query, just ignore the channel alone then.



Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
Quote:
%flood . [ $+ [ $nick ] ] is a perfectly good way to set a variable, so I'm not sure what you mean with that comment.

And I thought it was a typo.. but no, it's wrong. %flood. [ $+ [ $nick ] ] is a perfectly good way to set and get a variable, %flood . [ $+ [ $nick ] ] is not. The second one (yours) increases the variable %flood and ignores the rest (". $+ $nick").
Did you actually test your code before posting? Let's test it, changing $nick by $me, so I can put it in an alias.
Things in green are correct, things in brown (your way) are not.
Code:
alias wrong {
  ; *** Try this in a totally clean mIRC. ***
  ; *** Type /wrong ***

  clear -s
  window -a "status window"

  echo 3 -s -&gt; Command: $(set -s %flood. $+ $me correct,)
  [color:green]set -s %flood. $+ $me correct[/color]
  echo 3 -s -&gt; should echo "* Set $+(%,flood.,$me) to correct"
  echo -s ------------------------------------------------------

  echo 5 -s -&gt; Command: $(unset -s %flood . [[ $+ [[ $me ]] ],)
  [color:brown]unset -s %flood . [ $+ [ $me ] ][/color]
  echo 5 -s -&gt; should echo "* Unset $+(%,flood.,$me) $+ ", $&amp;
    but nothing appears, since it's actually trying to unset $&amp;
    $(%flood,) which doesn't exist
  echo -s ------------------------------------------------------

  echo 5 -s -&gt; Command: $(inc -s %flood . [[ $+ [[ $me ]] ],)
  [color:brown]inc -s %flood . [ $+ [ $me ] ][/color]
  echo 5 -s -&gt; should echo "* Inc $+(%,flood.,$me) to 1", but $&amp;
    echoes "* Inc $(%flood,) to 1"
  echo -s ------------------------------------------------------

  echo 5 -s -&gt; Command: $(set -s %flood . [[ $+ [[ $me ]] ]] wrong,)
  [color:brown]set -s %flood . [ $+ [ $me ] ] wrong[/color]
  echo 5 -s -&gt; should echo "* Set $+(%,flood.,$me) to wrong", $&amp;
    but echoes "* Set $(%flood,) to .cold wrong"
  echo -s ------------------------------------------------------

  echo 3 -s $!iif(%flood. [[ $!+ [[ $!me ]] ]] == correct,correct,wrong) $&amp;
    returns $+(", $iif([color:green]%flood. [ $+ [ $me ] ][/color] == correct,correct,wrong) ,")
  echo 5 -s $!iif(%flood . [[ $!+ [[ $!me ]] ]] == correct,correct,wrong) $&amp;
    returns $+(", $iif([color:brown]%flood . [ $+ [ $me ] ][/color] == correct,correct,wrong) ,")
  echo -s ------------------------------------------------------

  echo 3 -s -&gt; $($($+(%,flood.,$me),2),) returns $+(", [color:green]$($+(%,flood.,$me),2)[/color] ,")
  echo 3 -s -&gt; $(%flood. [[ $+ [[ $me ]] ],) returns $+(", [color:green]%flood. [ $+ [ $me ] ][/color] ,")
  echo 5 -s -&gt; $(%flood . [[ $+ [[ $me ]] ],) returns $+(", [color:brown]%flood . [ $+ [ $me ] ][/color] ,")
  echo 5 -s -&gt; $(%flood,) returns $+(", %flood ,")
  echo -s ------------------------------------------------------

  unset %flood*
}


My results:
Code:
[color:brown][color:green]-&gt; Command: set -s %flood. $+ $me correct
-
* Set %flood.cold to correct
-
-&gt; should echo "* Set %flood.cold to correct"[/color]
[color:black]------------------------------------------------------[/color]
-&gt; Command: unset -s %flood . [ $+ [ $me ] ]
-&gt; should echo "* Unset %flood.cold", but nothing appears, since it's
  actually trying to unset %flood which doesn't exist
[color:black]------------------------------------------------------[/color]
-&gt; Command: inc -s %flood . [ $+ [ $me ] ]
-
* Inc %flood to 1
-
-&gt; should echo "* Inc %flood.cold to 1", but echoes "* Inc %flood to 1"
[color:black]------------------------------------------------------[/color]
-&gt; Command: set -s %flood . [ $+ [ $me ] ] wrong
-
* Set %flood to .cold wrong
-
-&gt; should echo "* Set %flood.cold to wrong", but echoes "* Set
  %flood to .cold wrong"
[color:black]------------------------------------------------------[/color]
[color:green]-&gt; $iif(%flood. [ $+ [ $me ] ] == correct,correct,wrong) returns "correct"[/color]
-&gt; $iif(%flood . [ $+ [ $me ] ] == correct,correct,wrong) returns "wrong"
[color:black]------------------------------------------------------[/color]
[color:green]-&gt; $($+(%,flood.,$me),2) returns "correct"
-&gt; %flood. [ $+ [ $me ] ] returns "correct"[/color]
-&gt; %flood . [ $+ [ $me ] ] returns ".cold wrong .cold"
-&gt; %flood returns ".cold wrong"
[color:black]------------------------------------------------------[/color][/color]


(Sorry it's big, but it clears my point)


Quote:
/silence is not a mIRC command, but is provided by the network you are on, so it does'work on some (like DALnet) and not others (like Efnet)

/me agrees. And that's why I said I wouldn't use it ("/silence does, but I don't know if it's supported on most networks, so I won't use it here"). I just mentioned it.

Quote:
Third, if you are worried about users sending you a valid message in those 5 measely seconds you are ignoring everything, then you should get your priorities straightened out. If a channel flood occurs, the only thing that matters is stopping it. And if you're that worried about missing a query, just ignore the channel alone then.

Yeah, I agree. Ignoring *!*@* with the -c switch should be fine. But I'd also ignore the flooder's address, for more than 5 secs. So, the code would be changed to:
Code:
on @*:TEXT:*:#:{
  inc -u5 $+(%,flood;,$address,;,$chan)
  if ( [ [ $+(%,flood;,$address,;,$chan) ] ] &gt; 4) { 
    ignore -cu5 *
    ban -k $chan $nick 3 Stop flooding dude
    ignore -u60 $nick 3
  }
}

Joined: Mar 2003
Posts: 1,256
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,256
damn, missed that space...

Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
Ah, so it was a typo smile (or something like this, I don't know how to describe it in English). I knew I would regret posting a big and detailed example script for it.. :tongue:

Page 1 of 2 1 2

Link Copied to Clipboard