With this script you can set an auto hop on all channels you are this time every "x" seconds
Commands:
/autohop set Time (in seconds)
/autohop on
/autohop off
alias hopall {
var %i 1, %x
while (%i <= $chan(0)) {
%x = $addtok(%x, $chan(%i), 44)
inc %i
}
.partall $1-
.timer 1 0 join -n %x
}
alias autohop {
if ($1 == on) {
if (%hoptime) {
.timer[autohop] 0 %hoptime hopall
set %autohop on
echo $color(info) * Auto Hop All Channels is now On, on %hoptime Second(s)
}
else { echo $color(info) * Auto Hop All Channels time is not seted, set it with: /autohop set <time> }
}
elseif ($1 == off) {
.timer[autohop] off
echo $color(info) * Auto Hop All Channels is now OFF
set %autohop off
}
elseif ($1 == set) {
if ($2 isnum) {
set %hoptime $2
echo $color(info) * Auto Hop All Channels time seted to: $2 second(s)
if (%autohop == on) {
.timer[autohop] off
.timer[autohop] 0 %hoptime hopall
echo $color(info) * Auto Hop All Channels was on, Script Reloaded %hoptime starting to count from now
}
}
else {
echo $color(info) * /autohop: insufficient parameters
}
}
else {
echo $color(info) * /autohop: insufficient parameters
}
}
hi
you can group the two conditions ON and OFF together with a $istok
and if the timer is running you need not put off then restart just remade it
for the first error is about syntax not insufficient parameters so your code can be like this
alias hopall {
.partall $1-
join -n $regsubex($str(.,$chan(0)),/./g,$+($chan(\n),$chr(44)))
}
alias autohop {
if $istok(on.off,$1,46) {
if %hoptime {
.timer[autohop] $iif($1 == on,0 %hoptime hopall,off)
set %autohop $1
echo $color(info) * Auto Hop All Channels is now $1 $+ $iif($1 == on,$chr(44) on %hoptime Second(s))
}
else echo $color(info) * Auto Hop All Channels time is not seted, set it with: /autohop set <time>
}
elseif $1 == set {
if $2 isnum {
set %hoptime $2
if (%autohop == on) .timer[autohop] 0 %hoptime hopall
echo $color(info) * Auto Hop All Channels $iif($v1 == on,was on $+ $chr(44) Script Reloaded %hoptime starting to count from now,time seted to: %hoptime second(s))
}
else echo $color(info) * /autohop: Error syntax - /autohop set <time>
}
else echo $color(info) * /autohop: insufficient parameters
}