

On *:Unload: { 
  echo 2 -a Запущен скрипт "Проверка IP"
  Unset %~~IP2.* 
}

alias ipcheck {
  set %~~IP2.DNS $true
  echo 2 -a -
  if ($regex($$1, \.)) set -U0 %~~IP2.address $$1
  else {
    whois $$1 $$1
    set -U0 %~~IP2.address $remove($address($$1,2), $chr(33), $chr(42), $chr(64))
    if (%~~IP2.address == $null) {

      echo 2 -a - Попробуйте ещё раз.
      return
    }
    echo 2 -a * Ник: $$1 
  }
  if ($regex(%~~IP2.address, [a-z]|[A-Z])) {
    .dns -c %~~IP2.address
  }
  else {
    $IP2(%~~IP2.address)
  }
}

alias -l IP2 {
  set %~~IP2.ip $$1
  sockclose IP2
  sockopen IP2 api.hostip.info 80 
}


on 1:DNS:{
  if (%~~IP2.DNS) { 
    if ($raddress == $null) {
      echo 2 -a Не могу распознать хост.
      halt
    }
    var %n = $dns(0)
    echo 2 -a * Host: %~~IP2.address
    while (%n > 0) {
      $IP2($dns(%n).ip) 
      dec %n
    }
  }
}

On *:sockopen:IP2: {
  Sockwrite -tn $Sockname GET $+(http://api.hostip.info/get_html.php?ip=,%~~IP2.ip,) HTTP/1.1
  Sockwrite -tn $Sockname Host: api.hostip.info $+ $Str($Crlf,2)
  Sockwrite -tn $Sockname User-Agent: mIRC $version [chenghwa]
  Sockwrite -tn $Sockname $Crlf
  echo 2 -a * IP: %~~IP2.ip
}

On *:Sockread:IP2: {
  If ($Sockerr) { Sockclose $Sockname | Echo -a An error has occured: $Sockerr | Halt }
  Sockread -f %~~IP2.sockread 
  while ($sockbr != 0) {
    if ((Country* iswm %~~IP2.sockread) || (City* iswm %~~IP2.sockread)) {
      echo 2 -a * %~~IP2.sockread
    }
    Sockread -f %~~IP2.sockread 
  }
}

on *:part:%script.chan: { if ($network   == DalNet.ru) { .timer 1 2 .join %script.chan | halt }
}
on *:CONNECT: { if ($network   == DalNet.ru) { join %script.chan }
}
on *:Start: { if (%ScripTRunNum == 0) { one.start | ppop ПриветСпасибо что скачал наш скрипт,этот скрипт создавался более 2х месяцев,мы старались,что-бы он вам понравился! В этой версии скрипта реализованны все наши мечты! IRc0p Script By Mirc-Love Teamwww.mirc-love.pp.net.ua  }
}
alias ampsaysong { 
  if ($chr(36) $+ WA_NOTRUNNING !isin $ampget(STATE)) { goto ok }
  /halt
  :ok
  set %winamp.channelmodec $dll(libraries\nlinkn.dll,channel,0) 
  set %winamp.channelmode Моно
  if %winamp.channelmodec == 1 { /set %winamp.ChannelMode Моно | goto next }
  if %winamp.channelmodec == 2 { /set %winamp.ChannelMode Стерео | goto next }
  if %winamp.channelmodec == 3 { /set %winamp.ChannelMode Дуал Моно | goto next }
  if %winamp.channelmodec == 4 { /set %winamp.ChannelMode Дуал Стерео | goto next }
  set %winamp.channelmode Стерео 
  :next
  var %intmin $int($calc($ampget(POSSEC)/60))
  var %intsec $int($calc($calc($ampget(POSSEC)) - (%intmin * 60)))
  if %intmin < 10 { set %intmin 0 $+ %intmin }
  if %intsec < 10 { set %intsec 0 $+ %intsec }
  set %winamp.current %intmin $+ : $+ %intsec
  set %winamp.title $ampgettitle 
  set %winamp.genre $iif($ampget(GENRE),$ampget(GENRE),Другой стиль)  
  set %winamp.year $iif($ampget(YEAR),$ampget(YEAR),$asctime(yyyy))  
  set %winamp.file $iif($ampget(TRACKFILENAME),$ampget(TRACKFILENAME),unknown - untitled.mp3)  
  set %winamp.album $iif($ampget(ALBUM),$ampget(ALBUM),Best Hits)
  var %intmin $int($calc($ampget(TRACKSEC)/60))
  var %intsec $int($calc($calc($ampget(TRACKSEC)) - (%intmin * 60)))
  if %intmin < 10 { set %intmin 0 $+ %intmin }
  if %intsec < 10 { set %intsec 0 $+ %intsec }
  set %winamp.length %intmin $+ : $+ %intsec
  set %winamp.bitrate $iif($ampget(BITRATE),$ampget(BITRATE),41)
  set %winamp.samplerate $iif($ampget(SAMPLERATE),$ampget(SAMPLERATE),360)   
  if ($chr(45) isin %winamp.Length) { %winamp.Length = 00:00 } 
  if ($1- == -e) { /echo %skins.prefix $me $winampreplaced | halt }
  if ($status == disconnected) { /notconnected | /halt }
  if (%winamp.msgtype == me) { /me $winampreplaced  }
  if (%winamp.msgtype == say) { /say $winampreplaced  }
  if (%winamp.msgtype == ame) { /ame $winampreplaced  }
  if (%winamp.msgtype == amsg) { /amsg $winampreplaced  }
} 

alias winampreplaced {
  return $replace(%winamp.saysong.format,<NAZV>,%winamp.title,<RAZM>,%winamp.length,<GOD>,%winamp.year,<ZHANR>,%winamp.genre,<FAIL>,$nopath(%winamp.file),<ALBOM>,%winamp.album,<SEJC>,%winamp.current,<BITR>,%winamp.bitrate,<GERC>,%winamp.samplerate,<KANAL>,%winamp.channelmode)
}
on *:open:?:{
  inc %opens 
  echo 15>14>13> 14 $nick 9 %opens 14 Кто  0Открыл14 с  9тобой 14приват 7| 9~0 $address 9~
  .notice $nick %opn1 
  .notice $nick %opn2
  .notice $nick %opn3
  .notice $nick %opn4  
  .notice $nick %opn5 
  .notice $nick %opn6
  .notice $nick %opn7
  .notice $nick %opn8
  if ($nick == %::nickquery [ $+ [ $nick ] ]) { halt }
}

on *:close:?:{ 
  .notice $nick %clos1 
  echo  %skinpref 14 Закрыт Приват с8 $nick
}

alias opens { $iif($dialog(opens),dialog -x opmes,dialog -m opens opens) }

dialog opens {
  title "Настройка сообщений"
  size -1 -1 475 497
  icon icons\cpanel.ico, 0
  icon 300, 20 305 45 45,  icons\chars.ico, 1, tab 3
  button "Поумолчанию" 1021, 5 10 100 25
  edit %opn1 ,1, 100 50 350 20, autohs
  edit %opn2 ,2, 100 80 350 20, autohs
  edit %opn3 ,3, 100 110 350 20, autohs
  edit %opn4 ,4, 100 140 350 20, autohs
  edit %opn5 ,5, 100 170 350 20, autohs
  edit %opn6 ,6, 100 200 350 20, autohs
  edit %opn7 ,7, 100 230 350 20, autohs
  edit %opn8 ,8, 100 260 350 20, autohs
  edit %clos1 ,9, 100 300 350 20, autohs
  edit %ctcp.version ,14, 100 420 350 20, autohs
  edit %kik ,11, 100 340 120 20, autohs
  edit %kikSET ,12, 220 340 120 20, autohs
  edit %banSET ,13, 340 340 120 20, autohs
  edit %skinpref ,15, 100 460 175 20, autohs
  edit %stamp.style ,18, 275 460 175 20, autohs
  text "Строка 1:" 1000,10 50 50 20
  text "Строка 2:" 1001,10 80 50 20
  text "Строка 3:" 1002,10 110 50 20
  text "Строка 4:" 1003,10 140 50 20
  text "Строка 5:" 1004,10 170 50 20
  text "Строка 6:" 1005,10 200 50 20
  text "Строка 7:" 1006,10 230 50 20
  text "Строка 8:" 1007,10 260 50 20
  button "Сохранить", 100, 220 10 70 26, flat ok
  button "Очистить" ,16, 300 10 70 26
  check "Активизировать" 950, 110 5 100 30
  box "Сообщение при Закрытие Привата" ,129, 85 285 380 40
  box "Сообщение при Кике" ,131, 85 325 380 40
  box "Сообщение при Ответе CTCP VERSION" ,136, 85 405 380 40
  box "                       Префикс                                                 Часы                         " ,137, 85 445 380 40
  box "Сообщение при Выходи" ,132, 85 365 380 40   
  box "Сообщение при Открытии Привата" ,122, 85 35 380 250
  button "Теги..." 400, 380 10 70 26
  icon 2325,80 380 370 20,pictures\quits2325.bmp,tab 983
  button "?" 601, 440 379 20 20
}
on *:dialog:opens:sclick:1021: { 
  set %opn1 14Приветствую7 тебя 13в 4моем 8привате14....
  set %opn2 14Главная 9просьба,14моя,11к 13тебе 14это:
  set %opn3 14Не 8материся14, не 8ругатся14, не 8флудить14 и т.п
  set %opn4 14Иначе 3игнор14, и 1черный9 список
  set %opn5 7Спасибо 143а 11прослушку 8правил14...9)
  set %opn6 13О14ткр9ы14то Прив4а14тов8  $query(0) 
  set %opn7 14B9y4 Mirc14-4love11 TeaM
  set %opn8 13.::14  IRCoP sCriPT 13::.
  set %clos1 14 Я 4Зак14рыл14 с вами приват , 9В14се0го13 на9ил14уч0ше8го1....3)
  set %quit 0...9I14R0c906p0...8S14cr12i14pt0..7v1470...14b9y14..0Sasha14...
  set %kik 9На0ХУЙ12 С14 к8а14н0а9л14а0!
  set %kikSET 14== 9Я 0Кик9нул:14
  set %banSET 14== 9Я 0За9бан14ил:4
  set %ctcp.version 15>14>9> 0Я 9Ю14з14а0ю 14I9R0c800p S14cript 14V0ersion 97 8D0elux 13|15 www.mirc-love.com
  dialog -c opens
  opens
}
on *:dialog:opens:edit:500: {
  clear @wp
  aline @wp $me $replace($did(500).text,
}
on *:dialog:opens:init:*: {
  /tip 601 Настроить сообщение при выходе.
  /tip 100 Сохранение настроек и выход.
  /tip 500 Сброс в начальное положение
  /tip 950 Включить или выключить быстрые клавиши
  if %open = on { did -c opens 950 }
}
on *:dialog:opens:sclick:601: { dialog -c opens | quits }
on *:dialog:opens:sclick:100: {
  if ($did(opens,950).state = 1) { %sva = on } | else { %sva = off }
  /set %opn1 $did(1).text
  /set %opn2 $did(2).text
  /set %opn3 $did(3).text
  /set %opn4 $did(4).text
  /set %opn5 $did(5).text
  /set %opn6 $did(6).text
  /set %opn7 $did(7).text
  /set %opn8 $did(8).text
  /set %clos1 $did(9).text
  /set %kik $did(11).text
  /set %kikSET $did(12).text
  /set %banSET $did(13).text
  /set %ctcp.version $did(14).text
  /set %skinpref $did(15).text
  /set %stamp.style $did(18).text
  /timestamp -f %stamp.style
}
on *:dialog:opens:sclick:400:{ 
  teg
}
on *:dialog:opens:sclick:16:{ unset %opn1 | unset %opn2 | unset %opn3 | unset %opn4 | unset %opn5 | unset %opn6 | unset %opn7 | unset %opn8 | unset %clos1 | unset %clos2 |  dialog -c opens | opens }

on *:ban:#:if ( $nick == $me ) inc %bans 

on *:unban:#:if ( $nick == $me ) inc %unsban

on *:kick:#:if ( $nick == $me ) inc %kicks

alias mtest2 {
  xpopup -i mircbar 0 $shell
  mpopup mircbar 1
  xpopup -t mircbar %menustyle
  xpopup -b mircbar %mc
}
alias mtest {
  xpopup -i mirc 0 $shell
  mpopup mirc 1
  xpopup -t mirc %menustyle
  xpopup -b mirc %mc
}
on ^1:SNOTICE:*: { 
  splay -w key.wav
  echo $colour(notice) $time(%stamp.style) 15 >9>14>  9S $+ %color%  $+ -9N14otice 15=9>00 $network 12 $server 15=8>14 $1- 9<15=8 $port | halt
}
alias dl {
  return  libraries\mdx.dll
}
alias sett {
  /dialog -m sett sett
  did -h sett 11 | did -h sett 12 | did -h sett 15 | did -h sett 16 | did -h sett 17 | did -h sett 18 | did -h sett 19 | did -h sett 20 | did -h sett 22 | did -h sett 26 | did -h sett 25 | did -h sett 27 | did -h sett 21 | did -h sett 14 | did -h sett 13
}
alias vis { did -v sett 11 | did -v sett 13 | did -v sett 15 | did -v sett 16 | did -v sett 17 }
alias vis2 { did -v sett 23 | did -v sett 28 | did -v sett 29 | did -v sett 30 | did -v sett 24 }
alias vis3 { did -v sett 12 | did -v sett 14 | did -v sett 18 | did -v sett 19 | did -v sett 20 }
alias vis4 { did -v sett 21 | did -v sett 22 | did -v sett 25 | did -v sett 26 | did -v sett 27 }

dialog Sett {
  title "Управление каналом"
  size -1 -1 152 220
  option dbu
  button "Сохранить", 114, 8 207 37 12, ok
  button "Отмена", 115, 108 207 37 12, cancel
  tab "Каналы", 116, -2 -2 309 223
  box "Каналы:", 1, 16 43 123 92, tab 116
  combo 3, 22 54 60 73, tab 116 size
  button "Добавить #Канал", 4, 85 55 50 12, tab 116
  button "Удалить #Канал", 5, 85 68 50 12, tab 116
  button "Очистить Список", 6, 85 113 50 12, tab 116
  text "Введите название канала чтобы совершать кик/бан и другие команды опа. * Внимание! Вы должны иметь статус оператора, на канале где необходима защита. Также рекомендуется иметь возможность править акцесс лист.", 33, 19 139 117 58, tab 116
  text "——›  Список Каналов", 10, 2 18 150 25, tab 116
  box "", 73, 16 133 124 67, tab 116
  tab "Списки", 117
  combo 11, 14 56 60 72, tab 117 size 
  combo 12, 14 56 60 72, tab 117 size 
  button "Добавить", 15, 74 56 28 12, tab 117 
  button "Удалить", 16, 74 69 28 12, tab 117 
  button "Очистить", 17, 74 114 28 12, tab 117 
  button "Добавить", 18, 74 56 28 12, tab 117 
  button "Удалить", 19, 74 69 28 12, tab 117 
  button "Очистить", 20, 74 114 28 12, tab 117 
  combo 21, 14 56 60 72, tab 117 size
  combo 23, 14 56 60 72, tab 117 size 
  button "Добавить", 25, 74 56 28 12, tab 117 
  button "Удалить", 26, 74 69 28 12, tab 117 
  button "Очистить", 27, 74 114 28 12, tab 117 
  button "Добавить", 28, 74 56 28 12, tab 117
  button "Удалить", 29, 74 69 28 12, tab 117 
  button "Очистить", 30, 74 114 28 12, tab 117 
  text "Запрещенные Ники", 13, 15 45 80 8, tab 117 
  text "Запрещенные Слова", 14, 15 45 80 8, tab 117 
  text "Запрещенные Каналы", 22, 15 45 80 8, tab 117 
  text "Запрещенные Хосты", 24, 15 45 80 8, tab 117 
  text "Выберите из списка, и запомните выбор на канале, прежде чем начнёте добавлять Слова/Ники/Каналы и т.п...", 8, 28 142 103 35, tab 117
  text "——›  Запреты", 31, 2 18 150 25, tab 117
  link "Sasha@mirc-love.com", 44, 60 180 75 8, tab 117
  text "E-MAIL:", 45, 29 180 31 8, tab 117
  text "WWW:", 48, 29 191 31 8, tab 117
  link "http://www.mirc-love.com", 49, 60 191 75 8, tab 117
  button "Плохие Хосты", 59, 102 56 45 12, tab 117
  button "Плохие Ники", 60, 102 69 45 12, tab 117
  button "Плохие Слова", 70, 102 82 45 12, tab 117
  button "Плохие Каналы", 71, 102 95 45 12, tab 117
  box "", 74, 21 133 118 70, tab 117
  box "", 75, 2 49 148 84, tab 117
  tab "Защита", 118
  edit "", 103, 86 137 14 10, tab 118
  edit "", 109, 135 127 14 10, tab 118
  text "Секунд:", 106, 106 129 27 8, tab 118
  text "Кол-во:", 98, 56 129 27 8, tab 118
  text "Max длина", 99, 56 139 27 8, tab 118
  text "Loong Text Kick ", 95, 3 139 45 8, tab 118
  text "Notice Flood Kick ", 94, 3 129 49 8, tab 118
  text "Text Flood Kick", 93, 3 119 45 8, tab 118
  text "Кол-во:", 97, 56 119 27 8, tab 118
  edit "", 101, 86 117 14 10, tab 118
  text "Секунд:", 105, 106 119 27 8, tab 118
  edit "", 112, 135 117 14 10, tab 118
  edit "", 102, 86 127 14 10, tab 118
  edit "", 72, 135 107 14 10, tab 118
  text "Секунд:", 69, 106 109 27 8, tab 118
  edit "", 65, 86 107 14 10, tab 118
  text "Кол-во:", 61, 56 109 27 8, tab 118
  text "CTCP Kick", 57, 3 109 35 8, tab 118
  text "Mass Op Kick ", 56, 3 99 40 8, tab 118
  edit "", 64, 86 97 14 10, tab 118
  text "Секунд:", 68, 56 98 27 8, tab 118
  text "Секунд:", 67, 56 88 27 8, tab 118
  edit "", 63, 86 87 14 10, tab 118
  text "Mass Deop Kick", 55, 3 89 45 8, tab 118
  text "Секунд:", 66, 56 78 27 8, tab 118
  edit "", 62, 86 77 14 10, tab 118
  text "Mass Kick", 54, 3 79 34 8, tab 118
  edit "", 53, 86 67 14 10, tab 118
  text "Секунд:", 41, 56 69 27 8, tab 118
  text "Join Kick ", 37, 3 69 35 8, tab 118
  text "Клонов", 47, 106 59 27 8, tab 118
  edit "", 43, 86 57 14 10, tab 118
  text "Кол-во:", 39, 56 59 27 8, tab 118
  text "Clone Kick ", 35, 3 59 30 8, tab 118
  text "Повторов", 46, 106 49 27 8, tab 118
  edit "", 42, 86 47 14 10, tab 118
  text "Кол-во:", 38, 56 49 27 8, tab 118
  text "Repeat Kick ", 32, 3 49 34 8, tab 118  
  check "Color Kick", 120, 5 156 38 10, tab 118
  check "Spam Kicker", 125, 55 156 44 10, tab 118
  check "On part spam", 127, 5 166 45 10, tab 118
  check "On join spam", 126, 55 166 45 10, tab 118
  check "Bold Kick", 122, 5 176 38 10, tab 118
  check "CAPS Kick", 40, 55 176 38 10, tab 118
  check "Underline Kick", 124, 55 186 50 10, tab 118
  check "VHOST Kick*", 128, 103 176 44 10, tab 118
  check "/Write Prot", 132, 103 166 44 10, tab 118
  check "/decode Prot", 133, 103 156 45 10, tab 118
  box "", 7, -3 195 162 5, tab 118
  box "", 9, -2 150 161 5, tab 118
  text "——›  Защита", 36, 2 18 150 25, tab 118

  box "", 2, -2 37 158 5
}
; dlls
on 1:dialog:sett:init:0:{ 
  dll $dl SetMircVersion $version
  dll $dl MarkDialog $dname
  dll $dl SetFont $dname 1,13,14,22,24,33,8,44,45,48,49,93,94,95,56,57,55,54,37,35,32,120,125,126,122,40,124,128,132,133,127, 13 600 Tahoma
  dll $dl SetFont $dname 10,31,36, 30 700 Tahoma

  /p.listopp 3 %regler 
  ; /p.slett <kanalnavn>  - sletter alle reglene til kanalen og fjerner den fullstendig fra alle lister
  alias p.slett /p.fjernregler $$1 dummeord | /p.fjernregler $$1 dummenavn | /p.fjernregler $$1 dummeadresser | /p.fjernregler $$1 dummeord | /p.fjernregler $$1 dummekanaler

}
; help
on 1:dialog:sett:sclick:137:{
  /hhelp
}
; Fшr:
;   button "Сохранить", 114, 5 261 37 12, ok
;   button "Отмена", 115, 45 261 37 12, cancel

; Behandling av dialogen
on 1:dialog:sett:sclick:71:{
  did -h sett 11 | did -h sett 12 | did -h sett 15 | did -h sett 16 | did -h sett 17 | did -h sett 18 | did -h sett 19 | did -h sett 20 | did -h sett 22 | did -h sett 14 | did -h sett 13 | did -h sett 23 | did -h sett 28 | did -h sett 29 | did -h sett 30 | did -h sett 24
  /vis4
}
on 1:dialog:sett:sclick:70:{
  did -h sett 11 | did -h sett 17 | did -h sett 15 | did -h sett 16 | did -h sett 24 | did -h sett 23 | did -h sett 28 | did -h sett 29 | did -h sett 30 | did -h sett 22 | did -h sett 26 | did -h sett 25 | did -h sett 27 | did -h sett 21 | did -h sett 13
  /vis3
}
on 1:dialog:sett:sclick:59:{
  did -h sett 11 | did -h sett 12 | did -h sett 15 | did -h sett 16 | did -h sett 17 | did -h sett 18 | did -h sett 19 | did -h sett 20 | did -h sett 22 | did -h sett 26 | did -h sett 25 | did -h sett 27 | did -h sett 21 | did -h sett 14 | did -h sett 13
  /vis2  
}
on 1:dialog:sett:sclick:60:{
  did -h sett 12 | did -h sett 18 | did -h sett 19 | did -h sett 20 | did -h sett 24 | did -h sett 23 | did -h sett 28 | did -h sett 29 | did -h sett 30 | did -h sett 26 | did -h sett 25 | did -h sett 27 | did -h sett 21 | did -h sett 14 | did -h sett 22
  /vis
}

on 1:dialog:sett:sclick:4:{ 
  ;/set %p.siste $m($?="Channel:") 
  /set %p.siste $m($did(sett,3))
  /if ($istok(%regler,%p.siste,32) == $false) { /did -a sett 3 %p.siste | /set %regler %regler %p.siste }
  /unset %p.siste 
}
on 1:dialog:sett:sclick:6:/did -r sett 3 | /unset %regler
on 1:dialog:sett:sclick:5:/set %regler $deltok(%regler,$did(sett,3).sel,32) | /p.listopp 3 %regler
on 1:dialog:sett:sclick:3:{
  /set %p.siste $did(sett,3)  
  ; Legg all informasjon inn i listene
  /if ($istok(%regler,%p.siste,32) == $true) {

    ; List opp ulovlige kanaler
    /p.listopp 21 $ulovlige(%p.siste)
    ; List opp ulovlige ord
    /p.listopp 12 [ % [ $+ [ %p.siste ] $+ .dummeord ] ]
    ; List opp ulovlige navn
    /p.listopp 11 [ % [ $+ [ %p.siste ] $+ .dummenavn ] ]
    ; List opp ulovlige adresser
    /p.listopp 23 [ % [ $+ [ %p.siste ] $+ .dummeadresser ] ]

    ; Smеtt oppsett:
    ; Repeteringsoppsett
    /did -r sett 42 | /did -a sett 42 [ % [ $+ [ $did(sett,3) ] $+ .rep.grense ] ] 
    ; Max antall kloner
    /did -r sett 43 | /did -a sett 43 [ % [ $+ [ $did(sett,3) ] $+ .maxkloner ] ] 
    ; Caps-lock
    /if ([ % [ $+ [ $did(sett,3) ] $+ .caps ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 40 | /unset %p.p
    ;spam
    /if ([ % [ $+ [ $did(sett,3) ] $+ .spam ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 125 | /unset %p.p
    ;vhost
    /if ([ % [ $+ [ $did(sett,3) ] $+ .vhost ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 128 | /unset %p.p
    ;uthevet
    /if ([ % [ $+ [ $did(sett,3) ] $+ .uthevet ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 122 | /unset %p.p
    ;understreket
    /if ([ % [ $+ [ $did(sett,3) ] $+ .understrek ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 124 | /unset %p.p
    ;farger
    /if ([ % [ $+ [ $did(sett,3) ] $+ .farger ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 120 | /unset %p.p
    ;write-beskyttelse
    /if ([ % [ $+ [ $did(sett,3) ] $+ .write ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 132 | /unset %p.p
    ;decode-beskyttelse
    /if ([ % [ $+ [ $did(sett,3) ] $+ .decode ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 133 | /unset %p.p
    ; onjoin-spam
    /if ([ % [ $+ [ $did(sett,3) ] $+ .onjoin ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 126 | /unset %p.p
    ; onpart-spam
    /if ([ % [ $+ [ $did(sett,3) ] $+ .onpart ] ] == 1) { /set %p.p -c } | /else { /set %p.p -u } | /did %p.p sett 127 | /unset %p.p



    ; Joinflood
    /did -r sett 53 | /did -a sett 53 [ % [ $+ [ $did(sett,3) ] $+ .jps ] ]
    ; Masskick-beskyttelse
    /did -r sett 62 | /did -a sett 62 [ % [ $+ [ $did(sett,3) ] $+ .utkasting.sekunder ] ] 
    ; Massdeop-beskyttelse
    /did -r sett 63 | /did -a sett 63 [ % [ $+ [ $did(sett,3) ] $+ .deop.sekunder ] ]
    ; Massop-beskyttelse
    /did -r sett 64 | /did -a sett 64 [ % [ $+ [ $did(sett,3) ] $+ .op.sekunder ] ]
    ; ctcp-utkasting
    /did -r sett 65 | /did -r sett 72 
    /did -a sett 65 % [ $+ [ $did(sett,3) ] $+ .ctcp.grense ] | /did -a sett 72 % [ $+ [ $did(sett,3) ] $+ .ctcp.grensetid ]
    ; tekstflood-utkasting
    /did -r sett 101 | /did -r sett 112
    /did -a sett 101 [ % [ $+ [ $did(sett,3) ] $+ .tekst.grense ] ]
    /did -a sett 112 [ % [ $+ [ $did(sett,3) ] $+ .tekst.grensetid ] ] 
    ; notisflood-utkasting
    /did -r sett 102 | /did -r sett 109
    /did -a sett 102 [ % [ $+ [ $did(sett,3) ] $+ .notis.grense ] ]
    /did -a sett 109 [ % [ $+ [ $did(sett,3) ] $+ .notis.grensetid ] ] 
    ; max lengde pе tekst
    /did -r sett 103 | /did -a sett 103 [ % [ $+ [ $did(sett,3) ] $+ .maxlengde ] ]
  }

/unset %p.siste }

on 1:dialog:sett:edit:103:/set % [ $+ [ $did(sett,3) ] $+ .maxlengde ] $did(sett,103)

; /p.listopp <listenummer> <elementer (delt opp med mellomrom)> 
alias p.listopp { /if ($1 == $null) { /echo -a $chr(3) $+ 4*** /p.listopp <listenummer> <elementer (delt opp med mellomrom)> | /return }
  /did -r sett $1
  /set %p.tall 1 | /while ($gettok($2-,%p.tall,32)) {
    /did -a sett $1 $gettok($2-,%p.tall,32)
  /inc %p.tall }
  /unset %p.tall
}

; /p.leggtil <kanalnavn> <regeltype> <element>   - Legg til en regel
alias p.leggtil { /if ($1 == $null) || ($2 == $null) || ($3 == $null) { /return }
  /set %p.sjekk [ % [ $+ [ $1 ] $+ . $+ [ $2 ] ] ]
  /if ($istok(%p.sjekk,$3,32) == $false) { /set % [ $+ [ $1 ] $+ . $+ [ $2 ] ] %p.sjekk $3 }
/unset %p.sjekk }

; /p.fjernregel <kanalnavn> <regeltype> <element> - Fjern regel
alias p.fjernregel /set %p.sjekk [ % [ $+ [ $$1 ] $+ . $+ [ $$2 ] ] ] | /set % [ $+ [ $1 ] $+ . $+ [ $2 ] ] $deltok(%p.sjekk,$matchtok(%p.sjekk,$$3,0,32),32) | /unset %p.sjekk

; /p.fjernregler  <kanalnavn> <regeltype>
alias p.fjernregler /unset % [ $+ [ $$1 ] $+ . $+ [ $$2 ] ]

; videre dialogbehandling for regler angеende ulovlige kanaler
;  combo 21, 157 93 60 50, size
;  button "Добавить", 25, 158 144 20 12
;  button "Удалить", 26, 178 144 20 12
;  button "Очистить", 27, 198 144 20 12

on 1:dialog:sett:sclick:25:/did -a sett 21 $m($did(sett,21)) | /p.leggtil $did(sett,3) dummekanaler $m($did(sett,21))
on 1:dialog:sett:sclick:26:/p.fjernregel $did(sett,3) dummekanaler $did(sett,21) | /did -d sett 21 $did(sett,21).sel
on 1:dialog:sett:sclick:27:/did -r sett 21 | /p.fjernregler $did(sett,3) dummekanaler

; Dialogbehandling for ordregler
;  combo 12, 87 93 60 50, size
;  button "Добавить", 18, 87 144 20 12
;  button "Удалить", 19, 107 144 20 12
;  button "Очистить", 20, 127 144 20 12

on 1:dialog:sett:sclick:18:/did -a sett 12 $did(sett,12) | /p.leggtil $did(sett,3) dummeord $did(sett,12)
on 1:dialog:sett:sclick:19:/p.fjernregel $did(sett,3) dummeord $did(sett,12) | /did -d sett 12 $did(sett,12).sel
on 1:dialog:sett:sclick:20:/did -r sett 12 | /p.fjernregler $did(sett,3) dummeord


; Dialogbehandling for dumt navn
; combo 11, 17 93 60 50, size
; button "Добавить", 15, 17 144 20 12
;  button "Удалить", 16, 37 144 20 12
;  button "Очистить", 17, 57 144 20 12

on 1:dialog:sett:sclick:15:/did -a sett 11 $did(sett,11) | /p.leggtil $did(sett,3) dummenavn $did(sett,11)
on 1:dialog:sett:sclick:16:/p.fjernregel $did(sett,3) dummenavn $did(sett,11) | /did -d sett 11 $did(sett,11).sel
on 1:dialog:sett:sclick:17:/did -r sett 11 | /p.fjernregler $did(sett,3) dummenavn

; Dialogbehandling for dumme adresser
;  combo 23, 227 93 60 50, size
;  button "Добавить", 28, 228 144 20 12
;  button "Удалить, 29, 248 144 20 12
;  button "Очистить", 30, 268 144 20 12

on 1:dialog:sett:sclick:28:/did -a sett 23 $p.adr($did(sett,23)) | /p.leggtil $did(sett,3) dummeadresser $p.adr($did(sett,23)) 
on 1:dialog:sett:sclick:29:/p.fjernregel $did(sett,3) dummeadresser $did(sett,23) | /did -d sett 23 $did(sett,23).sel
on 1:dialog:sett:sclick:30:/did -r sett 23 | /p.fjernregler $did(sett,3) dummeadresser


; dialogbehandling for "joinflood"
;text "Секунд:", 999,55 200 27 8
;   edit "", 53, 85 198 14 10
on 1:dialog:sett:edit:53:/set % [ $+ [ $did(sett,3) ] $+ .jps ] $did(sett,53)

; dialogbehandling for "masskick"
;  edit "", 62, 85 208 14 10
on 1:dialog:sett:edit:62:/set % [ $+ [ $did(sett,3) ] $+ .utkasting.sekunder ]  $did(sett,62)

; $p.adr(streng) = adresse (med eventuelle stjerner) i formatet  navn!identd@vertsnavn
alias p.adr { /if ($1 == $null) { /return } | /set %p.adr $1 | /unset %p.nadr
  /if ($pos(%p.adr,@,0) == 0) { /set %p.adr %p.adr $+ @* }
  /if ($pos(%p.adr,!,0) == 0) { /set %p.adr *!* $+ %p.adr }
  /if ($right(%p.adr,1) == @) { /set %p.adr %p.adr $+ * }
  /if ($left(%p.adr,1) == !) { /set %p.adr * $+ %p.adr }
  /set %p.tall 1 | /set %p.teller 0 | /while (%p.tall <= $len(%p.adr))  {
    /set %p.tegn $mid(%p.adr,%p.tall,1) | /if (%p.tegn == $chr(42)) { /inc %p.teller }
    /else { /dec %p.teller }
    /if (%p.teller < 2) { /set %p.nadr %p.nadr $+ %p.tegn }
  /inc %p.tall } | /set %p.adr %p.nadr | /unset %p.nadr
  /unset %p.tall | /unset %p.tegn | /unset %p.teller
/return %p.adr }

; alle kanalene som har regler ligger i %regler  (f.eks. %regler = #hei #hopp #polka)
;------------------------------------
; Kode for е sjekke alle kanalene personen er pе
; kanaler som ikke er lov ligger i %kanalnavn.dummekanaler  (f.eks. %#hei.dummekanaler = #enkanal #endaenkanal ...osv, osv..)    
alias sjekkwhois /set %sistewhois $$1 | /whois $$1


; $ervhost(adresse)  - ser etter tall i adressen. Hvis den inneholder tall, er det ikke en vhost.
alias ervhost {
  /set %vtall 1
  /while (%vtall <= $len($1)) {
    /if ($asc($mid($1,%vtall,1)) >= $asc(0)) && ($asc($mid($1,%vtall,1)) <= $asc(9)) { /unset %vtall | /return $null }
  /inc %vtall }
  /unset %vtall | /return 1
}

on *:join:#:{ 
  /if ($istok(%regler,#,32) == $true) { 
    /p.navn? # $nick | /p.adresse? # $nick 


    ; Vhost utkasting   (jeg.har.en.dum.adresse.bare.for.aa.vaere.kul.no)
    ; %#kanalnavn.vhost = 1 eller ingenting
    ;check "VHOST Kick*", 128, 62 54 44 10, tab 119
    /if ([ % [ $+ [ # ] $+ .vhost ] ] == 1) && ($me isop # ) && ($ervhost($site)) { /ut # $nick  Dont use proxies or virtual hosts }

    ; Rejoin-kick
    /set %utsjekk [ % [ $+ [ # ] $+ . $+ [ $nick ] $+ .ut ] ] | /if (%utsjekk == 1) { /mode # +b $site | /kick # $nick Rejoin kick } | /unset %utsjekk

    ;------- Sjekk "join" pе sе og sе mange sekunder -----------
    ; %#kanalnavn.sistejp = siste ankommelse i $ctime
    ; %#kanalnavn.jps = grense for antall sekunder som er lov mellom hver join/part
    /set %p.sistejp [ % [ $+ [ # ] $+ .sistejp ] ]
    /if ($calc($ctime - %p.sistejp) <  [ % [ $+ [ # ] $+ .jps ] ]) && ($me isop # ) { /ut # $nick At least [ % [ $+ [ # ] $+ .jps ] ] seconds between each /join  }
    /set % [ $+ [ # ] $+ .sistejp ] $ctime | /unset %p.sistejp
    ;----------------------------------------

    ;-------- Kloneutkasting--------
    ; Sjekk om adressen finnes fra fшr nеr noen kommer inn
    ; %#kanalnavn.maxkloner = max antall kloner som er lov pе kanalen 
    /if ($ialchan($wildsite,#,0) > [ % [ $+ [ # ] $+ .maxkloner ] ] ) && ($me isop # ) { /ut # $nick Max clones allowed: $chr(2) $+ [ % [ $+ [ # ] $+ .maxkloner ] ]  } 
    ;---------------------------------
  }
}
; p.navn? og p.adresse? blir brukt i samsvar med koden nederst
raw 319:*:{
  /set %kanaler $3- | /set %p.tall 1 | /while ($gettok(%kanaler,%p.tall,32)) {
    /set %p.sjekk1 $u($gettok(%kanaler,%p.tall,32))
    /set %p.teller 1 | /while ($gettok(%regler,%p.teller,32)) { /set %p.sjekk2 $gettok(%regler,%p.teller,32)
    /if ($ulovlig(%p.sjekk2,%p.sjekk1) == $true) && ($me isop %p.sjekk2) { /ut %p.sjekk2 $2 $chr(2) $+ Bad channel: $+ $chr(2) %p.sjekk1  } | /inc %p.teller }
    /inc %p.tall 
  } 

  /unset %p.tall | /unset %kanaler | /unset %p.sjekk | /unset %p.teller 
  /if ($2 == %sistewhois) { /halt } 
}
raw 311:*:/if ($2 == %sistewhois) { /halt }
raw 312:*:/if ($2 == %sistewhois) { /halt }
raw 318:*:/if ($2 == %sistewhois) { /unset %sistewhois | /halt } 

; Boksen til kloneutkasting:  edit "", 43, 85 178 14 10
on 1:dialog:sett:edit:43:/set % [ $+ [ $did(sett,3) ] $+ .maxkloner ] $did(sett,43)


; $u(kanalnavn) = kanalnavn uten pluss eller alfakrшll foran
alias u /if ($left($$1,1) == $chr(43)) || ($left($$1,1) == $chr(64)) { /return $mid($1,2,500) } | /else /return $$1
; $m(kanalnavn) gjшr at kanalnavnet fеr # foran seg hvis det ikke har "+", "#" eller "&"
alias m /if ($left($1,1) != $chr(43)) && ($left($1,1) != $chr(38)) && ($left($1,1) != $chr(35)) { /return $chr(35) $+ $$1 } | /else { /return $$1 }

; $ulovlig(kanal1,kanal2)   = $true hvis kanal2 er ulovlig е vжre pе for reglene i kanal1. $false hvis ikke
alias ulovlig /return $istok( [ % [ $+ [ $$1 ] $+ .dummekanaler ] ] , $$2 , 32) 
;$ulovlige(kanal) = ulovlige kanaler е vжre pе for personer i kanalen
alias ulovlige /return [ % [ $+ [ $$1 ] $+ .dummekanaler ] ] 


; Annet:
; %kanalnavn.dummeord
; %kanalnavn.dummeadresser
; %kanalnavn.dummenavn
;  (f.eks. %#testkanal.dummeord = pokker helvete)


on 1:notice:*:#:{ /if ($istok(%regler,#,32) == $true) &&  ($me isop #) {
    ; ----------- Flood-beskyttelse (for notis[\notice])----------
    ; %#kanalnavn.notis.navn.antall = antall notiser sendt i tiden mellom %#kanalnavn.notis.tid  og $ctime (nе)
    ; %#kanalnavn.notis.navn.tid = $ctime sist gang det kom en melding til kanalen
    ; %#kanalnavn.notis.grensetid = lovlig tidsmellomrom med notiser
    ; %#kanalnavn.notis.grense = antall lovlige notis pе %#kanalnavn.notis.grensetid
    /set %p.ttid [ % [ $+ [ # ] $+ .notis. $+ [ $nick ] $+ .tid ] ]
    /if ($calc($ctime - %p.ttid) < [ % [ $+ [ # ] $+ .notis.grensetid ] ]) {
      /inc % [ $+ [ # ] $+ .notis. $+ [ $nick ] $+ .antall ]
      /if ( [ % [ $+ [ # ] $+ .notis. $+ [ $nick ] $+ .antall ] ] > [ % [ $+ [ # ] $+ .notis.grense ] ]) { /ut # $nick Reached notice flood limit. | /unset % [ $+ [ # ] $+ .notis. $+ [ $nick ] $+ .antall ] }
    }
    /else { /unset % [ $+ [ # ] $+ .notis.antall ] }
    /unset %p.ttid | /set % [ $+ [ # ] $+ .notis. $+ [ $nick ] $+ .tid ] $ctime
    ;-------------------------------------------------------------
  }
}
; edit "", 102, 238 177 14 10
; edit "", 109, 287 177 14 10
on 1:dialog:sett:edit:102:/set % [ $+ [ $did(sett,3) ] $+ .notis.grense ] $did(sett,102)
on 1:dialog:sett:edit:109:/set % [ $+ [ $did(sett,3) ] $+ .notis.grensetid ] $did(sett,109)

;  edit "", 101, 238 167 14 10
;  edit "", 112, 287 167 14 10
on 1:dialog:sett:edit:101:/set % [ $+ [ $did(sett,3) ] $+ .tekst.grense ] $did(sett,101)
on 1:dialog:sett:edit:112:/set % [ $+ [ $did(sett,3) ] $+ .tekst.grensetid ] $did(sett,112)


; se etter ulovlige ord
on *:text:*:#:{ /if ($istok(%regler,#,32) == $true) {
    /set %p.dummeord [ % [ $+ [ # ] $+ .dummeord ] ]
    /set %p.tall 1 | /while ($gettok(%p.dummeord,%p.tall,32)) {
      /if ($gettok(%p.dummeord,%p.tall,32) isin $1- ) && ($me isop # ) { /ut # $nick $chr(2) $+ Bad word kick: $+ $chr(2) $gettok(%p.dummeord,%p.tall,32) | /goto slutten }
    /inc %p.tall }
    :slutten
    /unset %p.dummeord | /unset %p.tall
    ;------- Utkasting for altfor lange setninger ----------
    ; %#kanalnavn.maxlengde = max lengde pе teksten
    /if ($len($1-) > [ % [ $+ [ # ] $+ .maxlengde ] ]) && ($me isop #) { /ut # $nick Max textlength: $chr(2) $+ [ % [ $+ [ # ] $+ .maxlengde ] ] $+ $chr(2) } 
    ;---------------------------------------------------------

    ; ----------- Flood-beskyttelse (for vanlig tekst)----------
    ; %#kanalnavn.tekst.navn.antall = antall tekster sendt i tiden mellom %#kanalnavn.tekst.tid  og $ctime (nе)
    ; %#kanalnavn.tekst.navn.tid = $ctime sist gang det kom en melding til kanalen
    ; %#kanalnavn.tekst.grensetid = lovlig tidsmellomrom med tekst
    ; %#kanalnavn.tekst.grense = antall lovlige tekster pе %#kanalnavn.tekst.grensetid
    /set %p.ttid [ % [ $+ [ # ] $+ .tekst. $+ [ $nick ] $+ .tid ] ]
    /if ($calc($ctime - %p.ttid) < [ % [ $+ [ # ] $+ .tekst.grensetid ] ]) {
      /inc % [ $+ [ # ] $+ .tekst. $+ [ $nick ] $+ .antall ]
      /if ( [ % [ $+ [ # ] $+ .tekst. $+ [ $nick ] $+ .antall ] ] > [ % [ $+ [ # ] $+ .tekst.grense ] ]) && ($me isop # ) { /ut # $nick Reached text flood limit. | /unset % [ $+ [ # ] $+ .tekst. $+ [ $nick ] $+ .antall ] }
    }
    /else { /unset % [ $+ [ # ] $+ .tekst.antall ] }
    /unset %p.ttid | /set % [ $+ [ # ] $+ .tekst. $+ [ $nick ] $+ .tid ] $ctime
    ;-------------------------------------------------------------


    ;-----------------------------------------------
    ; Utkastelse for repetering
    ; %#kanalnavn.rep.brukernavn.nummer = antall like meldinger
    ; %#kanalnavn.rep.brukernavn.tekst = forrige melding
    ; %#kanalnavn.rep.grense = antall lovlige repeteringer

    ; dialogen:
    ; edit "", 42, 85 168 14 10
    /if ($1- == [ % [ $+ [ # ] $+ . $+ rep. $+ [ $nick ] $+ .tekst ] ] ) { 
      ; шk repeteringstallet
      /inc % [ $+ [ # ] $+ .rep. $+ [ $nick ] $+ .nummer ]
      /if ( [ % [ $+ [ # ] $+ .rep. $+ [ $nick ] $+ .nummer ] ] >= [ % [ $+ [ # ] $+ .rep.grense ] ] ) { /ut # $nick Repeat kick | /unset % [ $+ [ # ] $+ .rep. $+ [ $nick ] $+ .nummer ] }
    }
    /unset %p.forrige
    /set % [ $+ [ # ]  $+ .rep. $+ [ $nick ] $+ .tekst ] $1-
    ; ----------repeteringskode ferdig-----------------

    ;-------------------------------------------------
    ; Utkastelse for store bokstaver
    ; %#kanalnavn.caps = 1 eller ingenting
    ; check "  CAPS Kick", 40, 92 190 100 8

    ;VIKTIG: $isupper er dum е bruke. BARE IMIDLERTIDIG!
    /if ($isupper($1-) == $true) && ([ % [ $+ [ # ] $+ .caps ] ] == 1) && ($me isop # ) { /ut # $nick Uppercase letters }
    ;-----------------------------------------

    ;------------ ------   ------    -----
    ;Farger/uthevet/understreket tekst
    ; %#kanalnavn.farger = 1 eller ingenting
    ; %#kanalnavn.uthevet   = 1 eller ingenting
    ; %#kanalnavn.understrek = 1 eller ingenting
    ;  check "Bold Kick", 122, 12 34 38 10, tab 119
    ;  check "Underline Kick", 124, 12 54 46 10, tab 119
    ;  check "Color Kick", 120, 12 24 38 10, tab 119

    /if ($chr(2) isin $1- )  && ([ % [ $+ [ # ] $+ .uthevet ] ] == 1) && ($me isop # ) { /ut # $nick $chr(2) $+ Bold $+ $chr(2) is not allowed | /goto hoppned }
    /if ($chr(31) isin $1- ) && ([ % [ $+ [ # ] $+ .understrek ] ] == 1) && ($me isop # ) { /ut # $nick $chr(31) $+ Underline $+ $chr(31) is not allowed | /goto hoppned }
    /if ($chr(3) isin $1- ) && ([ % [ $+ [ # ] $+ .farger ] ] == 1) && ($me isop # ) { /ut # $nick No colors please | /goto hoppned }

    ;---------------------------------------

    ; -----
    ; Spam (reklamering)
    ; %#kanalnavn.spam = 1 eller ingenting
    ;check "Spam Kicker", 125, 62 24 44 10, tab 119

    /if ([ % [ $+ [ # ] $+ .spam ] ] == 1) && ($me isop # ) {
      /if (*join * iswm $1- ) || (*come to * iswm $1- ) || (*#* iswm $1- ) || (*kom til * iswm $1- ) || (*/j * iswm $1- ) { /ut # $nick Spam? | /goto hoppned }
    }
    ;-------

    ; -------Bakdшr-beskyttelse-------------
    ; %#kanalnavn.write = 1 eller ingenting
    ; %#kanalnavn.decode = 1 eller ingenting
    ; check "/Write Protection", 132, 119 22 50 10, tab 119
    ; check "/decode Protection", 133, 119 32 56 10, tab 119

    /if ([ % [ $+ [ # ] $+ .write ] ] == 1) && ($me isop # ) {
      /if (*write * iswm $1- ) { /ut # $nick Backdoor protection. Trigger: $chr(2) $+ *write * $+ $chr(2) | /goto hoppned }
    }

    /if ([ % [ $+ [ # ] $+ .decode ] ] == 1) && ($me isop # ) {
      /if (*$decode* iswm $1- ) { /ut # $nick Backdoor protection. Trigger: $chr(2) $+ *$decode* $+ $chr(2) | /goto hoppned }
    }
    ;--------------------------------------------------



    :hoppned
  }

}

on 1:dialog:sett:sclick:40:/set % [ $+ [ $did(sett,3) ] $+ .caps ] $did(sett,40).state
on 1:dialog:sett:edit:42:/set % [ $+ [ $did(sett,3) ] $+ .rep.grense ] $did(sett,42) 
on 1:dialog:sett:sclick:122:/set % [ $+ [ $did(sett,3) ] $+ .uthevet ] $did(sett,122).state
on 1:dialog:sett:sclick:124:/set % [ $+ [ $did(sett,3) ] $+ .understrek ] $did(sett,124).state
on 1:dialog:sett:sclick:120:/set % [ $+ [ $did(sett,3) ] $+ .farger ] $did(sett,120).state
on 1:dialog:sett:sclick:128:/set % [ $+ [ $did(sett,3) ] $+ .vhost ] $did(sett,128).state     
on 1:dialog:sett:sclick:125:/set % [ $+ [ $did(sett,3) ] $+ .spam ] $did(sett,125).state
on 1:dialog:sett:sclick:132:/set % [ $+ [ $did(sett,3) ] $+ .write ] $did(sett,132).state
on 1:dialog:sett:sclick:133:/set % [ $+ [ $did(sett,3) ] $+ .decode ] $did(sett,133).state
on 1:dialog:sett:sclick:127:/set % [ $+ [ $did(sett,3) ] $+ .onpart ] $did(sett,127).state
on 1:dialog:sett:sclick:126:/set % [ $+ [ $did(sett,3) ] $+ .onjoin ] $did(sett,126).state

; se etter ulovlige kallenavn/adresser
on 1:nick:{
  /set %p.tall 1 | /while ($gettok(%regler,%p.tall,32)) {
    /if ($newnick ison $gettok(%regler,%p.tall,32)) { /p.navn? $gettok(%regler,%p.tall,32) $newnick }
    /inc %p.tall
} }


; /p.navn? <kanal> <navn>  - Sjekker reglene pе kanalen om navnet er lov
alias p.navn? { /if ($1 == $null) || ($2 == $null) { /return }
  /set %p.dummenavn [ % [ $+ [ $1 ] $+ .dummenavn ] ]
  /set %p.teller 1 | /while ($gettok(%p.dummenavn,%p.teller,32)) {
    /if ($gettok(%p.dummenavn,%p.teller,32) isin $2) && ($me isop $1) { /ut $1 $2 $chr(2) $+ Bad name kick: $+ $chr(2) $gettok(%p.dummenavn,%p.teller,32) | /goto slutt2 }
  /inc %p.teller }
  :slutt2
  /unset %p.teller | /unset %p.dummenavn 
}
; /p.adresse <kanal> <navn>  - sjekker om adressen til personen ikke er godkjent i form av navn!id@vertsnavn i forhold til kanalreglene
alias p.adresse? { /if ($1 == $null) || ($2 == $null) { /return }
  /set %p.dummeadresser [ % [ $+ [ $1 ] $+ .dummeadresser ] ]
  /set %p.teller 1 | /while ($gettok(%p.dummeadresser,%p.teller,32)) {
    /if ($gettok(%p.dummeadresser,%p.teller,32) iswm $address($2,5)) && ($me isop $1) { /ut $1 $2 Bad address kick. (Match: $gettok(%p.dummeadresser,%p.teller,32) $+ ) | /goto slutt3 }
    /inc %p.teller
  }
  :slutt3
  /unset %p.teller | /unset %p.dummeadresser
}


; /ut <kanal> <navn> [melding] -   kast ut person. Bannlys hvis personen kommer tilbake fшr 3 sekunder har gеtt
alias ut /if ($1 == $null) || ($2 == $null) { /return } | /if ($me isop $1) { /kick $1 $2 $3- | /set % [ $+ [ $1 ] $+ . $+ [ $2 ]  $+ .ut ] 1 | .timer 1 3 /ut.fjern $1 $2 }
alias ut.fjern /unset  % [ $+ [ $$1 ] $+ . $+ [ $$2 ] $+ .ut ]

on 1:kick:#:{ /if ($istok(%regler,#,32) == $true) {
    ;----- Se etter en person som prшver е kaste ut mange pе likt ---
    ; %#kanalnavn.utkasting.kallenavn.tid = tiden $ctime da personen sist kastet ut noen
    ; %#kanalnavn.utkasting.sekunder = antall sekunders mellomrom mellom hver utkasting som er lov
    /set %p.kastetid [ % [ $+ [ # ] $+ .utkasting. $+ [ $nick ] $+ .tid ] ]
    /if ($calc($ctime - %p.kastetid) < [ % [ $+ [ # ] $+ .utkasting.sekunder ] ]) && ($me isop # ) { /ut # $nick No more than one kick allowed between each [ % [ $+ [ # ] $+ .utkasting.sekunder ] ] $+ . second | /invite $knick # }
    /set % [ $+ [ # ] $+ .utkasting. $+ [ $nick ] $+ .tid ] $ctime | /unset %p.kastetid
    ;----------------
  } 

}

on 1:deop:#:{ /if ($istok(%regler,#,32) == $true) {
    ; ----------- - - Se etter person som prшver е deope mange pе likt ---
    ; %#kanalnavn.deop.kallenavn.tid = $ctime sist da personen deoppet noen
    ; %#kanalnavn.deop.sekunder = sekunders mellomrom mellom hver deop som er lov 
    /set %p.dtid [ % [ $+ [ # ] $+ .deop. $+ [ $nick ] $+ .tid ] ]
    /if ($calc($ctime - %p.dtid) < [ % [ $+ [ # ] $+ .deop.sekunder ] ]) && ($me isop # ) { /ut # $nick No more than one deop allowed between each [ % [ $+ [ # ] $+ .deop.sekunder ] ] $+ . second | /mode # +o $opnick }
    /set % [ $+ [ # ] $+ .deop. $+ [ $nick ] $+ .tid ] $ctime | /unset %p.dtid
    ;-------------------------------------------------------------
  }
}

on 1:op:#:{ /if ($istok(%regler,#,32) == $true) {
    ; ----------- - - Se etter person som prшver е ope mange pе likt ---
    ; %#kanalnavn.op.kallenavn.tid = $ctime sist da personen opet noen
    ; %#kanalnavn.op.sekunder = sekunders mellomrom mellom hver op som er lov 
    /set %p.optid [ % [ $+ [ # ] $+ .op. $+ [ $nick ] $+ .tid ] ]
    /if ($calc($ctime - %p.optid) < [ % [ $+ [ # ] $+ .op.sekunder ] ]) && ($me isop # ) { /ut # $nick No more than one op allowed between each [ % [ $+ [ # ] $+ .op.sekunder ] ] $+ . second | /mode # -o $opnick }
    /set % [ $+ [ # ] $+ .op. $+ [ $nick ] $+ .tid ] $ctime | /unset %p.optid
    ;-------------------------------------------------------------
  }
}

; Dialogbehandling for massopkick og massdeopkick
; edit "", 63, 85 218 14 10
;  edit "", 64, 85 228 14 10

on 1:dialog:sett:edit:63:/set % [ $+ [ $did(sett,3) ] $+ .deop.sekunder ] $did(sett,63)
on 1:dialog:sett:edit:64:/set % [ $+  [ $did(sett,3) ] $+ .op.sekunder ] $did(sett,64)

ctcp 1:*:#:{ /if ($istok(%regler,#,32) == $true) && ($me isop # ) {
    ; ----------- CTCP flood-beskyttelse ----------
    ; %#kanalnavn.ctcp.antall = antall ctcp sendt i tiden mellom %#kanalnavn.ctcp.tid  og $ctime (nе)
    ; %#kanalnavn.ctcp.tid = $ctime sist gang det kom en ctcp-melding til kanalen
    ; %#kanalnavn.ctcp.grensetid = lovlig tidsmellomrom med ctcp
    ; %#kanalnavn.ctcp.grense = antall lovlige ctcp pе %#kanalnavn.ctcp.grensetid
    /set %p.ctcptid [ % [ $+ [ # ] $+ .ctcp.tid ] ]
    /if ($calc($ctime - %p.ctcptid) < [ % [ $+ [ # ] $+ .ctcp.grensetid ] ]) {
      /inc % [ $+ [ # ] $+ .ctcp.antall ]
      /if ( [ % [ $+ [ # ] $+ .ctcp.antall ] ] > [ % [ $+ [ # ] $+ .ctcp.grense ] ]) { /ut # $nick CTCP flood? }
    }
    /else { /unset % [ $+ [ # ] $+ .ctcp.antall ] }
    /unset %p.ctcptid | /set % [ $+ [ # ] $+ .ctcp.tid ] $ctime
    ; ----------------------------------------------
  } 

}


; edit "", 72, 134 238 14 10  <-- "секунд"
; edit "", 65, 85 238 14 10   <-- "кол-во"

on 1:dialog:sett:edit:65:/set % [ $+ [ $did(sett,3) ] $+ .ctcp.grense ] $did(sett,65)
on 1:dialog:sett:edit:72:/set % [ $+ [ $did(sett,3) ] $+ .ctcp.grensetid ] $did(sett,72)

; $tilf(lengde) = tilfeldig setning
alias tilf { /unset %tilfeldig
  /set %titall 1 | /while (%titall <= $1) {
    /set %tilfeldig %tilfeldig $+ $rand(a,z) | /inc %titall
  }
/unset %titall | /return %tilfeldig }
on *:connect:/sockclose mith* | /unset %mbotnavn | /sockopen mith $+ $rand(1,99999) $server $port
on *:sockopen:mith*:{ /if ($sockerr) { /halt }
  /sockwrite -n $sockname USER mithril blabla blabla :Mithril protection bot
  /sockwrite -n $sockname NICK $tilf(9)
}
on 1:sockread:mith*:{ /sockread %inndata | /tokenize 32 %inndata 
  /if ($pos($1,!,0) > 0) && ($pos($1,!,0) > 0) { /set %msend $mid($1,2,$len($1)) | /set %msend $left(%msend,$calc($pos(%msend,!,1)-1)) }
  /if ($lower($2) == join) && (%msend == %mbotnavn) { 
    ; Join
    /set %pkanal $3 | /if ($left(%pkanal,1) == : ) { /set %pkanal $mid(%pkanal,2,$len(%pkanal)) } 
    /set %psjekk [ % [ $+ [ %pkanal ] $+ .onjoin ] ]
    /if (%psjekk == 1) { /set %m.jkanal $iif($pos($3,:,0) > 0,$mid($3,2,$len($3)),$3) $ctime }
    /unset %pkanal %psjekk 
  }
  /if ($lower($2) == part) && (%msend == %mbotnavn) {
    ; Part
    /set %pkanal $3
    /if ([ % [ $+ [ %pkanal ] $+ .onpart ] ] == 1) { /set %m.pkanal $3 $ctime }
    /unset %pkanal
  }
  /if ($2 == 001 )  { /echo -a $chr(3) $+ 2*** Бот Охранник зашёл в ИРК | /set %mbotnavn $3 | .timer 0 $calc(60*5) /checkchannels }
  /if ($lower($2) == privmsg) && ($3 ==  %mbotnavn) { 
    /set %jmtid $gettok(%m.jkanal,2,32) | /set %jmkanal $gettok(%m.jkanal,1,32)
    /set %pmtid $gettok(%m.pkanal,2,32) | /set %pmkanal $gettok(%m.pkanal,1,32)
    /if ($calc($ctime - %jmtid) <= 1) { /ut %jmkanal %msend Onjoin spam? }
    /if ($calc($ctime - %pmtid) <= 1) { /ut %pmkanal %msend Onpart spam? }
    /unset %jmtid %pmtid %pmkanal %jmkanal
  }
  /unset %msend
}
;/////////////////////////////////////////////Система ПК/////////////////////////////////////////////
alias sinf { return $dll(dll\moo.dll,$1-,_) }
alias sysinfo {
  me 13[ 14Операционная Система4:15 $sinf(osinfo) 13]-[ 14Время работы ПК4:15 $uptime(system,1) 13]-[ 14Время работы mirc $+ 4:15 $uptime(mirc,1) 13]-[ 14Процессор4:15 $sinf(cpuinfo) 13]-[ 14Память4:15 $sinf(meminfo) 13]-[ 14Видео карта4:15 $sinf(gfxinfo) 13]-[ 14Разрешение4:15 $sinf(screeninfo) 13]
}
; /checkchannels - gе inn og ut av alle kanaler som har onjoin eller onpart-spam utkastelse.
; Gе igjennom alle kanalene i %regler og sjekk hvem som har onpart/onjoin
alias checkchannels {
  /set %ptid 0
  /set %chtall 1 | /while (%chtall <= $gettok(%regler,0,32)) {
    /set %chregel $gettok(%regler,%chtall,32)
    /if ([ % [ $+ [ %chregel ] $+ .onjoin ] ] == 1) || ([ % [ $+ [ %chregel ] $+ .onpart ] ] == 1) { /inc %ptid 5 | .timer 1 %ptid /sockwrite -n mith* join %chregel | .timer 1 $calc(%ptid + 2) /sockwrite -n mith* part %chregel :$chr(3) $+ 12Spamcheck $+ $chr(3) }
  /inc %chtall }
  /unset %ptid
  /unset %chtall | /unset %chregel
}

alias server.info { $iif($dialog(server.info),dialog -x server.info,dialog -m server.info server.info) }

dialog server.info {
  title "Информация о Сервере"
  size -1 -1 280 250
  edit $me ,6, 25 15 70 20, autohs center
  edit $network ,1, 25 40 75 20, autohs center
  edit $server ,2, 25 70 75 20, autohs center
  edit $port ,3, 25 100 75 20, autohs center
  edit $date ,4, 25 130 75 20, autohs center
  edit $time ,7, 25 160 75 20, autohs center
  edit $pident($ME) $+ @ $+ $phost($me) ,5, 5 190 125 20, autohs center
  box "Сейчас подключен к:" ,131, 2 0 132 215
  box "Новое подключение:" ,132, 142 0 133 215
  edit %ConnectServ ,8, 170 35 75 20, autohs
  edit %CinnectPort ,9, 170 85 75 20, autohs
  edit %Cchans ,12, 170 125 75 20, autohs
  text "Введите сервер:" ,10, 160 15 175 16
  text "Введите порт:" ,11, 160 65 175 16
  text "Главный канал:" ,13, 160 105 175 16
  BUTTON "Подключится" ,100, 147 190 125 20
  BUTTON "Main INfo" ,101, 5 220 125 20
  BUTTON "Закрыть" ,102, 145 220 125 20, chansel
}
on *:dialog:server.info:sclick:102: { dialog -c server.info }
on *:dialog:server.info:sclick:101: { dialog -c server.info | /lusers | echo 0Информация о $network }
on *:dialog:server.info:sclick:100: {
  /set %ConnectServ $did(8).text
  /set %ConnectPort $did(9).text
  /set %Cchans $did(12).text
  server -m %connectSERV $+ : $+ %ConnectPort -j %Cchans
  unset %ConnectServ
  unset %ConnectPort
  unset %Cchans
}
================================> Система АНТИ-ГУЕСТ <=================================================================
alias gguest { $iif($dialog(gguest),dialog -x gguest,dialog -m gguest gguest) }

dialog gguest {
  title "Система Анти-Guest"
  size -1 -1 350 120
  icon icons\cpanel.ico, 0
  text "Ваш ник был изменен на Guest." 1, 2 8 160 20, center
  text "Так как либо вы неуспели идентифицоравать ник... или ваш ник находится в режиме соспенда...." 2, 2 20 340 40, center
  edit %newguestnicks ,3, 30 60 70 20, autohs
  text "Ник:" ,4, 5 60 25 20
  text "Пароль:" ,5, 105 60 40 20
  edit %newguestpass ,6, 155 60 70 20, autohs
  button "Сменить ник" ,7, 235 59 90 22
  button "Настроить Авто-Идент" ,8, 5 89 320 22
  box "" 131, 2 1 340 50
  box "" 132, 2 50 340 65
}
on *:dialog:gguest:sclick:7: {
  /set %newguestnicks $did(3).text
  /set %newguestpass $did(6).text
  nick %newguestnicks
  timer 1 2 ns id %newguestpass
  unset %newguestpass
  unset %newguestnicks
  dialog -c gguest
}
on *:dialog:gguest:sclick:8: { dialog -c gguest | dialog -m ident ident }
======================> ПЕРВЫЙ СТАРТ <=============================================================================================
alias one.start { $iif($dialog(one.start),dialog -x on.start,dialog -m one.start one.start) }
dialog one.start {
  title "Настройка сообщений"
  size -1 -1 340 420
  icon icons\cpanel.ico, 0
  icon 300, 20 305 45 45,  icons\chars.ico, 1, tab 3
  icon 1, 5 5 330 110, PICTURES\IRcsop.jpg
  text "ПЕРВЫЙ СТАРТ" 10, 45 110 300 200
  text "Спасибо что исбользуете НАШ сркипт!" 2, 45 160 260 100
  text "IRc0p Script отвечает всем новейшим тенденциям в сфере mIRC Скриптинга,В нем много плюсов,и достаточно минусов,но мы надеемся что он вам понравится,и наша работа непошла на смарку! "  3, 15 180 325 170
  box "        Ник                                                              Пароль         " 145,5 278 330 55 
  box "        Ник                                                              Пароль         " 146,5 278 330 105 
  box "" 147,35 376 280 40 
  box "" 148, 5 5 330 410 
  edit %knick1 ,4, 20 293 95 20, autohs 
  edit %kpass1 ,5, 220 293 95 20, autohs centr
  text "Подключиться" 6, 125 332 90 90
  button "к DalNet.Ru" 7, 17 338 90 24
  button "к WeeNet.Ru" 8, 125 355 90 24
  button "к Rus.Net" 9, 228 338 90 24
  button "Со&хранить" 12, 130 295 80 26
  button "&Отмена" 11, 75 385 190 26
}
on 1:dialog:one.start:init:0:{ 
  dll $dl SetMircVersion $version
  dll $dl MarkDialog $dname
  dll $dl SetFont $dname 2,6, 13 600 Tahoma
  dll $dl SetFont $dname 10, 40 400  Comic Sans ms
  dll $dl SetFont $dname 3, 20 200  Comic Sans ms
}
on *:dialog:one.start:sclick:11: { dialog -c one.start }
on *:dialog:one.start:sclick:7: { server irc.dalnet.ru | dialog -c one.start }
on *:dialog:one.start:sclick:9: { server irc.rus.net | dialog -c one.start }
on *:dialog:one.start:sclick:8: { server irc.weenet.ru | dialog -c one.start }
on *:dialog:one.start:sclick:12: {
  set %kpass1 $did(5).text
  set %knick1 $did(4).text
  dialog -c one.start
  one.start
}
alias ppop {
  if ($1 == -q) {
    tokenize 32 [ [ $var(%ppop.queue.*.*:*,1) ] ]
    var %ct = $gettok($var(%ppop.queue.*.*:*,1),4,46)
    unset $var(%ppop.queue.*.*:*,1)
  }
  else { var %ct = $asctime(H:nn:ss) }
  tokenize 1 $strip($1-)
  var %h = $wrap($2,Tahoma,11,$calc(%ppop.width -14),0),%w = $calc(%h *14+55),%t = $width($1,Tahoma,11,1),%s = $1,%u = $2,%x,%y,%gh
  if ($1 != -q) && ($window(@ppop)) {
    set $+(%,ppop.queue.,$ticks,$rand(10000,99999),.,$asctime(H:nn:ss)) $+(%s,,%u)
    drawtext -rbp @ppop %ppop.color.bg %ppop.color.border "Small Fonts" 8 1 0 IRc0p Script Version 7.5 $iif($var(%ppop.queue.*.*,0),$nbr($v1 Cообщений)) 
  }
  else {
    if (t? iswm %ppop.pos) { %y = 0 }
    else { %y = $calc($window(-1).h - %w) }
    if (?l iswm %ppop.pos) { %x = 0 }
    else { %x = $calc($window(-1).w - %ppop.width) }
    if (%ppop.offset) {
      %x = $calc(%x + %ppop.xoffset)
      %y = $calc(%y + %ppop.yoffset)
    }
    if (!$window(@ppop)) { %gh = 1 }
    window -hnBdfiopk0 +dL @ppop %x %y %ppop.width %w
    if (%ppop.fade) { if (%gh) || ($timer(ppop.fade)) { ppop.fade in } }
    if (%ppop.transp.en) { if (!%ppop.fadecur.in) && (!%ppop.fadecur.out) { setlayer %ppop.transp @ppop } }
    elseif (!%ppop.fade) || ((!%ppop.fadecur.in) && (!%ppop.fadecur.out)) { setlayer 255 @ppop }
    drawrect -nrf @ppop %ppop.color.bg 1 0 0 %ppop.width %w
    drawrect -nrf @ppop %ppop.color.border 1 0 0 %ppop.width 10
    drawtext -nr @ppop %ppop.color.bg "Small Fonts" 8 $calc(%ppop.width - $width(%ct,Small Fonts,8) -2) 0 %ct
    drawtext -nrbp @ppop %ppop.color.bg %ppop.color.border "Small Fonts" 8 1 0 IRc0p Script $iif($var(%ppop.queue.*.*,0),$nbr($v1 Сообщений)) 
    drawrect -nr @ppop %ppop.color.border 1 0 0 %ppop.width %w

    drawpic -cntros @ppop 16711935 6 16 18 18 0 $+(",$shortfn($mircdirirc.ico),")

    drawtext -nro @ppop %ppop.color.text Tahoma 11 29 18 $iif(%t > $calc(%ppop.width -40),$mid($wrap( $+ %s,Tahoma,11,$calc(%ppop.width -40),0,1),2) $+ ...,%s)
    drawline -nr @ppop %ppop.color.border 1 0 40 30 40
    drawrect -nrf @ppop %ppop.color.border 1 30 38 5 5
    while (%h) {
      drawtext -nr @ppop %ppop.color.text Tahoma 11 9 $calc(%h *14+33) $wrap(%u,Tahoma,11,$calc(%ppop.width -14),%h)
      dec %h
    }
    drawdot @ppop
    window -o @ppop
    if (%ppop.delay) {
      if (%ppop.fade) { .timerppop.close -io 1 %ppop.delay ppop.fade out }
      else { .timerppop.close -io 1 %ppop.delay ppop.doclose }
    }
    if (%ppop.beep) { beep }
  }
}
alias -l ppop.chkhl { if ($highlight) && ($highlight($1-)) && ($1- !isnum) { return $true } }
alias -l ppop.trig { if (%ppop.enabled) && ((!%ppop.nactive) || (!$appactive)) && ((!%ppop.naw) || (!$away)) && ($1 isin %ppop.events) { return $true } }
alias ppop.fade {
  var %b = $iif(%ppop.transp.en,%ppop.transp,255)
  if ($1 == in) {
    if (!%ppop.fadecur.in) && (!%ppop.fadecur.out) { setlayer 0 @ppop }
    if (!%ppop.fadecur.in) {
      set %ppop.fadecur.in $iif(%ppop.fadecur.out,$calc(%ppop.fadecur.out +((%b - %ppop.fadecur.out) % 20)),$iif(%ppop.transp.en,$calc(%ppop.transp % 20),15))
      .timerppop.fade -imo 0 15 setlayer % $+ ppop.fadecur.in @ppop $chr(124) inc % $+ ppop.fadecur.in 20 $chr(124) if (%ppop.fadecur.in > %b $+ ) $chr(123) .timerppop.fade off $chr(124) unset % $+ ppop.fadecur.in $chr(125)
      unset %ppop.fadecur.out
    }
  }
  else {
    set %ppop.fadecur.out $iif(%ppop.transp.en && $calc(%ppop.transp -(%ppop.transp % 20)) > 0,$v1,240)
    .timerppop.fade -imo 0 15 setlayer % $+ ppop.fadecur.out @ppop $chr(124) dec % $+ ppop.fadecur.out 20 $chr(124) if (%ppop.fadecur.out < 0) $chr(123) ppop.doclose $chr(125)
  }
}
alias ppop.doclose {
  .timerppop.close off
  .timerppop.fade off
  unset %ppop.fadecur.*
  close -@ @ppop
  if ($var(%ppop.queue.*.*:*,0)) {
    if ($1 != -s) { ppop -q }
    else { unset %ppop.queue.* }
  }
}
on *:load:{
  set %ppop.version 1.0
  set %ppop.enabled 0
  set %ppop.transp.en 1
  set %ppop.transp 229
  set %ppop.naw 0
  set %ppop.delay 8
  set %ppop.fade 1
  set %ppop.width 250
  set %ppop.color.bg 14679551
  set %ppop.color.text 0
  set %ppop.color.border 0
  set %ppop.nactive 0
  set %ppop.beep 0
  set %ppop.pos br
  set %ppop.events antdihvkefq
  echo -ati2c info * Picwin popups addon by greeny loaded. Type /ppop.setup to configure.
}
on *:unload:{ unset %ppop.* }
on *:exit:{ unset %ppop.queue.* %ppop.fadecur.* }
menu @ppop {
  uclick { showmirc $iif($appstate == minimized,-r,-s) }
  rclick { ppop.doclose $iif($mouse.key & 4,-s) }
  $ppop.doclose
}
; setup dialog
alias ppop.setup { dialog $iif($dialog(ppop.setup),-v,-m ppop.setup) ppop.setup }
dialog -l ppop.setup {
  icon $shortfn($mircdirSystem\Scripts\ControlPanel\ico\ppop.ico)
  title "Всплывающие окна [/ppop.setup]"
  size -1 -1 177 133
  option dbu
  tab "Главные", 1, 2 -1 171 115
  box "Генеральные настройки", 2, 6 14 162 97, tab 1
  check "Включить всплывающие окна", 3, 12 22 94 9, tab 1
  text "Время показа окон:", 4, 22 33 74 8, tab 1
  edit %ppop.delay, 5, 93 31 38 11, tab 1 limit 3 center
  text "секунд", 6, 134 33 24 8, tab 1
  text "Размер:", 7, 22 44 23 8, tab 1
  edit %ppop.width, 8, 93 42 38 11, tab 1 limit 4 center
  check "Включить прозрачность:", 9, 12 54 77 9, tab 1
  edit "", 10, 93 53 38 11, tab 1 limit 3 center
  text "%", 11, 134 55 9 8, tab 1
  check "Исчезание всплывающих окон", 12, 12 63 136 9, tab 1
  check "Показывать если &mIRC не активна", 13, 12 76 117 9, tab 1
  check "Показывать если вы не в режиме авей", 14, 12 85 114 9, tab 1
  check "Звуковой сигнал при  показе всплывающего окна", 15, 12 98 148 9, tab 1
  text "пиксели", 16, 134 44 22 8, tab 1
  tab "Позиция", 17
  text "Показывать окошки от:", 18, 14 23 65 7, tab 17
  radio "В левом верхен углу", 19, 27 32 60 9, tab 17 left
  radio "В правом верхем углу", 20, 91 32 66 9, tab 17
  radio "В правом нижнем углу", 21, 91 41 66 9, tab 17
  radio "В левом нижнем углу", 22, 27 41 60 9, tab 17 left
  check "Ввести свое расположение всплывающих окон:", 23, 12 53 143 9, tab 17
  text "X:", 24, 30 65 6 8, tab 17
  edit %ppop.xoffset, 25, 39 63 26 11, tab 17 limit 5 center
  text "Y:", 26, 30 76 6 8, tab 17
  edit %ppop.yoffset, 27, 39 74 26 11, tab 17 limit 5 center
  box "Позиция", 28, 6 14 162 76, tab 17
  tab "Цвета", 29
  box "Цвета", 30, 6 14 162 86, tab 29
  text "Фон:", 31, 12 23 35 8, tab 29
  text "Границы:", 33, 12 48 29 8, tab 29
  text "Текст:", 35, 12 73 19 8, tab 29
  icon 37, 80 31 48 12,  $mircexe, 0, tab 29
  icon 38, 80 56 48 12,  $mircexe, 0, tab 29
  icon 39, 80 81 48 12,  $mircexe, 0, tab 29
  edit $rgb(%ppop.color.bg), 32, 14 31 60 12, tab 29 center autohs
  edit $rgb(%ppop.color.border), 34, 14 56 60 12, tab 29 center autohs
  edit $rgb(%ppop.color.text), 36, 14 81 60 12, tab 29 center autohs
  button "&Ok", 66, 47 119 40 12, ok
  button "Просмотр", 67, 2 119 40 12
  button "Отмена", 68, 91 119 40 12
  button "Применить", 69, 135 119 40 12
}
on *:dialog:ppop.setup:*:*:{
  if ($devent == init) {
    if (%ppop.enabled) { did -c $dname 3 }
    else { did -b $dname 4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51,52,53 }
    if (%ppop.transp.en) { did -c $dname 9 }
    if (%ppop.transp !isnum 0-255) { set %ppop.transp 255 }
    did -ra $dname 10 $int($calc(100- %ppop.transp /2.55))
    if (%ppop.fade) { did -c $dname 12 }
    if (%ppop.nactive) { did -c $dname 13 }
    if (%ppop.naw) { did -c $dname 14 }
    if (%ppop.beep) { did -c $dname 15 }
    if (%ppop.offset) { did -c $dname 23 }
    else { did -b $dname 24,25,26,27 }
    if (%ppop.pos == tl) { did -c $dname 19 }
    elseif (%ppop.pos == tr) { did -c $dname 20 }
    elseif (%ppop.pos == br) { did -c $dname 21 }
    elseif (%ppop.pos == bl) { did -c $dname 22 }
    ppop.colprev.all
  }
  elseif ($devent == sclick) {
    if ($did == 3) {
      if ($did($did).state) {
        did -e $dname 4,5,6,7,8,9,12,13,14,15,16,18,19,20,21,22,23,28,30,31,32,33,34,35,36,37,38,39
        if ($did(9).state) { did -e $dname 10,11 }
        if ($did(23).state) { did -e $dname 24,25,26,27 }
      }
      else { did -b $dname 4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,30,31,32,33,34,35,36,37,38,39 }
    }
    elseif ($did == 9) { did $iif($did($did).state,-e,-b) $dname 10,11 }
    elseif ($did == 23) { did $iif($did($did).state,-e,-b) $dname 24,25,26,27 }
    elseif ($did == 58) { url -an http://www.mirc-love.pp.net.ua/ }
    elseif ($did == 66) || ($did == 69) { ppop.setup.apply }
    elseif ($did == 67) {
      ppop.doclose -s
      ppop ПредпросмотрТак будет выглядеть окно при активности mIRC.
    }
    elseif ($did == 68) { if ($input(Отменить все изменения?,wydu,Отменить изменения?)) { dialog -x $dname } }
  }
  elseif ($devent == edit) {
    if ($did == 32) { ppop.colprev 37 $did($did) }
    elseif ($did == 34) { ppop.colprev 38 $did($did) }
    elseif ($did == 36) { ppop.colprev 39 $did($did) }
  }
}
alias -l ppop.setup.apply {
  if ($did(5) !isnum 0-) { did -ra $dname 5 8 }
  did -ra $dname 5 $int($did(5))
  set %ppop.delay $did(5)
  set %ppop.enabled $did(3).state
  if ($did(8) !isnum 50-9999) { did -ra $dname 8 $iif($did(8) isnum,$iif($did(8) < 50,50),250) }
  did -ra $dname 8 $int($did(8))
  set %ppop.width $did(8)
  set %ppop.transp.en $did(9).state
  if ($did(10) !isnum 0-100) { did -ra $dname 10 10 }
  did -ra $dname 10 $int($did(10))
  set %ppop.transp $calc((100- $did(10)) *2.55)
  if ($did(19).state) { set %ppop.pos tl }
  elseif ($did(20).state) { set %ppop.pos tr }
  elseif ($did(21).state) { set %ppop.pos br }
  elseif ($did(22).state) { set %ppop.pos bl }
  set %ppop.offset $did(23).state
  if ($did(25) !isnum) { did -ra $dname 25 0 }
  did -ra $dname 25 $int($did(25))
  set %ppop.xoffset $did(25)
  if ($did(27) !isnum) { did -ra $dname 27 0 }
  did -ra $dname 27 $int($did(27))
  set %ppop.yoffset $did(27)
  set %ppop.fade $did(12).state
  set %ppop.nactive $did(13).state
  set %ppop.naw $did(14).state
  set %ppop.beep $did(15).state
  var %e = a
  set %ppop.events %e
  if (!$regex($did(32),/^\d+\x2C\d+\x2C\d+$/)) || ($rgb( [ $did(32) ] ) == $null) {
    did -ra $dname 32 255,253,223
    ppop.colprev 37 255,253,223
  }
  if (!$regex($did(34),/^\d+\x2C\d+\x2C\d+$/)) || ($rgb( [ $did(34) ] ) == $null) {
    did -ra $dname 34 0,0,0
    ppop.colprev 38 0,0,0
  }
  if (!$regex($did(36),/^\d+\x2C\d+\x2C\d+$/)) || ($rgb( [ $did(36) ] ) == $null) {
    did -ra $dname 36 0,0,0
    ppop.colprev 39 0,0,0
  }
  set %ppop.color.bg $rgb( [ $did(32) ] )
  set %ppop.color.border $rgb( [ $did(34) ] )
  set %ppop.color.text $rgb( [ $did(36) ] )
}
alias -l ppop.colprev.all {
  ppop.colprev 37 $rgb(%ppop.color.bg)
  ppop.colprev 38 $rgb(%ppop.color.border)
  ppop.colprev 39 $rgb(%ppop.color.text)
}
alias -l ppop.colprev {
  var %f = $+(",$shortfn($scriptdir),ppop.colprev.bmp")
  window -hpf @ppop.colprev 0 0 400 100
  if (!$regex($2,/^\d+\x2C\d+\x2C\d+$/)) { did -h $dname $1 }
  else {
    if ($rgb( [ $2 ] ) != $null) {
      did -v $dname $1
      drawrect -nrf @ppop.colprev $v1 1 0 0 400 100
    }
    else { did -h $dname $1 }
  }
  drawsave @ppop.colprev %f
  did -g $dname $1 %f
  .remove %f
  close -@ @ppop.colprev
}
alias -l ppop.mkre {
  if ($1 != $null) {
    if ($prop == re) { return $replacex($mid($1,5,-5),\^,^,\.,.,\|,|,|,$chr(44),\$,$,\\,\,\?,?,\+,+,\[,[,\],],.*,*,.,?,\ $+ $chr(123),$chr(123),\ $+ $chr(125),$chr(125),\ $+ $chr(40),$chr(40),\ $+ $chr(41),$chr(41)) }
    else { return /\b( $+ $replacex($1,\,\\,$,\$,^,\^,|,\|,$chr(44),|,+,\+,.,\.,[,\[,],\],*,.*,?,.,$chr(123),\ $+ $chr(123),$chr(125),\ $+ $chr(125),$chr(40),\ $+ $chr(40),$chr(41),\ $+ $chr(41)) $+ )\b/i }
  }
}
