on @!*:join:#:{
if ($+(%,autovoice,.,$chan) == $chan) { .mode # +v $nick }
on me:*:join:#:{
unset $+(%,autovoice,.,$chan)
on 1000:text:.av:#:{
set $+(%,autovoice,.,$chan) $iif(!$($+(%,autovoice,.,$chan),2),$chan,$false)
.notice $nick Auto-Voice for $chan is $iif(!$($+(%,autovoice,.,$chan),2),on,off)

That should resolve the problems you mentioned with my code. Your current code is almost identical to the code you started with. The code defaults to an off position when you join a channel, but once on, it stays on until you turn it off or leave the channel.