[script]
n0=on ^*:text:*:#: {
n1=  if (%censor == on) {
n2=    var %censor.chan.string $replace($strip($1-),А,а,Б,б,В,в,Г,г,Д,д,Е,е,Ё,ё,Ж,ж,З,з,И,и,Й,й,К,к,Л,л,М,м,Н,н,О,о,П,п,Р,р,С,с,Т,т,У,у,Ф,ф,Х,х,Ц,ц,Ч,ч,Ш,ш,Щ,щ,Ь,ь,Ъ,ъ,Ы,ы,Э,э,Ю,ю,Я,я) 
n3=    if (%censor.chan.all) goto nac
n4=    var %cf 0
n5=    while (%cf < %censor.chan.count) {
n6=      inc %cf
n7=      if (# == %censor.chan. [ $+ [ %cf ] ]) {
n8=        :nac
n9=        var %cf 0
n10=        :2
n11=        if (%replace.mat.string) var %censor.chan.string %replace.mat.string
n12=        while (%cf < $lines(sys\mat.txt)) {
n13=          inc %cf
n14=          if ($read(sys\mat.txt,%cf) isin %censor.chan.string) {
n15=            set %is.mat 1
n16=            var %cex 0
n17=            while (%cex < $lines(sys\not_mat.txt)) {
n18=              inc %cex
n19=              if ($read(sys\not_mat.txt,%cex) isin %censor.chan.string) { set %is.mat 0 | goto 2 }
n20=            }
n21=            if (%replace.mat) {
n22=              set %replace.mat.string $replace(%censor.chan.string,$read(sys\mat.txt,%cf),%replace.mat.text)
n23=              goto 2
n24=            }
n25=          }
n26=        }
n27=      }
n28=    }
n29=  }
n30=  if (%replace.mat.string) {
n31=    if (%sound == on) splay $shortfn($mircdir $+ sys\sounds\mat.wav)
n32=    echo $color(normal) -t # < $+ $nick $+ > %replace.mat.string
n33=    echo 2 -t * # < $+ $nick $+ > $1-
n34=    unset %replace.mat.string
n35=    haltdef
n36=  }
n37=  if (%is.mat) {
n38=    if (%sound == on) splay $shortfn($mircdir $+ sounds\mat.wav)
n39=    if ($me isop #) {
n40=      if (%censor.mode == 1) {
n41=        if ($window(@Цензура) == $null) {
n42=          window -lb @Цензура
n43=          aline @Цензура * Двойной клик на строке - меню действий
n44=        }
n45=        aline @Цензура $time $nick на $chan сказал: $1-
n46=        window -bk @Цензура
n47=      }
n48=      if (%censor.mode == 2) { censor.punish # $nick }
n49=    }
n50=  }
n51=  unset %is.mat
n52=}
n53=on ^*:action:*:#: {
n54=  if (%censor == on) {
n55=    var %censor.chan.string $replace($strip($1-),А,а,Б,б,В,в,Г,г,Д,д,Е,е,Ё,ё,Ж,ж,З,з,И,и,Й,й,К,к,Л,л,М,м,Н,н,О,о,П,п,Р,р,С,с,Т,т,У,у,Ф,ф,Х,х,Ц,ц,Ч,ч,Ш,ш,Щ,щ,Ь,ь,Ъ,ъ,Ы,ы,Э,э,Ю,ю,Я,я) 
n56=    if (%censor.chan.all) goto nac
n57=    var %cf 0
n58=    while (%cf < %censor.chan.count) {
n59=      inc %cf
n60=      if (# == %censor.chan. [ $+ [ %cf ] ]) {
n61=        :nac
n62=        var %cf 0
n63=        :2
n64=        if (%replace.mat.string) var %censor.chan.string %replace.mat.string
n65=        while (%cf < $lines(sys\mat.txt)) {
n66=          inc %cf
n67=          if ($read(sys\mat.txt,%cf) isin %censor.chan.string) {
n68=            set %is.mat 1
n69=            var %cex 0
n70=            while (%cex < $lines(sys\not_mat.txt)) {
n71=              inc %cex
n72=              if ($read(sys\not_mat.txt,%cex) isin %censor.chan.string) { set %is.mat 0 | goto 2 }
n73=
n74=            }
n75=            if (%replace.mat) {
n76=              set %replace.mat.string $replace(%censor.chan.string,$read(sys\mat.txt,%cf),%replace.mat.text)
n77=              goto 2
n78=            }
n79=          }
n80=        }
n81=      }
n82=    }
n83=  }
n84=  if (%replace.mat.string) {
n85=    if (%sound == on) splay $shortfn($mircdir $+ sys\sounds\mat.wav)
n86=    echo $color(normal) -t # < $+ $nick $+ > %replace.mat.string
n87=    echo 2 -t * # < $+ $nick $+ > $1-
n88=    unset %replace.mat.string
n89=    haltdef
n90=  }
n91=  if (%is.mat) {
n92=    if (%sound == on) splay $shortfn($mircdir $+ sys\sounds\mat.wav)
n93=    if ($me isop #) {
n94=      if (%censor.mode == 1) {
n95=        if ($window(@Цензура) == $null) {
n96=          window -lb @Цензура
n97=          aline @Цензура * Двойной клик на строке - меню действий
n98=        }
n99=        aline @Цензура $time $nick на $chan сказал: $1-
n100=        window -bk @Цензура
n101=      }
n102=      if (%censor.mode == 2) {
n103=        echo 2 -t * $nick на # сказал: $1-
n104=        censor.punish # $nick
n105=      }
n106=    }
n107=  }
n108=  unset %is.mat
n109=}
n110=on ^*:text:*:?: {
n111=  if (%replace.mat) {
n112=    var %censor.query.string $replace($strip($1-),А,а,Б,б,В,в,Г,г,Д,д,Е,е,Ё,ё,Ж,ж,З,з,И,и,Й,й,К,к,Л,л,М,м,Н,н,О,о,П,п,Р,р,С,с,Т,т,У,у,Ф,ф,Х,х,Ц,ц,Ч,ч,Ш,ш,Щ,щ,Ь,ь,Ъ,ъ,Ы,ы,Э,э,Ю,ю,Я,я) 
n113=    var %cf 0
n114=    :2
n115=    if (%replace.mat.string) var %censor.query.string %replace.mat.string
n116=    while (%cf < $lines(sys\mat.txt)) {
n117=      inc %cf
n118=      if ($read(sys\mat.txt,%cf) isin %censor.query.string) {
n119=        var %cex 0
n120=        while (%cex < $lines(sys\not_mat.txt)) {
n121=          inc %cex
n122=          if ($read(sys\not_mat.txt,%cex) isin %censor.query.string) { set %is.mat 0 | goto 2 }
n123=        }
n124=        set %replace.mat.string $replace(%censor.query.string,$read(sys\mat.txt,%cf),%replace.mat.text)
n125=        goto 2
n126=      }
n127=    }
n128=  }
n129=  if (%replace.mat.string) {
n130=    if (%sound == on) splay $shortfn($mircdir $+ sys\sounds\mat.wav)
n131=    echo $color(normal) -t $nick < $+ $nick $+ > %replace.mat.string
n132=    echo 2 -t * < $+ $nick $+ > $1-
n133=    unset %replace.mat.string
n134=    haltdef
n135=  }
n136=}
n137=menu @Цензура { 
n138=  dclick: { 
n139=    if (!$line(@Цензура, 1).state) {
n140=      set %text $sline(@Цензура,1) 
n141=      censor 
n142=    }
n143=  } 
n144=}
n145=alias censor dialog -m censor censor
n146=dialog censor {
n147=  option dbu
n148=  title "Обнаружен мат"
n149=  size -1 -1 80 66
n150=  box "Что будем делать?", 1, 5 3 70 42
n151=  radio "кикнуть", 2, 10 22 30 10, right
n152=  radio "забанить", 3, 10 32 35 10, right
n153=  radio "предупредить", 4, 10 12 51 10, right
n154=  button "Do it!", 5, 5 50 34 11, ok
n155=  button "Отмена", 6, 41 50 34 11, cancel
n156=}
n157=on 1:DIALOG:censor:*:*:{
n158=  if ( $devent == sclick ) {
n159=    if ($did == 5) {
n160=      if ($did($dname,4).state) .msg $gettok(%text,2,32) $replace(%censor.msg, chan, $gettok(%text,4,32))
n161=      if ($did($dname,2).state) kick $gettok(%text,4,32) $gettok(%text,2,32) $replace(%censor.msg, chan, $gettok(%text,4,32))
n162=      if ($did($dname,3).state) { ban -u600 $gettok(%text,4,32) $gettok(%text,2,32) %sel.n.banmask | kick $gettok(%text,4,32) $gettok(%text,2,32) $replace(%censor.msg, chan, $gettok(%text,4,32)) Отдохни 10 минут... }
n163=    }
n164=  }
n165=  if ($devent == init ) {
n166=    did -c $dname 2 
n167=  }
n168=}
n169=alias censor.punish {
n170=  if (%censor.punishment == 1) {
n171=    var %wc 0
n172=    while (%wc < %censor.warn.cnt) {
n173=      inc %wc
n174=      if ($2 == %censor.warn. [ $+ [ %wc ] ]) {
n175=        echo 2 -t * $2 кикнут и забанен на 10 минут за сквернословие на канале $1
n176=        ban -u600 $1 $2 %sel.n.banmask
n177=        kick $1 $2 $replace(%censor.msg, chan, $1) Отдохни 10 минут...
n178=        unset %censor.warn. [ $+ [ %wc ] ]
n179=        var %nn 0
n180=        var %nnn 1
n181=        while (%nn < %censor.warn.cnt) {
n182=          inc %nn
n183=          if (%censor.warn. [ $+ [ %nn ] ]) { 
n184=            if (%censor.warn. [ $+ [ %nnn ] ] != %censor.warn. [ $+ [ %nn ] ]) {
n185=              set %censor.warn. [ $+ [ %nnn ] ] %censor.warn. [ $+ [ %nn ] ] 
n186=              unset %censor.warn. [ $+ [ %nn ] ]
n187=            }
n188=            inc %nnn 
n189=          }
n190=        }
n191=        set %censor.warn.cnt %nnn - 1
n192=        halt
n193=      }
n194=    }
n195=    echo 2 -t * $2 предупрежден о последствиях сквернословия на канале $1
n196=    .msg $2 $replace(%censor.msg, chan, $1)
n197=    inc %censor.warn.cnt
n198=    set -u300 %censor.warn. [ $+ [ %censor.warn.cnt ] ] $2
n199=  }
n200=  if (%censor.punishment == 2) {
n201=    echo 2 -t * $2 кикнут за сквернословие на канале $1
n202=    kick $1 $2  $replace(%censor.msg, chan, $1)
n203=  }
n204=  if (%censor.punishment == 3) {
n205=    echo 2 -t * $2 кикнут и забанен на 10 минут за сквернословие на канале $1
n206=    ban -u600 $1 $2 %sel.n.banmask
n207=    kick $1 $2 $replace(%censor.msg, chan, $1) Отдохни 10 минут...
n208=  }
n209=  if (%censor.punishment == 4) {
n210=    echo 2 -t * $2 кикнут и забанен насовсем за сквернословие на канале $1
n211=    ban $1 $2 %sel.n.banmask
n212=    kick $1 $2 $replace(%censor.msg, chan, $1) Все прощай...
n213=  }
n214=}
