on *:TEXT:!vote &:#: {
if ($nick isop #) {
if ($2 == start) {
if ($timer(voting)) msg $chan Cancelling previous vote..
.timervoting 1 60 votedone $unsafe($chan)
unset %voteA %voteB %voteC %voteD
msg $chan Vote has been activated!
var %opok 1
}
elseif ($2 == stop) {
if ($timer(voting)) msg $chan Cancelling previous vote
unset %voteA %voteB %voteC %voteD
var %opok 1
}
}
if (!%opok) && ($timer(voting)) && ($1 isincs ABCD) && (!$istok(%voteA %voteB %voteC %voteD,$nick,32)) {
set %vote $+ $1 $($+(%,vote,$1),2) $nick
msg $chan nick Voted $1
}
}
alias votedone {
var %chan $1, %w $gettok($sorttok($+(%voteA,.A@,%voteB,.B@,%voteC,.C@,%voteD,.D),64,n),1,64)
tokenize 46 %w
msg %chan winner is $2 with $numtok($1,32) vote, participants for $2: $1
}