[script]
n0=;********************************************************************
n1=;    AFP v2.0 (Advanced Flood Protection)
n2=;    Created by W\RRIOR - 2000
n3=;    For mIRC 5.7 or above
n4=;    afp.ini  [1 of 2]
n5=;    Usage: /afp
n6=;
n7=;********************************************************************
n8=on *:load:{
n9=  if ($exists($scriptdirafp2.ini) == $true) {
n10=    .load -rs $scriptdir\afp2.ini | if ($ial == $false) .ial on
n11=    echo -a 15,6 $timestamp 0,6 AFP v2.0 (Advanced Flood Protection)  | echo -a 15,6 $timestamp 0,6 Created by W\RRIOR - 2000 (texnwar@hotmail.com) 
n12=    echo -a 15,6 $timestamp 0,6 For mIRC 5.7 or above  | echo -a 15,6 $timestamp 0,6 Usage: /afp or use popup menus  | unset %pro.c.kck.msg
n13=  }
n14=  else { .unload -rs $scriptdirafp.ini | echo -a 0,4 $timestamp 8,4 *** Missing afp2.ini. File doesn't exist in same folder as $scriptdir  | echo -a 0,4 $timestamp 8,4 *** Unloaded afp.ini  }
n15=}
n16=alias afp { if ($dialog(afpd) == $null) dialog -m afpd afpd }
n17=dialog afpd {
n18=  title "AFP v2.0 - Advanced Flood Protection"
n19=  size -1 -1 257 178
n20=  option dbu
n21=  button "&Apply", 1, 10 147 37 11, ok default
n22=  button "&Reset", 2, 192 147 26 11
n23=  button "&Close", 3, 5 165 37 11, cancel
n24=  button "C&lear All", 35, 221 147 26 11
n25=  button "&Enable All", 65, 50 147 37 11
n26=  button "&Disable All", 66, 90 147 37 11
n27=  box "Channel Protection (requires ops)", 4, 10 20 117 123
n28=  box "Self Protection", 5, 130 20 117 95
n29=  text "TEXT              Max         within         secs", 6, 24 30 100 8
n30=  check "", 7, 15 30 8 8
n31=  edit "", 8, 72 29 8 9
n32=  edit "", 9, 99 29 8 9
n33=  text "ACTION          Max         within         secs", 10, 24 40 99 8
n34=  check "", 11, 15 40 8 8
n35=  edit "", 12, 72 39 8 9
n36=  edit "", 13, 99 39 8 9
n37=  text "NOTICE          Max         within         secs", 14, 24 50 99 8
n38=  check "", 15, 15 50 8 8
n39=  edit "", 16, 72 49 8 9
n40=  edit "", 17, 99 49 8 9
n41=  text "CTCP              Max         within         secs", 18, 24 60 99 8
n42=  check "", 19, 15 60 8 8
n43=  edit "", 20, 72 59 8 9
n44=  edit "", 21, 99 59 8 9
n45=  text "NICK               Max         within         secs", 22, 24 70 99 8
n46=  check "", 23, 15 70 8 8
n47=  edit "", 24, 72 69 8 9
n48=  edit "", 25, 99 69 8 9
n49=  text "JOIN/PART    Max         within         secs", 26, 24 80 99 8
n50=  check "", 27, 15 80 8 8
n51=  edit "", 28, 72 79 8 9
n52=  edit "", 29, 99 79 8 9
n53=  text "Penalty for exceeding max:", 30,  15 95 64 9
n54=  radio "Kick/Ban", 31, 20 103 33 8, group
n55=  radio "Kick Only", 32, 20 112 33 8
n56=  text "Kick Msg:", 33, 15 129 24 8
n57=  edit "", 34, 41 127 81 11, autohs
n58=  text "MSG/NTC      Max         within         secs", 36, 144 30 99 8
n59=  check "", 37, 135 30 8 8
n60=  edit "", 38, 192 29 8 9
n61=  edit "", 39, 219 29 8 9
n62=  text "CTCP              Max         within         secs", 40, 144 40 99 8
n63=  check "", 41, 135 40 8 8
n64=  edit "", 42, 192 39 8 9
n65=  edit "", 43, 219 39 8 9
n66=  text "INVITE           Max         within         secs", 44, 144 50 99 8
n67=  check "", 45, 135 50 8 8
n68=  edit "", 46, 192 49 8 9
n69=  edit "", 47, 219 49 8 9
n70=  text "DCC SEND     Max         within         secs", 48, 144 60 99 8
n71=  check "", 49, 135 60 8 8
n72=  edit "", 50, 192 59 8 9
n73=  edit "", 51, 219 59 8 9
n74=  text "DCC CHAT     Max         within         secs", 52, 144 70 99 8
n75=  check "", 53, 135 70 8 8
n76=  edit "", 54, 192 69 8 9
n77=  edit "", 55, 219 69 8 9
n78=  text "Ignore Type:", 56,  135 85 30 8
n79=  radio "", 57, 140 93 7 8, group
n80=  radio "", 58, 140 102 7 8
n81=  text "Ignore for          min(s)", 59, 149 93 53 8
n82=  edit "20", 60, 174 92 11 10
n83=  text "Permanent", 61, 149 102 27 8
n84=  box "Mask Type (ban and ignore)", 62, 130 116 88 27
n85=  combo 63, 135 127 78 53, hsbar size drop
n86=  ;------------------- icon 64, -1 -1 569 351
n87=  box "CPL", 67, 221 116 26 27
n88=  edit "", 68, 227 127 14 11
n89=  text "Created by W\RRIOR - 2000", 69, 183 167 70 9, disable
n90=  tab "Flood Control", 70, 5 2 247 160
n91=  tab "Help", 71
n92=  edit "", 72, 7 23 243 138, read return multi vsbar hide
n93=}
n94=on *:dialog:afpd:init:*:{
n95=  %afp_hlp = $scriptdirafp-hlp.txt | if ($ial == $false) .ial on
n96=  did -a afpd 63 [0] *!user@host.domain
n97=  did -a afpd 63 [1] *!*user@host.domain
n98=  did -a afpd 63 [2] *!*@host.domain
n99=  did -a afpd 63 [3] *!*user@*.domain
n100=  did -a afpd 63 [4] *!*@*.domain
n101=  did -a afpd 63 [5] nick!user@host.domain
n102=  did -a afpd 63 [6] nick!*user@host.domain
n103=  did -a afpd 63 [7] nick!*@host.domain
n104=  did -a afpd 63 [8] nick!*user@*.domain
n105=  did -a afpd 63 [9] nick!*@*.domain
n106=  did -b afpd 1 | .timer 1 0 did -f afpd 34
n107=  if (%pro.s.i-b.typ == $null) { %pro.s.i-b.typ = 3 | %pro.s.i-b.sel = $gettok($did(63,%pro.s.i-b.typ),2,32) } | did -c afpd 63 %pro.s.i-b.typ
n108=  if (%pro.c.kck.msg == $null) { %pro.c.kck.msg = Flood control kick (AFP v2.0) } | did -a afpd 34 %pro.c.kck.msg
n109=  if (%pro.a.len == $null) { %pro.a.len = 300 } | did -a afpd 68 %pro.a.len
n110=  checkeditb
n111=  if (%pro.s.n-m.max != $null) { did -a afpd 38 %pro.s.n-m.max }
n112=  if (%pro.s.n-m.sec != $null) { did -a afpd 39 %pro.s.n-m.sec }
n113=  if (%pro.s.ctc.max != $null) { did -a afpd 42 %pro.s.ctc.max }
n114=  if (%pro.s.ctc.sec != $null) { did -a afpd 43 %pro.s.ctc.sec }
n115=  if (%pro.s.inv.max != $null) { did -a afpd 46 %pro.s.inv.max }
n116=  if (%pro.s.inv.sec != $null) { did -a afpd 47 %pro.s.inv.sec }
n117=  if (%pro.s.snd.max != $null) { did -a afpd 50 %pro.s.snd.max }
n118=  if (%pro.s.snd.sec != $null) { did -a afpd 51 %pro.s.snd.sec }
n119=  if (%pro.s.cht.max != $null) { did -a afpd 54 %pro.s.cht.max }
n120=  if (%pro.s.cht.sec != $null) { did -a afpd 55 %pro.s.cht.sec }
n121=  if (%pro.c.txt.max != $null) { did -a afpd 8 %pro.c.txt.max }
n122=  if (%pro.c.txt.sec != $null) { did -a afpd 9 %pro.c.txt.sec }
n123=  if (%pro.c.act.max != $null) { did -a afpd 12 %pro.c.act.max }
n124=  if (%pro.c.act.sec != $null) { did -a afpd 13 %pro.c.act.sec }
n125=  if (%pro.c.not.max != $null) { did -a afpd 16 %pro.c.not.max }
n126=  if (%pro.c.not.sec != $null) { did -a afpd 17 %pro.c.not.sec }
n127=  if (%pro.c.ctc.max != $null) { did -a afpd 20 %pro.c.ctc.max }
n128=  if (%pro.c.ctc.sec != $null) { did -a afpd 21 %pro.c.ctc.sec }
n129=  if (%pro.c.nik.max != $null) { did -a afpd 24 %pro.c.nik.max }
n130=  if (%pro.c.nik.sec != $null) { did -a afpd 25 %pro.c.nik.sec }
n131=  if (%pro.c.j-p.max != $null) { did -a afpd 28 %pro.c.j-p.max }
n132=  if (%pro.c.j-p.sec != $null) { did -a afpd 29 %pro.c.j-p.sec }
n133=  if (%pro.s.n-m = !) { did -c afpd 37 } | else { did -b afpd 38,39 }
n134=  if (%pro.s.ctc = !) { did -c afpd 41 } | else { did -b afpd 42,43 }
n135=  if (%pro.s.inv = !) { did -c afpd 45 } | else { did -b afpd 46,47 }
n136=  if (%pro.s.snd = !) { did -c afpd 49 } | else { did -b afpd 50,51 }
n137=  if (%pro.s.cht = !) { did -c afpd 53 } | else { did -b afpd 54,55 }
n138=  if (%pro.c.txt = !) { did -c afpd 7 } | else { did -b afpd 8,9 }
n139=  if (%pro.c.act = !) { did -c afpd 11 } | else { did -b afpd 12,13 }
n140=  if (%pro.c.not = !) { did -c afpd 15 } | else { did -b afpd 16,17 }
n141=  if (%pro.c.ctc = !) { did -c afpd 19 } | else { did -b afpd 20,21 }
n142=  if (%pro.c.nik = !) { did -c afpd 23 } | else { did -b afpd 24,25 }
n143=  if (%pro.c.j-p = !) { did -c afpd 27 } | else { did -b afpd 28,29 }
n144=  if (%pro.c.kik = !) { did -c afpd 32 | unset %pro.c.k-b } | else { did -c afpd 31 }
n145=  if (%pro.s.ign.prm = $null) && (%pro.s.ign.tmp = $null) { %pro.s.ign.tmp = ! | %pro.s.ign.min = 5 | %pro.s.ign.sec = 300 }
n146=  if (%pro.s.ign.prm = !) { did -c afpd 58 | did -u afpd 57 | did -m afpd 60 }
n147=  if (%pro.s.ign.tmp = !) { did -c afpd 57 | did -u afpd 58 | did -n afpd 60 }
n148=  did -o afpd 60 1 %pro.s.ign.min
n149=}
n150=on *:dialog:afpd:edit:*:{
n151=  if ($did = 34) { did -e afpd 1,2 | halt }
n152=  if ($did($did) != $null) { unset %pro.chk.edt | did -e afpd 1,2 }
n153=  if ($did($did) = $null) || ($did($did) !isnum) || ($left($did($did),1) == 0) || (- isin $did($did)) || (+ isin $did($did)) || (. isin $did($did)) { set %pro.chk.edt ! | did -b afpd 1 | halt }
n154=}
n155=on *:dialog:afpd:sclick:*:{
n156=  if ($did = 1) {
n157=    if (%pro.chk.edt != $null) halt | if ($did(68) < 50) { did -o afpd 68 1 50 | halt }
n158=    %pro.a.len = $did(68) | %pro.c.txt.max = $did(8) | %pro.c.txt.sec = $did(9) | %pro.c.act.max = $did(12) | %pro.s.ign.min = $did(60) | %pro.s.ign.sec = %pro.s.ign.min * 60
n159=    %pro.c.act.sec = $did(13) | %pro.c.not.max = $did(16) | %pro.c.not.sec = $did(17) | %pro.c.ctc.max = $did(20) | %pro.c.ctc.sec = $did(21)
n160=    %pro.c.nik.max = $did(24) | %pro.c.nik.sec = $did(25) | %pro.c.j-p.max = $did(28) | %pro.c.j-p.sec = $did(29) | %pro.s.n-m.max = $did(38)
n161=    %pro.s.n-m.sec = $did(39) | %pro.s.ctc.max = $did(42) | %pro.s.ctc.sec = $did(43) | %pro.s.inv.max = $did(46) | %pro.s.inv.sec = $did(47)
n162=    %pro.s.snd.max = $did(50) | %pro.s.snd.sec = $did(51) | %pro.s.cht.max = $did(54) | %pro.s.cht.sec = $did(55) | %pro.c.kck.msg = $did(34)
n163=    %pro.s.i-b.typ = $did(63).sel | %pro.s.i-b.sel = $gettok($did(63,%pro.s.i-b.typ),2,32) | %pro.s.i-b.typ2 = %pro.s.i-b.typ - 1
n164=    did -b afpd 1 | halt
n165=  }
n166=  if ($did = 2) {
n167=    %pro.s.n-m = ! | did -c afpd 37 | did -o afpd 38 1 3 | did -o afpd 39 1 2 | %pro.s.n-m.max = 3 | %pro.s.n-m.sec = 2
n168=    %pro.s.ctc = ! | did -c afpd 41 | did -o afpd 42 1 2 | did -o afpd 43 1 5 | %pro.s.ctc.max = 2 | %pro.s.ctc.sec = 5
n169=    %pro.s.inv = ! | did -c afpd 45 | did -o afpd 46 1 2 | did -o afpd 47 1 5 | %pro.s.inv.max = 2 | %pro.s.inv.sec = 5
n170=    %pro.s.snd = ! | did -c afpd 49 | did -o afpd 50 1 3 | did -o afpd 51 1 5 | %pro.s.snd.max = 3 | %pro.s.snd.sec = 5
n171=    %pro.s.cht = ! | did -c afpd 53 | did -o afpd 54 1 2 | did -o afpd 55 1 9 | %pro.s.cht.max = 2 | %pro.s.cht.sec = 9
n172=    %pro.c.txt = ! | did -c afpd 7 | did -o afpd 8 1 3 | did -o afpd 9 1 2 | %pro.c.txt.max = 3 | %pro.c.txt.sec = 2
n173=    %pro.c.act = ! | did -c afpd 11 | did -o afpd 12 1 3 | did -o afpd 13 1 2 | %pro.c.act.max = 3 | %pro.c.act.sec = 2
n174=    %pro.c.not = ! | did -c afpd 15 | did -o afpd 16 1 3 | did -o afpd 17 1 2 | %pro.c.not.max = 3 | %pro.c.not.sec = 2
n175=    %pro.c.ctc = ! | did -c afpd 19 | did -o afpd 20 1 2 | did -o afpd 21 1 5 | %pro.c.ctc.max = 2 | %pro.c.ctc.sec = 5
n176=    %pro.c.nik = ! | did -c afpd 23 | did -o afpd 24 1 2 | did -o afpd 25 1 5 | %pro.c.nik.max = 2 | %pro.c.nik.sec = 5
n177=    %pro.c.j-p = ! | did -c afpd 27 | did -o afpd 28 1 1 | did -o afpd 29 1 5 | %pro.c.j-p.max = 1 | %pro.c.j-p.sec = 5
n178=    %pro.c.kik = ! | unset %pro.c.k-b | did -c afpd 32 | did -u afpd 31 | %pro.c.kck.msg = Flood control kick (AFP v2.0) | did -o afpd 34 1 %pro.c.kck.msg
n179=    did -e afpd 8,9,12,13,16,17,20,21,24,25,28,29,38,39,42,43,46,47,50,51,54,55 | %pro.a.len = 300 | did -o afpd 68 1 300 | did -b afpd 1,2
n180=    %pro.s.ign.tmp = ! | %pro.s.ign.min = 5 | %pro.s.ign.sec = 300 | did -c afpd 57 | did -u afpd 58 | did -n afpd 60 | did -o afpd 60 1 %pro.s.ign.min
n181=    %pro.s.i-b.typ = 3 | did -c afpd 63 %pro.s.i-b.typ | %pro.s.i-b.sel = $gettok($did(63,%pro.s.i-b.typ),2,32) | %pro.s.i-b.typ2 = %pro.s.i-b.typ - 1
n182=  }
n183=  if ($did = 3) unset %afp_hlp
n184=  if ($did = 7) { if (%pro.c.txt = !) { did -e afpd 2 | unset %pro.c.txt | did -u afpd 7 | did -b afpd 8,9 } | else { %pro.c.txt = ! | did -c afpd 7 | did -e afpd 8,9 } }
n185=  if ($did = 11) { if (%pro.c.act = !) { did -e afpd 2 | unset %pro.c.act | did -u afpd 11 | did -b afpd 12,13 } | else { %pro.c.act = ! | did -c afpd 11 | did -e afpd 12,13 } }
n186=  if ($did = 15) { if (%pro.c.not = !) { did -e afpd 2 | unset %pro.c.not | did -u afpd 15 | did -b afpd 16,17 } | else { %pro.c.not = ! | did -c afpd 15 | did -e afpd 16,17 } }
n187=  if ($did = 19) { if (%pro.c.ctc = !) { did -e afpd 2 | unset %pro.c.ctc | did -u afpd 19 | did -b afpd 20,21 } | else { %pro.c.ctc = ! | did -c afpd 19 | did -e afpd 20,21 } }
n188=  if ($did = 23) { if (%pro.c.nik = !) { did -e afpd 2 | unset %pro.c.nik | did -u afpd 23 | did -b afpd 24,25 } | else { %pro.c.nik = ! | did -c afpd 23 | did -e afpd 24,25 } }
n189=  if ($did = 27) { if (%pro.c.j-p = !) { did -e afpd 2 | unset %pro.c.j-p | did -u afpd 27 | did -b afpd 28,29 } | else { %pro.c.j-p = ! | did -c afpd 27 | did -e afpd 28,29 } }
n190=  if ($did = 31) { %pro.c.k-b = ! | unset %pro.c.kik | did -c afpd 31 | did -u afpd 32 | did -e afpd 2 }
n191=  if ($did = 32) { %pro.c.kik = ! | unset %pro.c.k-b | did -c afpd 32 | did -u afpd 31 | did -e afpd 2 }
n192=  if ($did = 35) { did -r afpd 8,9,12,13,16,17,20,21,24,25,28,29,34,38,39,42,43,46,47,50,51,54,55,60,68 | did -e afpd 2 }
n193=  if ($did = 37) { if (%pro.s.n-m = !) { did -e afpd 2 | unset %pro.s.n-m | did -u afpd 37 | did -b afpd 38,39 } | else { %pro.s.n-m = ! | did -c afpd 37 | did -e afpd 38,39 } }
n194=  if ($did = 41) { if (%pro.s.ctc = !) { did -e afpd 2 | unset %pro.s.ctc | did -u afpd 41 | did -b afpd 42,43 } | else { %pro.s.ctc = ! | did -c afpd 41 | did -e afpd 42,43 } }
n195=  if ($did = 45) { if (%pro.s.inv = !) { did -e afpd 2 | unset %pro.s.inv | did -u afpd 45 | did -b afpd 46,47 } | else { %pro.s.inv = ! | did -c afpd 45 | did -e afpd 46,47 } }
n196=  if ($did = 49) { if (%pro.s.snd = !) { did -e afpd 2 | unset %pro.s.snd | did -u afpd 49 | did -b afpd 50,51 } | else { %pro.s.snd = ! | did -c afpd 49 | did -e afpd 50,51 } }
n197=  if ($did = 53) { if (%pro.s.cht = !) { did -e afpd 2 | unset %pro.s.cht | did -u afpd 53 | did -b afpd 54,55 } | else { %pro.s.cht = ! | did -c afpd 53 | did -e afpd 54,55 } }
n198=  if ($did = 57) { %pro.s.ign.tmp = ! | did -c afpd 57 | did -u afpd 58 | did -n afpd 60 | did -e afpd 2 | unset %pro.s.ign.prm }
n199=  if ($did = 58) { %pro.s.ign.prm = ! | did -u afpd 57 | did -c afpd 58 | did -m afpd 60 | did -e afpd 2 | unset %pro.s.ign.tmp }
n200=  if ($did = 63) { did -e afpd 1,2 }
n201=  if ($did = 65) {
n202=    did -c afpd 7,11,15,19,23,27,37,41,45,49,53 | did -e afpd 8,9,12,13,16,17,20,21,24,25,28,29,38,39,42,43,46,47,50,51,54,55
n203=    %pro.s.n-m = ! | %pro.s.ctc = ! | %pro.s.inv = ! | %pro.s.snd = ! | %pro.s.cht = ! | %pro.c.txt = ! | %pro.c.act = ! | %pro.c.not = ! | %pro.c.ctc = ! | %pro.c.nik = ! | %pro.c.j-p = !
n204=  }
n205=  if ($did = 66) {
n206=    did -u afpd 7,11,15,19,23,27,37,41,45,49,53 | did -b afpd 8,9,12,13,16,17,20,21,24,25,28,29,38,39,42,43,46,47,50,51,54,55 | did -e afpd 2
n207=    unset %pro.s.n-m %pro.s.ctc %pro.s.inv %pro.s.snd %pro.s.cht %pro.c.txt %pro.c.act %pro.c.not %pro.c.ctc %pro.c.nik %pro.c.j-p
n208=  }
n209=  if ($did = 70) { did -h afpd 72 | did -v afpd 1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,66,67,68 }
n210=  if ($did = 71) {
n211=    did -h afpd 1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,66,67,68
n212=    did -r afpd 72 | did -v afpd 72
n213=    if ($exists(scripts/AFP-HLP.TXT) == $true) loadbuf  -o afpd 72 scripts/AFP-HLP.TXT
n214=    else { did -a afpd 72 Missing afp_hlp.txt. $+ $crlf | did -a afpd 72 Make sure this file is located in: $scriptdir }
n215=
n216=
n217=  }
n218=}
n219=alias -l checkeditb {
n220=  if (%pro.s.n-m.max = $null) || (%pro.s.n-m.sec = $null) unset %pro.s.n-m
n221=  if (%pro.s.ctc.max = $null) || (%pro.s.ctc.sec = $null) unset %pro.s.ctc
n222=  if (%pro.s.inv.max = $null) || (%pro.s.inv.sec = $null) unset %pro.s.inv
n223=  if (%pro.s.snd.max = $null) || (%pro.s.snd.sec = $null) unset %pro.s.snd
n224=  if (%pro.s.cht.max = $null) || (%pro.s.cht.sec = $null) unset %pro.s.cht
n225=  if (%pro.c.txt.max = $null) || (%pro.c.txt.sec = $null) unset %pro.c.txt
n226=  if (%pro.c.act.max = $null) || (%pro.c.act.sec = $null) unset %pro.c.act
n227=  if (%pro.c.not.max = $null) || (%pro.c.not.sec = $null) unset %pro.c.not
n228=  if (%pro.c.ctc.max = $null) || (%pro.c.ctc.sec = $null) unset %pro.c.ctc
n229=  if (%pro.c.nik.max = $null) || (%pro.c.nik.sec = $null) unset %pro.c.nik
n230=  if (%pro.c.j-p.max = $null) || (%pro.c.j-p.sec = $null) unset %pro.c.j-p
n231=}
