on @*:text:!vlist*:#:{
if ($nick isop #) {
if (!$2) {
var %a = 1
while %a <= $voice(0) {
.write voice.tmp $gettok($avoice(%a),1,33)
inc %a
}
.play $chan voice.tmp
.remove voice.tmp
set %voiced $sorttok(%voiced,44)
set %voiced $replace(%voiced,$chr(44),$+($chr(44),$chr(32)))
.msg $nick %voiced
unset %voiced
}
elseif ($2 == add) {
if (!$3) { msg $chan $nick text here }
else {
var %a = 1
while %a <= $numtok($3-,32) {
var %nick = $gettok($3-,%a,32)
var %address = $gettok($address(%nick,9),1,46)
if (%nick !ison $chan) { msg $chan Sorry, but %nick must be on $chan in order to add them }
elseif $avoice(%address) { msg $chan %nick is already in the auto voice list }
else {
set %avoice $addtok(%avoice,%nick,32)
.avoice %nick $chan
msg $chan %nick has been added to the auto voice list
if $numtok(%avoice,32) = $modespl {
unset %avoice
}
}
inc %a
}
if %avoice {
unset %avoice
}
}
}
elseif ($2 == del) {
if (!$3) { msg $chan $nick text here }
else {
var %a = 1
while %a <= $numtok($3-,32) {
var %nick = $gettok($3-,%a,32)
var %address = $gettok($address(%nick,9),1,46)
if (%nick !ison $chan) { msg $chan Sorry, but %nick must be on $chan in order to delete them }
elseif !$avoice(%address) { msg $chan %nick isn't on the auto voice list }
else {
set %avoice $addtok(%avoice,%nick,32)
.avoice -r %nick $chan
msg $chan %nick has been deleted from the auto voice list
if $numtok(%avoice,32) = $modespl {
unset %avoice
}
}
inc %a
}
if %avoice {
unset %avoice
}
}
}
else { msg $chan Valid commands are !vlist add <nick(s)>, !vlist del <nick(s)>. }
}
}
else {
msg $nick Sorry, this command is for opers in $chan only
}
}