This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with flood script - just need help to fix something :)

Help for those learning Tcl or writing their own scripts.
Post Reply
M
Moti
Voice
Posts: 15
Joined: Fri Sep 20, 2013 12:36 pm

Help with flood script - just need help to fix something :)

Post by Moti »

Hi,

I downloaded the script floodcontrol.tcl 1.0.1 and change some things.
I change that if someone flood the channel at the first time he only lose his +v for 20 seconds and recived some messages.

If he continue to flood the bot kick + ban him and send him another messages.

My problem is that in the second part (When user flood again) the bot really kick + ban him and send the messages - but send him the 2 kinds of messages.

This is the part of the code with the messages.
Hope to some help :)

Code: Select all

      if {[lsearch -exact [channel info $chan] "+repeat"] != -1} {
        if {![info exists srepeat_count($uhost:$chan:$arg)]  && [lsearch -exact $srepeat 0] == -1} {set srepeat_count($uhost:$chan:$arg) 0}
        if {![info exists lrepeat_count($uhost:$chan:$arg)] && [lsearch -exact $lrepeat 0] == -1} {set lrepeat_count($uhost:$chan:$arg) 0}
        incr srepeat_count($uhost:$chan:$arg) 1; utimer [lindex $srepeat 1] [list unset -nocomplain srepeat_count($uhost:$chan:$arg)]
        incr lrepeat_count($uhost:$chan:$arg) 1; utimer [lindex $lrepeat 1] [list unset -nocomplain lrepeat_count($uhost:$chan:$arg)]
        if {$lrepeat_count($uhost:$chan:$arg) >= [lindex $lrepeat 0]} {
          if {![info exists chan_flooded($chan)]} {
            lock:chan $chan
            newchanban $chan *!$uhost \002violation\002 "Repeated Violation of Chat Rules: Spamming/Flooding" $repeatban
            putquick "KICK $chan $nick :Repeated Violation of Chat Rules: Spamming/Flooding"
            putserv "privmsg $nick :\00305WARNING:\00300 Please stop spamming/flooding the chat."
            putserv "privmsg $nick :\00303STATUS:\00300 Banned (5 minutes)."
            putserv "privmsg $nick :\00304REASON:\00300 Repeated violation of chat rules - spamming/flooding."
            putserv "privmsg $nick :\00312MESSAGE:\00300 Hello again, $nick. You have been temporarily banned from the chat. This means for the next 5 minutes, you wil$
            putserv "privmsg $nick :* You will be notified when the 5 minute ban is expired"
            putlog "punishing offensive repeat flooders: $nick ($uhost) on $chan."
            utimer 330 "putserv \"privmsg $nick :\00303STATUS:\00300\ In good standing.\""
            utimer 331 "putserv \"privmsg $nick :\00312MESSAGE:\00300 Good news $nick, your 5 minute ban has expired and you are welcome to re-enter the chat. Please r$
          }
        } elseif {$srepeat_count($uhost:$chan:$arg) == [lindex $srepeat 0]} {
          putquick "mode $chan -v $nick"
          putserv "privmsg $nick :\00305WARNING:\00300 Please stop spamming/flooding the chat."
          putserv "privmsg $nick :\00303STATUS:\00300 Muted (20 seconds)."
          putserv "privmsg $nick :\00304REASON:\00300 Violation of chat rules - spamming/flooding."
          putserv "privmsg $nick :\00312MESSAGE:\00300 Dear $nick, you have been muted. this means for the next 20 seconds, you will not be able to send messages to th$
          utimer 20 "putquick \"MODE $chan +v $nick\""
        }
      }
    }
  }
Really thanks ! :)
Post Reply