Advanced AutoVoice — File Browser

AdvancedAutoVoicev1.0 / AdvancedAutoVoicev1.0 / AAV.mrc

AAV.mrc — 9.7 KB — Download this file

; Advanced AutoVoice
; by ch1zra
; ch1zra@gmail.com
; http://uptheirons.co.sr/
; #Scripters @ irc.krstarica.com
; Copyright © Up The Irons ! inc.

; ~~~ On Load & UnLoad ~~~

on 1:load: {
  if ($version > 6.0) { echo  Advanced AutoVoice by ch1zra succesfully loaded 
    echo 4ch1zra@gmail.com 
    if ($readini(mirc.ini, AAV, Enabled) == $null) {
      writeini mirc.ini AAV Enabled True
      writeini mirc.ini AAV Type List
      writeini mirc.ini AAV Anti True
    }
    advavoice
  }
  else { 
    echo  Version 6.0 or higher required, get a newer version of mirc at http://www.mirc.com  
    unload -rs $script 
  }
}

on 1:unload: {
  if ($dialog(advavoice)) {
    dialog -x advavoice advavoice
  }
  echo Unloading Advanced AutoVoice Script...
  if ($input(Do you want to keep your settings ?, y, Unloading) == $false) {
    remini mirc.ini AAV
    if ($isfile(" $+ $scriptdiradvavoice.db $+ ") == $true) {
      remove " $+ $scriptdiradvavoice.db $+ "
    }
    if ($isfile(" $+ $scriptdirantivoice.db $+ ") == $true) {
      remove " $+ $scriptdirantivoice.db $+ "
    }
  }
  else {
    echo [AAV] settings saved.
    echo [AAV] succesfully unloaded.
  }
}

; ~~~ Aliases ~~~

alias advavoice {
  if ($dialog(advavoice)) {
    dialog -ve advavoice advavoice
  }
  else { dialog -mdo advavoice advavoice }
}

alias -l antivoice {
  if ($dialog(antivoice)) {
    dialog -v antivoice antivoice
  }
  else { dialog -mdo antivoice antivoice }
}

alias -l about.advavoice {
  dialog -i advavoice advavoice
  if ($input(Advanced AutoVoice Script $crlf by ch1zra $crlf $crlf ch1zra@gmail.com $&
    $crlf $crlf #Scripters @ irc.krstarica.com $crlf $crlf http://uptheirons.co.sr/  $crlf $crlf $&
    Copyright © Up The Irons ! inc. Scripting Team,oi,About Advanced AutoVoice Script) == $true) {
    dialog -e advavoice advavoice
  }
}

alias -l help.advavoice {
  dialog -i advavoice advavoice
  if ($input(Not hard to use. Simply select channels where you want to auto voice users on join $&
    or choose to autovoice users on all channels where you are OP. You can enable/disable AAV $&
    so have fun using it. Also there is option not to voice some nicks $+ $chr(44) and it can be accessed via ''NoVoice''  $&
    button. If you like it $+ $chr(44) contact me $+ $chr(44) or visit my website. All contact info $&
    can be found by clicking "About" button. $crlf $crlf Respect $+ $chr(44) $crlf ch1zra,oq,Advanced AutoVoice $& 
    Help) == $true) {
    dialog -e advavoice advavoice
  }
}

alias -l fill {
  did -r advavoice 2
  var %i 1
  var %tp $lines(" $+ $scriptdiradvavoice.db $+ ")
  while (%i <= %tp) {
    did -a advavoice 2 $read(" $+ $scriptdiradvavoice.db $+ ",%i)
    inc %i
  }
  unset %list.tp
}

alias -l anti.fill {
  did -r antivoice 2
  var %i 1
  var %tp $lines(" $+ $scriptdirantivoice.db $+ ")
  while (%i <= %tp) {
    did -a antivoice 2 $read(" $+ $scriptdirantivoice.db $+ ",%i)
    inc %i
  }
  unset %list.tp
}

; ~~~ Dialog ~~~

dialog advavoice {
  title "Advanced AutoVoice"
  size -1 -1 115 125
  option dbu
  box "Channels", 1, 0 0 115 60
  list 2, 5 10 70 50, autovs sort
  button "Remove", 3, 80 10 30 10, flat
  button "Add", 4, 80 25 30 10, flat
  box "Settings", 5, 0 60 115 45
  check "Enabled", 6, 10 70 50 10, flat
  radio "Voice in all channels", 7, 20 80 90 10, flat
  radio "Voice only in channels in list", 8, 20 90 90 10, flat
  button "NoVoice", 9, 80 40 30 10, flat
  button "About", 10, 5 110 30 10, flat
  button "Help", 11, 40 110 35 10, flat
  button "OK", 12, 80 110 30 10, flat ok
}

dialog antivoice {
  title "NoVoice List"
  size -1 -1 95 85
  option dbu
  text "List of nicks that will not receive voice.", 1, 5 5 85 20
  list 2, 5 25 50 65, autovs sort
  button "Add", 3, 60 25 30 10, flat
  button "Remove", 4, 60 40 30 10, flat
  check "Enabled", 5, 60 55 30 10, flat push
  button "Close", 6, 60 70 30 10, flat ok
}
; ~~~ On Init Stuff ~~~

on *:dialog:advavoice:init:*: {
  fill
  if ($readini(mirc.ini,AAV,Enabled) == False) {
    did -b $dname 1,2,3,4,5,7,8,9
  }
  else did -c $dname 6
  if ($readini(mirc.ini,AAV,Type) == All) {
    did -c $dname 7
  }
  else did -c $dname 8
}

on *:dialog:antivoice:init:*: {
  anti.fill
  if ($readini(mirc.ini,AAV,Anti) == False) {
    did -b $dname 1,2,3,4
  }
  else did -c $dname 6
  if ($readini(mirc.ini,AAV,Anti) == True) {
    did -c $dname 5
  }
}

; ~~~ On Close ~~~

on *:dialog:advavoice:close:*: {
  if ($dialog(antivoice)) {
    dialog -x antivoice antivoice
  }
  unset %list.tp
}

on *:dialog:antivoice:close:*: {
  if ($dialog(advavoice)) {    
    dialog -e advavoice advavoice
  }
  unset %alist.tp
}

; ~~~ Dialog Clicks ~~~

on *:dialog:antivoice:sclick:*: {
  if ($did == 2) {
    set %alist.tp $did(2).seltext
  }
  if ($did == 3) {
    dialog -i antivoice antivoice
    var %i $input(Enter nick to be exempt from voice : , e, Enter NoVoice Nick) 
    if (%i != $null) {
      if ($read(" $+ $scriptdirantivoice.db $+ ", w, %i) == $null) {
        write " $+ $scriptdirantivoice.db $+ " %i
        did -a antivoice 2 %i
        dialog -e antivoice antivoice
      }
      elseif ($read(" $+ $scriptdirantivoice.db $+ ", w, %i) == %i) { 
        if ($input(That nick is already in NoVoice List. If only diference is in case (eg. ch1zra and Ch1zRa) $+ $chr(44) keep $&
          in mind that mIRC commands and nick recognition are not CasE SensItivE., ow, Error) == $true) {
          dialog -e antivoice antivoice
        }
      }
    }
    if (%i == $null) && ($input(No nick entry ! , ow, Error)) {
      dialog -e antivoice antivoice
    }
  }
  if ($did == 4) {
    dialog -i antivoice antivoice
    if (%alist.tp == $null) { 
      if ($input(Select nick from list to your left.,ow,Error)) {
        dialog -e antivoice antivoice
      }
    }
    elseif ($input(Are you sure that you want to remove " $+ $did(2).seltext $+ " from AntiVoice list ??,y,Deleting) == $true) {
      write -ds $+ %alist.tp " $+ $scriptdirantivoice.db $+ "
      anti.fill
      dialog -e antivoice
      unset %alist.tp
    }
    else {
      dialog -e antivoice antivoice
    }
  }
  if ($did == 5) {
    if ($did(5).state == 1) {
      writeini mirc.ini AAV Anti True
      did -e $dname 1,2,3,4
    }
    if ($did(5).state == 0) {
      writeini mirc.ini AAV Anti False
      did -b $dname 1,2,3,4
    }
  }
}

on *:dialog:advavoice:sclick:*: {
  if ($did == 2) {
    set %list.tp $did(2).seltext
  }
  if ($did == 3) {
    dialog -i advavoice advavoice
    if (%list.tp == $null) { 
      if ($input(Select channel from list to your left. ,ow,Error)) {
        dialog -e advavoice advavoice
      }
    }
    elseif ($input(Are you sure that you want to remove " $+ $did(2).seltext $+ " ?,y,Deleting) == $true) {
      write -ds $+ %list.tp " $+ $scriptdiradvavoice.db $+ "
      fill
      dialog -e advavoice advavoice
      unset %list.tp
    }
    else {
      dialog -e advavoice advavoice
    }
  }
  if ($did == 4) {
    dialog -i advavoice advavoice
    var %i $input(Enter channel name (with ''#'') : ,e, Set Channel) 
    if (%i != $null) {
      if ($read(" $+ $scriptdiradvavoice.db $+ ", w, %i) == $null) {
        write " $+ $scriptdiradvavoice.db $+ " %i
        did -a advavoice 2 %i
        dialog -e advavoice advavoice
      }
      elseif ($read(" $+ $scriptdiradvavoice.db $+ ", w, %i) == %i) {
        if ($input(That channel is already in List. $& 
          If only diference is in case (eg. #Scripters and #ScRipTerS) $+ $chr(44) keep $&
          in mind that mIRC commands and channel names are not CasE SensItivE., ow, Error) == $true) {
          dialog -e advavoice advavoice
        }
      }
    }
    if (%i == $null) && ($input(No channel entry ! , ow, Error)) {
      dialog -e advavoice advavoice
    }
  }
  if ($did == 6) {
    if ($did(6).state == 1) {
      did -e $dname 1,2,3,4,5,7,8,9
      writeini mirc.ini AAV Enabled True
    }
    if ($did(6).state == 0) {
      did -b $dname 1,2,3,4,5,7,8,9
      writeini mirc.ini AAV Enabled False
    }
  }
  if ($did == 7) {
    writeini mirc.ini AAV Type All
  }
  if ($did == 8) {
    writeini mirc.ini AAV Type List
  }
  if ($did == 9) {
    dialog -i advavoice advavoice
    antivoice
  }
  if ($did == 10) {
    about.advavoice
  }
  if ($did == 11) {
    help.advavoice
  }
}

; ~~~ On Join Event ~~~

On *:join:#: {
  if ($me isop #) && ($readini(mirc.ini,AAV,Enabled) == True) {
    if ($readini(mirc.ini,AAV,Type) == All) {
      if ($readini(mirc.ini,AAV,Anti) == False) {
        mode # +v $nick
      }
      elseif ($readini(mirc.ini,AAV,Anti) == True) {
        if ($read(" $+ $scriptdirantivoice.db $+ ", w, * $+ $nick $+ *) == $nick) {
          return
        }
        else {
          mode # +v $nick
        }
      }
    }
    if ($readini(mirc.ini,AAV,Type) == List)  {
      if  ($read(" $+ $scriptdiradvavoice.db $+ ", w, * $+ $chan $+ *) == $chan) {
        if ($readini(mirc.ini,AAV,Anti) == False) {
          mode # +v $nick
        }
        elseif ($readini(mirc.ini,AAV,Anti) == True) {
          if ($read(" $+ $scriptdirantivoice.db $+ ", w, * $+ $nick $+ *) == $nick) {
            return
          }
          else {
            mode # +v $nick
          }
        }
      }
    }
  }
}

; ~~~ Menus ~~~

menu channel,status,query,nicklist {
  Advanced AutoVoice: advavoice
}

menu menubar {
  Advanced AutoVoice Script
  .Settings:advavoice
  .Unload
  ..Yes:unload -rs $script
}

; Advanced AutoVoice
; by ch1zra
; ch1zra@gmail.com
; http://uptheirons.co.sr/
; #Scripters @ irc.krstarica.com
; Copyright © Up The Irons ! inc.