[script]
n0=;********************************************************************
n1=;    AFP v2.0 (Advanced Flood Protection)
n2=;    Created by W\RRIOR - 2000
n3=;    For mIRC 5.7 or above
n4=;    afp2.ini  [2 of 2]
n5=;
n6=;********************************************************************
n7=; NOTE: Conflict warning. Make sure you don't have duplicate events of the ones below in other scripts. See Help tab in AFP for more info.
n8=;
n9=on *:nick:{
n10=  if ($nick != $me) {
n11=    if (%pro.c.nik = $null) || (%pro.c.nik.max = $null) || (%pro.c.nik.sec = $null) halt
n12=    %chnc_uad = $address($newnick,2)
n13=    %chnc_total = $chan(0)
n14=    inc -u [ $+ [ %pro.c.nik.sec ] ] %pro.c.nik.f [ $+ [ %chnc_uad ] ] 1
n15=    if (%pro.c.nik.f [ $+ [ %chnc_uad ] ] > %pro.c.nik.max) goto searchc
n16=    halt
n17=    :searchc
n18=    inc %chnc_inc 1
n19=    if (%chnc_inc > %chnc_total) { unset %pro.c.nik.f [ $+ [ %chnc_uad ] ] | unset %chnc_* | halt }
n20=    %chnc_n = $chan(%chnc_inc)
n21=    if ($me !isop %chnc_n) || ($newnick !ison %chnc_n) goto searchc
n22=    if ($newnick isop %chnc_n) { mode %chnc_n -o $newnick }
n23=    if (%pro.c.k-b = !) { ban %chnc_n $newnick %pro.s.i-b.typ2 }
n24=    kick %chnc_n $newnick %pro.c.kck.msg (Exceeded %pro.c.nik.max nick changes within %pro.c.nik.sec secs)
n25=    goto searchc
n26=  }
n27=}
n28=on *:join:#:{
n29=  if ($nick != $me) {
n30=    if ($me isop $chan) {
n31=      if (%pro.c.j-p = $null) || %pro.c.j-p.max = $null) || (%pro.c.j-p.sec = $null) halt
n32=      inc -u [ $+ [ %pro.c.j-p.sec ] ] %pro.c.j-p.f [ $+ [ $nick ] ] 1
n33=      if (%pro.c.j-p.f [ $+ [ $nick ] ] > %pro.c.j-p.max) {
n34=        if ($nick isop #) { mode # -o $nick }
n35=        if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n36=        kick # $nick %pro.c.kck.msg (Exceeded %pro.c.j-p.max joins within %pro.c.j-p.sec secs) | unset %pro.c.j-p.f [ $+ [ $nick ] ]
n37=      }
n38=    }
n39=  }
n40=}
n41=on !*:part:#:{
n42=;  %rjc.chan = # | if ($nick(%rjc.chan,0,o,ahvr) == 0) && ($nick(%rjc.chan,0) == 2) && ($me !isop #) { raw -q part %rjc.chan | raw -q join %rjc.chan | unset %rjc.* }
n43=  if ($me isop $chan) {
n44=    if (%pro.c.j-p = $null) || %pro.c.j-p.max = $null) || (%pro.c.j-p.sec = $null) halt
n45=    inc -u [ $+ [ %pro.c.j-p.sec ] ] %pro.c.j-p.f2 [ $+ [ $nick ] ] 1
n46=    if (%pro.c.j-p.f2 [ $+ [ $nick ] ] > %pro.c.j-p.max) {
n47=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n48=      kick # $nick %pro.c.kck.msg (Exceeded %pro.c.j-p.max parts within %pro.c.j-p.sec secs) | unset %pro.c.j-p.f2 [ $+ [ $nick ] ]
n49=   }
n50=  }
n51=}
n52=on *:text:*:#:{
n53=  if ($me isop $chan) {
n54=    if (%pro.c.txt = $null) || %pro.c.txt.max = $null) || (%pro.c.txt.sec = $null) halt    
n55=    inc -u [ $+ [ %pro.c.txt.sec ] ] %pro.c.txt.f [ $+ [ $nick ] ] 1
n56=    if (%pro.c.txt.f [ $+ [ $nick ] ] > %pro.c.txt.max) {
n57=      if ($nick isop #) { mode # -o $nick }
n58=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n59=      kick # $nick %pro.c.kck.msg (Exceeded %pro.c.txt.max lines of text within %pro.c.txt.sec secs) | unset %pro.c.txt.f [ $+ [ $nick ] ]
n60=    }
n61=    if ($len($1-) > %pro.a.len) && (%pro.a.len != $null) && (%pro.a.len != 999) {
n62=      if ($nick isop #) { mode # -o $nick }
n63=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n64=      kick # $nick %pro.c.kck.msg (Exceeded max text length of %pro.a.len chars | unset %pro.c.txt.f [ $+ [ $nick ] ]
n65=    }
n66=  }
n67=}
n68=on !*:action:*:#:{
n69=  if ($me isop $chan) {
n70=    if (%pro.c.act = $null) || %pro.c.act.max = $null) || (%pro.c.act.sec = $null) halt
n71=    inc -u [ $+ [ %pro.c.act.sec ] ] %pro.c.act.f [ $+ [ $nick ] ] 1
n72=    if (%pro.c.act.f [ $+ [ $nick ] ] > %pro.c.act.max) {
n73=      if ($nick isop #) { mode # -o $nick }
n74=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n75=      kick # $nick %pro.c.kck.msg (Exceeded %pro.c.act.max actions within %pro.c.act.sec secs) | unset %pro.c.act.f [ $+ [ $nick ] ]
n76=    }
n77=    if ($len($1-) > %pro.a.len) && (%pro.a.len != $null) && (%pro.a.len != 999) {
n78=      if ($nick isop #) { mode # -o $nick }
n79=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n80=      kick # $nick %pro.c.kck.msg (Exceeded max text length of %pro.a.len chars | unset %pro.c.act.f [ $+ [ $nick ] ]
n81=    }
n82=  }
n83=}
n84=on !*:notice:*:#:{
n85=  if ($me isop $chan) {
n86=    if (%pro.c.not = $null) || %pro.c.not.max = $null) || (%pro.c.not.sec = $null) halt
n87=    inc -u [ $+ [ %pro.c.not.sec ] ] %pro.c.not.f [ $+ [ $nick ] ] 1
n88=    if (%pro.c.not.f [ $+ [ $nick ] ] > %pro.c.not.max) {
n89=      if ($nick isop #) { mode # -o $nick }
n90=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n91=      kick # $nick %pro.c.kck.msg (Exceeded %pro.c.not.max notices within %pro.c.not.sec secs) | unset %pro.c.not.f [ $+ [ $nick ] ]
n92=    }
n93=    if ($len($1-) > %pro.a.len) && (%pro.a.len != $null) && (%pro.a.len != 999) {
n94=      if ($nick isop #) { mode # -o $nick }
n95=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n96=      kick # $nick %pro.c.kck.msg (Exceeded max text length of %pro.a.len chars | unset %pro.c.not.f [ $+ [ $nick ] ]
n97=    }
n98=  }
n99=}
n100=ctcp !*:*:#:{
n101=  if ($me isop $chan) {
n102=    if (%pro.c.ctc = $null) || %pro.c.ctc.max = $null) || (%pro.c.ctc.sec = $null) goto end
n103=    inc -u [ $+ [ %pro.c.ctc.sec ] ] %pro.c.ctc.f [ $+ [ $nick ] ] 1
n104=    if (%pro.c.ctc.f [ $+ [ $nick ] ] > %pro.c.ctc.max) {
n105=      if ($nick isop #) { mode # -o $nick }
n106=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n107=      kick # $nick %pro.c.kck.msg (Exceeded %pro.c.ctc.max ctcps within %pro.c.ctc.sec secs) | unset %pro.c.ctc.f [ $+ [ $nick ] ]
n108=    }
n109=    if ($len($1-) > %pro.a.len) && (%pro.a.len != $null) && (%pro.a.len != 999) {
n110=      if ($nick isop #) { mode # -o $nick }
n111=      if (%pro.c.k-b = !) { ban # $nick %pro.s.i-b.typ2 }
n112=      kick # $nick %pro.c.kck.msg (Exceeded max text length of %pro.a.len chars | unset %pro.c.ctc.f [ $+ [ $nick ] ]
n113=    }
n114=    :end
n115=  }
n116=}
n117=on !*:text:*:?:{
n118=  if (%pro.s.n-m = $null) || %pro.s.n-m.max = $null) || (%pro.s.n-m.sec = $null) halt
n119=  inc -u [ $+ [ %pro.s.n-m.sec ] ] %pro.s.n-m.f [ $+ [ $nick ] ] 1
n120=  if (%pro.s.n-m.f [ $+ [ $nick ] ] > %pro.s.n-m.max) || ($len($1-) > %pro.a.len) {
n121=    if (%pro.s.ign.tmp = !) { ignore -pntiu [ $+ [ %pro.s.ign.sec ] ] $mask($fulladdress,%pro.s.i-b.typ2) }
n122=    if (%pro.s.ign.prm = !) { ignore -pnti $mask($fulladdress,%pro.s.i-b.typ2) }
n123=    notice $nick NOTICE - You have been placed on ignore for private notice/msg flooding
n124=    unset %pro.s.n-m.f [ $+ [ $nick ] ]
n125=  }
n126=}
n127=ctcp !*:dcc send:?:{
n128=  if (%pro.s.snd = $null) || %pro.s.snd.max = $null) || (%pro.s.snd.sec = $null) goto end
n129=  inc -u [ $+ [ %pro.s.snd.sec ] ] %pro.s.snd.f [ $+ [ $nick ] ] 1
n130=  if (%pro.s.snd.f [ $+ [ $nick ] ] > %pro.s.snd.max) || ($len($1-) > %pro.a.len) {
n131=    if (%pro.s.ign.tmp = !) { ignore -pntiu [ $+ [ %pro.s.ign.sec ] ] $mask($fulladdress,%pro.s.i-b.typ2) }
n132=    if (%pro.s.ign.prm = !) { ignore -pnti $mask($fulladdress,%pro.s.i-b.typ2) }
n133=    notice $nick NOTICE - You have been placed on ignore for dcc send request flooding
n134=    unset %pro.s.snd.f [ $+ [ $nick ] ] 
n135=  }
n136=  :end
n137=}
n138=ctcp !*:dcc chat:?:{
n139=  if (%pro.s.cht = $null) || %pro.s.cht.max = $null) || (%pro.s.cht.sec = $null) goto end
n140=  inc -u [ $+ [ %pro.s.cht.sec ] ] %pro.s.cht.f [ $+ [ $nick ] ] 1
n141=  if (%pro.s.cht.f [ $+ [ $nick ] ] > %pro.s.cht.max) || ($len($1-) > %pro.a.len) {
n142=    if (%pro.s.ign.tmp = !) { ignore -pntiu [ $+ [ %pro.s.ign.sec ] ] $mask($fulladdress,%pro.s.i-b.typ2) }
n143=    if (%pro.s.ign.prm = !) { ignore -pnti $mask($fulladdress,%pro.s.i-b.typ2) }
n144=    notice $nick NOTICE - You have been placed on ignore for dcc chat request flooding
n145=    unset %pro.s.cht.f [ $+ [ $nick ] ]
n146=  }
n147=  :end
n148=}
n149=ctcp !*:*:?:{
n150=  if (%pro.s.ctc = $null) || %pro.s.ctc.max = $null) || (%pro.s.ctc.sec = $null) goto end
n151=  inc -u [ $+ [ %pro.s.ctc.sec ] ] %pro.s.ctc.f [ $+ [ $nick ] ] 1
n152=  if (%pro.s.ctc.f [ $+ [ $nick ] ] > %pro.s.ctc.max) || ($len($1-) > %pro.a.len) {
n153=    if (%pro.s.ign.tmp = !) { ignore -pntiu [ $+ [ %pro.s.ign.sec ] ] $mask($fulladdress,%pro.s.i-b.typ2) }
n154=    if (%pro.s.ign.prm = !) { ignore -pnti $mask($fulladdress,%pro.s.i-b.typ2) }
n155=    notice $nick NOTICE - You have been placed on ignore for ctcp flooding
n156=    unset %pro.s.ctc.f [ $+ [ $nick ] ]
n157=  }
n158=  :end
n159=}
n160=on !*:invite:#:{
n161=  if (%pro.s.inv = $null) || %pro.s.inv.max = $null) || (%pro.s.inv.sec = $null) halt
n162=  inc -u [ $+ [ %pro.s.inv.sec ] ] %pro.s.inv.f [ $+ [ $nick ] ] 1
n163=  if (%pro.s.inv.f [ $+ [ $nick ] ] > %pro.s.inv.max) || ($len($1-) > %pro.a.len) {
n164=    if (%pro.s.ign.tmp = !) { ignore -pntiu [ $+ [ %pro.s.ign.sec ] ] $mask($fulladdress,%pro.s.i-b.typ2) }
n165=    if (%pro.s.ign.prm = !) { ignore -pnti $mask($fulladdress,%pro.s.i-b.typ2) }
n166=    notice $nick NOTICE - You have been placed on ignore for invite flooding
n167=    unset %pro.s.inv.f [ $+ [ $nick ] ]
n168=  }
n169=}
n170=on !*:notice:*:?:{
n171=  if (%pro.s.n-m = $null) || %pro.s.n-m.max = $null) || (%pro.s.n-m.sec = $null) halt
n172=  inc -u [ $+ [ %pro.s.n-m.sec ] ] %pro.s.n-m.f2 [ $+ [ $nick ] ] 1
n173=  if (%pro.s.n-m.f2 [ $+ [ $nick ] ] > %pro.s.n-m.max) || ($len($1-) > %pro.a.len) {
n174=    if (%pro.s.ign.tmp = !) { ignore -pntiu [ $+ [ %pro.s.ign.sec ] ] $mask($fulladdress,%pro.s.i-b.typ2) }
n175=    if (%pro.s.ign.prm = !) { ignore -pnti $mask($fulladdress,%pro.s.i-b.typ2) }
n176=    notice $nick NOTICE - You have been placed on ignore for private notice/msg flooding
n177=    unset %pro.s.n-m.f2 [ $+ [ $nick ] ]
n178=  }
n179=}
