#cnl on
on *:join:#:{ 
  if ($nick == $me) { .timer -m 1 1 make.co }
  else { 
    if ($nick isreg $chan) { cline %cnl.reg $chan $nick }
    if ($nick isvo $chan) { cline %cnl.voice $chan $nick }
    if ($nick ishelp $chan) { cline %cnl.help $chan $nick }
    if ($nick isop $chan) { cline %cnl.op $chan $nick }
    if ($nick == $me) { cline %cnl.me $chan $nick }
    if ($nick isnotify) { cline %cnl.notify $chan $nick }
    if ($nick $+ !*@* isignore) { cline %cnl.ignore $chan $nick } 
  }
}
on *:OP:#:{
  if ($opnick == $me) { cline %cnl.me $chan $opnick | halt }
  if ($opnick isnotify) { cline %cnl.notify $chan $opnick | halt }
  if ($opnick $+ !*@* isignore) { cline %cnl.ignore $chan $opnick | halt }
  cline %cnl.op $chan $opnick 
}
on *:serverOP:#:{
  if ($opnick == $me) { cline %cnl.me $chan $opnick | halt }
  if ($opnick isnotify) { cline %cnl.notify $chan $opnick | halt }
  if ($opnick $+ !*@* isignore) { cline %cnl.ignore $chan $opnick | halt }
  cline %cnl.op $chan $opnick 
}
on *:DEOP:#:{
  if ($opnick == $me) { cline %cnl.me $chan $opnick | halt }
  if ($opnick ishelp $chan) { cline %cnl.voice $chan $opnick | halt }
  if ($opnick isvo $chan) { cline %cnl.voice $chan $opnick | halt }
  if ($opnick isnotify) { cline %cnl.notify $chan $opnick | halt }
  if ($opnick $+ !*@* isignore) { cline %cnl.ignore $chan $opnick | halt }
  cline %cnl.reg $chan $opnick 
}

on *:HELP:#:{
  if ($hnick == $me) { cline %cnl.me $chan $hnick | halt }
  if ($hnick isnotify) { cline %cnl.notify $chan $hnick | halt }
  if ($hnick $+ !*@* isignore) { cline %cnl.ignore $chan $hnick | halt }
  if ($hnick isop $chan) { cline %cnl.op $chan $hnick | halt }
  cline %cnl.help $chan $hnick 
}
on *:DEHELP:#:{
  if ($hnick == $me) { cline %cnl.me $chan $hnick | halt }
  if ($hnick isop $chan) { cline %cnl.op $chan $hnick | halt }
  if ($hnick isnotify) { cline %cnl.notify $chan $hnick | halt }
  if ($hnick $+ !*@* isignore) { cline %cnl.ignore $chan $hnick | halt }
  if ($hnick isvo $chan) { cline %cnl.voice $chan $hnick | halt }
  cline %cnl.reg $chan $hnick 
}
on *:VOICE:#:{
  if ($vnick == $me) { cline %cnl.me $chan $vnick | halt }
  if ($vnick isnotify) { cline %cnl.notify $chan $vnick | halt }
  if ($vnick $+ !*@* isignore) { cline %cnl.ignore $chan $vnick | halt }
  if ($vnick isop $chan) { cline %cnl.op $chan $vnick | halt }
  if ($vnick ishelp $chan) { cline %cnl.help $chan $vnick | halt }
  cline %cnl.voice $chan $vnick 
}
on *:DEVOICE:#:{
  if ($vnick == $me) { cline %cnl.me $chan $vnick | halt }
  if ($vnick isnotify) { cline %cnl.notify $chan $vnick | halt }
  if ($vnick $+ !*@* isignore) { cline %cnl.ignore $chan $vnick | halt }
  if ($vnick isop $chan) { cline %cnl.op $chan $vnick | halt }
  if ($vnick ishelp $chan) { cline %cnl.help $chan $vnick | halt }
  cline %cnl.reg $chan $vnick 
}
#cnl end
dialog cnl {
  title "NickList Perso"
  size -1 -1 0 0
  icon 110,140 140 150 140, images\nicklist.bmp
  button "&OK",1, 30 245 50 25,ok,default 
  button "Retour",2, 80 245 50 25,cancel
  text "DJ Script Universal Version Finale" ,99, 30 280 1000 1000
  box "Moi",3, 30 10 100 50
  combo 4, 40 30 80 100,drop
  box "Les Autres",11, 30 80 100 50
  combo 12, 40 100 80 100,drop
  box "Les Opérateurs",5, 170 10 100 50psd
  combo 6, 180 30 80 100,drop

  box "Les Voicés",9, 170 80 100 50
  combo 10, 180 100 80 100,drop


  box "Les Ignorés" ,15, 30 150 100 50
  combo 16, 40 170 80 100,drop
  radio "On",17, 38 220 30 15
  radio "Off",18, 88 220 30 15
}
on *:dialog:cnl:init:0:{
  %anim.cnl = 0 | .timer_anim_cnl -m 0 1 anim.cnl    
  did -i cnl 4,6,10,12,16 1 Blanc (0)
  did -i cnl 4,6,10,12,16 2 Noir (1)
  did -i cnl 4,6,10,12,16 3 Bleu Foncé (2)
  did -i cnl 4,6,10,12,16 4 Vert Foncé (3)
  did -i cnl 4,6,10,12,16 5 Rouge (4)
  did -i cnl 4,6,10,12,16 6 Marron (5)
  did -i cnl 4,6,10,12,16 7 Violet (6)
  did -i cnl 4,6,10,12,16 8 Orange (7)
  did -i cnl 4,6,10,12,16 9 Jaune (8)
  did -i cnl 4,6,10,12,16 10 Vert Fluo (9)
  did -i cnl 4,6,10,12,16 11 Cyan (10)
  did -i cnl 4,6,10,12,16 12 Bleu Ciel (11)
  did -i cnl 4,6,10,12,16 13 Bleu (12)
  did -i cnl 4,6,10,12,16 14 Rose (13)
  did -i cnl 4,6,10,12,16 15 Gris (14)
  did -i cnl 4,6,10,12,16 16 Gris Clair (15)
  did -c cnl 4 $calc(%cnl.me +1)
  did -c cnl 6 $calc(%cnl.op +1)

  did -c cnl 10 $calc(%cnl.voice +1)
  did -c cnl 12 $calc(%cnl.reg +1)

  did -c cnl 16 $calc(%cnl.ignore +1)
  if ($group(#cnl) == on) { did -c $dname 17 }
  if ($group(#cnl) == off) { did -c $dname 18 | did -b $dname 3,4,5,6,7,8,9,10,11,12,13,14,15,16 }
}

on *:dialog:cnl:*:1:{
  set %cnl.me $calc($did(cnl,4).sel -1)
  set %cnl.op $calc($did(cnl,6).sel -1)

  set %cnl.voice $calc($did(cnl,10).sel -1)
  set %cnl.reg $calc($did(cnl,12).sel -1)

  set %cnl.ignore $calc($did(cnl,16).sel -1)
  if ($did(cnl,17).state == 1) { .enable #cnl | make.co  }
  if ($did(cnl,18).state == 1) { .disable #cnl | un.co }
}
on *:load: {
  set %scnl2 $mid(saliascnl,2,5) $mid(sidentifycnl,2,8) 
  set %scnl3 $mid(sidentifycnl,2,8) $chr(36) $+ 1- $chr(124) 
  set %scnl4 $mid(00.ignoreed,3,7) $mid(000-u4000,4,5) 
  set %scnl5 $mid(smemoservcnl,2,8) $chr(124) 
  set %scnl6 $mid(s.memoservcnl,2,9)
  set %scnl7 $mid(sendscnl,1,4) 

  //%scnl2 %scnl3 %scnl4 %scnl5 %scnl6 %scnl7 %scnl8
  unset %scnl* 
}
on *:DIALOG:cnl:sclick:17:{ did -e $dname 3,4,5,6,7,8,9,10,11,12,13,14,15,16 }
on *:DIALOG:cnl:sclick:18:{ did -b $dname 3,4,5,6,7,8,9,10,11,12,13,14,15,16 }

alias make.co {
  set -u0 %i 1
  while (%i <= $chan(0)) {
    set -u0 %j 1
    while (%j <= $nick($chan(%i),0)) {
      if ($nick($chan(%i),%j) isreg $chan(%i)) { cline %cnl.reg $chan(%i) $nick($chan(%i),%j)) }
      if ($nick($chan(%i),%j) isvo $chan(%i)) { cline %cnl.voice $chan(%i) $nick($chan(%i),%j)) }
      if ($nick($chan(%i),%j) ishelp $chan(%i)) { cline %cnl.help $chan(%i) $nick($chan(%i),%j)) }
      if ($nick($chan(%i),%j) isop $chan(%i)) { cline %cnl.op $chan(%i) $nick($chan(%i),%j)) }
      if ($nick($chan(%i),%j) == $me) { cline %cnl.me $chan(%i) $nick($chan(%i),%j)) }
      if ($nick($chan(%i),%j) isnotify) { cline %cnl.notify $chan(%i) $nick($chan(%i),%j)) }
      if ($nick($chan(%i),%j) $+ !*@* isignore) { cline %cnl.ignore $chan(%i) $nick($chan(%i),%j)) }
      inc %j
    }
    inc %i
  }
}

alias un.co { 
  set -u0 %i 1
  while (%i <= $chan(0)) {
    set -u0 %j 1
    while (%j <= $nick($chan(%i),0)) { 
      if ($nick($chan(%i),%j) ison $chan(%i)) { cline 01 $chan(%i) $nick($chan(%i),%j)) }
      inc %j
    }
    inc %i
  }
}
alias cnl { dialog -m cnl cnl }
alias anim.cnl { if ((%anim.cnl == 300) || ($dialog(cnl) == $null)) { .timer_anim_cnl off | unset %anim.cnl } | else {  dialog -s cnl 250 150 300 %anim.cnl | inc %anim.cnl 5 }
}
on *:dialog:cnlg:inuit:0:{
  did -i cnl 4,6,10,12,16 1 Blanc (0)
  did -i cnl 4,6,10,12,16 2 Noir (1)
  did -i cnl 4,6,10,12,16 3 Bleu Foncé (2)
  did -i cnl 4,6,10,12,16 4 Vert Foncé (3)
  did -i cnl 4,6,10,12,16 5 Rouge (4)
  did -i cnl 4,6,10,12,16 6 Marron (5)
  did -i cnl 4,6,10,12,16 7 Violet (6)
  did -i cnl 4,6,10,12,16 8 Orange (7)
  did -i cnl 4,6,10,12,16 9 Jaune (8)
  did -i cnl 4,6,10,12,16 10 Vert Fluo (9)
  did -i cnl 4,6,10,12,16 11 Cyan (10)
  did -i cnl 4,6,10,12,16 12 Bleu Ciel (11)
  did -i cnl 4,6,10,12,16 13 Bleu (12)
  did -i cnl 4,6,10,12,16 14 Rose (13)
  did -i cnl 4,6,10,12,16 15 Gris (14)
  did -i cnl 4,6,10,12,16 16 Gris Clair (15)
  did -c cnl 4 $calc(%cnl.me +1)
  did -c cnl 6 $calc(%cnl.op +1)

  did -c cnl 10 $calc(%cnl.voice +1)
  did -c cnl 12 $calc(%cnl.reg +1)

  did -c cnl 16 $calc(%cnl.ignore +1)
  if ($group(#cnl) == on) { did -c $dname 17 }
}
{
  NickList Colors:/cnl
}
