Ok, Dunce tempted me to improve this little script, here the results:
Code:
on 1:text:!massvoice:*: {
; find out if we are op and the user issuing the command is op too.
; If not, stop the script...
if ($me !isop $chan || $nick !isop $chan) {
msg $chan Either you ( $+ $nick $+ ) or me ain't op in $chan
halt
}
; iterate through all members in the chan
var %i, %voicestr
set %i 1
; we request only users which have no state (yet)
while ($nick($chan, %i, a, voh)) {
set %voicestr v $+ %voicestr $nick($chan, %i, a, voh)
set %i $calc(%i + 1)
}
mode $chan + $+ %voicestr
}
on 1:text:!massdevoice:*: {
; find out if we are op and the user issuing the command is op too.
; If not, stop the script...
if ($me !isop $chan || $nick !isop $chan) {
msg $chan Either you ( $+ $nick $+ ) or me ain't op in $chan
halt
}
; iterate through all members in the chan
var %i, %voicestr
set %i 1
; we request only users which have state v
while ($nick($chan, %i, v)) {
set %voicestr v $+ %voicestr $nick($chan, %i, v)
set %i $calc(%i + 1)
}
mode $chan - $+ %voicestr
}
Actual change: it now voices/devoices any one in one line, instead of multiple.
It also operates on the channel it is called in, for I saw no issue in giving the channel to operate on.