Mass join/part protection

By Lindrian on Mar 14, 2007

This is a snippet I made, mostly to get used to dialogs (Which wasnt that hard) and for a few issues in some of my channels.
just right click the channel, find the menu and voila.

Or you can use the alias itself, by typing /chan_flood

If any bugs are found, PM me or post a comment here.

And please, do not ripp or modify this script w/o my permission.

Also, thanks to xDaemon for pointing a few things out.

GL & HF with the script!

Edit:

Made a very quick update, took me 10 minutes to finish, enjoy.

on *:START: {
  if ($version < 6.16) {
    echo -st You are running a version below 6.16 which might cause troubble!
    echo -st I highly advice you to download the newest mIRC client from http://www.mirc.com
    unload -rs " $+ $script $+ "
  }
  else {
    unset $+(%,flood,.%chan)
  }
}
on *:LOAD: {
  if ($version < 6.16) {
    echo -st You are running a version below 6.16 which might cause troubble!
    echo -st I highly advice you to download the newest mIRC client from http://www.mirc.com
    unload -rs " $+ $script $+ "
  }
}
#Channel.flood off
on !*:JOIN:%chan: {
  if (!$nick($chan,$nick,oh)) {
    inc $($+(%,flood,.,%chan))
    if ($($+(%,flood,.,%chan),2) > %c) {
      $+(,.timer,.unset,.flood) 1 %timeout unset $($+(%,flood,.,%chan),2)
      if ($nick($chan,$nick,vr)) {
        msg %chan Join flood detected at $+($asctime(HH:nn),/,$date(mmmm),$chr(32),$ord($date(d))) on %chan $+ .
        msg %chan Locking channel for $duration(%fl.reset) $+ !
        mode %chan +i
        if (!$window(@Flood)) { window @Flood }
        aline -hp @Flood Attempt at join flood was prevent at $+($asctime(HH:nn),/,$date(mmmm),$chr(32),$ord($date(d))) on %chan $+ .
        $+(,.timer,.flood) 1 %fl.reset mode %chan -i
      }
    }
  }
}
on !*:PART:%chan: {
  if ($nick($chan,$nick,vr)) {
    inc $($+(%,flood,.,%chan))
  }
}
#Channel.flood end
alias flood_info {
  echo -at The current settings are:
  $iif(%chan,echo -at Channel: %chan, echo -at No present settings for the channel!)
  $iif(%timeout,echo -at Timeout: $duration(%timeout), echo -at No present settings for the timeout!) 
  $iif(%fl.reset, echo -at Reset time: $duration(%fl.reset), echo -at No present settings for the reset time!) 
  $iif(%c,echo -at Max join/parts: %c, echo -at No present settings for maximum join/part!) 
}

alias flood_reset {
  set %timeout 30
  set %fl.reset 20
  set %chan #none
  set %c 5
  echo -at Everything was reset!
}

dialog chan_flood {
  title "Channel flood control v.1.17 by: Lindrian"
  Size -1 -1 260 285
  box " Channel [Only works in one channel!]  ", 1, 15 10 225 45
  edit # $+ %chan, 2, 26 26 202 20, tab 100
  box "Timeout", 3, 15 60 225 45
  edit $duration(%timeout), 4, 26 75 202 20, tab 100
  box "Reset time", 5, 15 110 225 45
  edit $duration(%fl.reset), 6, 26 125 202 20, tab 100
  box "Maximum join/parts [Must be a number!]", 7, 15 160 225 45
  edit %c, 8, 26 175 202 20
  button "Ok", 9, 85 210 55 20, ok
  button "Cancel", 10, 20 210 55 20, cancel
  button "Reset", 11, 20 230 55 20
  button "Settings", 15, 85 230 55 20
  button "Enable", 13, 20 250 55 20
  Text "Channel Flood protection v.1.17 by Lindrian - Locks the channel on eventual flood!", 12, 145 210 100 180
}

alias chan_flood { if (!$dialog(chan_flood)) { dialog -m chan_flood chan_flood } }

on *:dialog:chan_flood:*:*: {
  if ($devent == init) {
    did -ra $dname 2 $iif(%chan,%chan,-No settings-)
    did -ra $dname 4 $iif(%timeout,$duration(%timeout),-No settings-)
    did -ra $dname 6 $iif(%fl.reset,$duration(%fl.reset),-No settings-)
    did -ra $dname 8 $iif(%c,%c,-No settings-)
    $iif($group(#channel.flood) == on,did -ra $dname 13 Disable,did -ra $dname 13 Enable)
  }
  elseif ($devent == sclick) {
    if ($did == 15) {
      flood_info
    }
    elseif ($did == 13) {
      $iif($group(#channel.flood) == on,disable #channel.flood,enable #channel.flood)
      $iif($group(#channel.flood) == on,did -ra $dname 13 Disable,did -ra $dname 13 Enable)
    }
    elseif ($did == 11) {
      beep 2 | var %warn $input(Are you sure you wish to reset to default settings?,yv,Warning - Flood protection)
      if (%warn == $no) { return }
      if (%warn == $yes) {
        flood_reset 
      }
    }
  }
  elseif ($devent == edit) {
    if ($did == 2) {
      set %chan $did(2) 
    }
  }
  elseif ($did == 4) {
    if ($did(4) isnum) {
      set %timeout $did(4)
    }
    else {
      beep 2 | var %error $input(You did not input a correct value in the edit box!
    }
  }
  elseif ($did == 6) {
    if ($did(6) isnum) {
      set %fl.reset $did(6)
    }
    else {
      beep 2 | var %error $input(You did not input a correct value in the edit box!
    }
  }
  elseif ($did == 8) {
    $iif($left($did(8),1) != $chr(35),set %c $+($chr(35),$did(8)),set %c $did(8))
  }
}

menu * {
  -
  Flood prot
  .Flood protection: chan_flood
  .-
  .Credits!: echo -at Channel protection by Lindrian! v.1.17 | echo -at Contact me through irc.deltaanime.net @ #Lindrian or #L2forever! Also join me at: irc.ungowa.org @ #Ungowa!
  -
}
menu @flood {
  .Clear @Flood: var %con $input(Are you sure you wish to clear the window?,yv,Confirm - Flood protection) | if (%con == $yes) { clear @flood }
}

Comments

Sign in to comment.
Cheiron   -  May 03, 2010

mass join part if on UNREALIRCD servers .. you have server mode +j X;Y .it is designed to protect against join-part floods (revolving door floods). The mode takes a parameter of the form X:Y where X is the number of joins and Y is the number of seconds. If a user exceeds this limit, he/she will be prevented from joining the channel. to set it .. the command is /mode #channelname +j X:Y :)
note... This mode works on a per-user basis not global like mode +f :)
just food for thought to save scriptinh

 Respond  
Marcellx   -  May 03, 2010

hallo...can u crete some massjoin protection remote please..

maybe u can join us play some massjoin kick and see urself how ur remote do it..

please reply n i will let u know which server we play..okay

 Respond  
damdempsel   -  Jul 21, 2008

sadly noone in a channel i was in had this and channel just got flooded...

 Respond  
BytchAmy   -  Jan 17, 2008

the only setting that stays is where you add the channel the other settings stay back on default & say -No settings- Timeout, Reset & maximum join/part stay on default for some reason

 Respond  
Lindrian   -  Oct 16, 2007

Oh buddy, Lanten, this was my first script with a dialog, and i aint workig on it no more, but yesm, a netsplit would fuck up.

 Respond  
Lanten   -  Oct 16, 2007

does this mean this would be sensitive to mass joins due to a net merge? (after a netsplit)

 Respond  
Lindrian   -  Apr 29, 2007

Btw, I belive u can use multiple channels by using:
\"#channel1,#channel2,#channel3\"
Aka, comma seperated.

 Respond  
Lindrian   -  Apr 24, 2007

Ill be updatin\' this one aswell, when I got time. Too mcuh to do nowdays ;p.

Ill change the dialog, make it smaller as the size of it aint needed, fix some other stuff, it\'ll be nice ;p

 Respond  
Lindrian   -  Mar 24, 2007

The code was mainly for testing out dialogs, it was my first work.

But, when I get some spare time, ill see what I can do. I am currently working on my Away script, and thats my highest priority. As I dont get much feedback, its hard to determine whats bad and whats not.

 Respond  
|MELIORITE|   -  Mar 23, 2007

Nice work Lindrian... just wondered if you thought about multiple channel use for the code? ... just wondering...

 Respond  
Lindrian   -  Mar 15, 2007

o, some good and usfull, and also very contructive information!

Thanks, very usefull.

Although, I wont go change the change the code atm, as its not needed, ;p

But I appreciate the information Darth!

 Respond  
DarthReven   -  Mar 15, 2007

Also to shorten you code alittle bit and make it operate a bit better instead of using: \'if ($nick !isop %chan) || ($nick !ishop %chan) {\' you can use \'if ($nick($chan,$nick,vr)) {\' which will make the script only go off when a voiced or regular user sets it off. Also in your alias rather then having 12 if (%variable) or if (!%variable) we can just simplify this by using an $iif statement like this: \'echo -a Channel: $iif(%chan,%chan,ERROR - The Channel is not set! Type /chan_flood and edit it!)\' which will handle both instances in one line and makes the script much neater. Other then those few things you have what looks to be a pretty good code just work on improving the way in which you code your scripts and you\'ll be making even better ones soon. Good job

 Respond  
DarthReven   -  Mar 15, 2007

You don\'t need the On load event On Start will operate both when mIRC starts and when the script is loaded for the first time

 Respond  
Lindrian   -  Mar 15, 2007

Haha, cheers for the feedback!

 Respond  
Zachery   -  Mar 14, 2007

nice, ungawa ungawa lindrains got the powa :< (im bored) :P

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.