rendered paste bodymenu channel {
vote
.$iif(!%votening,start vote):vote
.$iif(%votening,stop vote):voteoff
.-
..$iif(%votening,status)
..$iif(%votening,$iif(%ja,yes $+ $chr(58) %yes ( $+ $calc(%yes / $calc(%yes + %no) * 100) $+ % $+ ),yes $+ $chr(58) 0 (0%))):{ .echo -q bla }
..$iif(%votening,$iif(%nej,no $+ $chr(58) %no ( $+ $calc(%no / $calc(%no + %yes) * 100) $+ % $+ ),no $+ $chr(58) 0 (0%))):{ .echo -q bla }
}
alias vote {
if (%vote) { kte_echo -a There is already a vote in progress. | return }
if (!$server) { kte_echo -a Not connected. | return }
if ($active == Status Window) { kte_echo -a Not in status. | return }
set %votechan #
set %vote $input(what do you want to vote about?,1,Vote option)
if (!%vote) { halt }
else {
set %ja 0
set %nej 0
msg %votechan Time to vote!
msg %votechan (vote with !yes and !no)
msg %votechan question: $+ %vote $+
set %votening till
}
}
alias voteoff {
msg %votechan Vote is over!
msg %votechan questionl: $+ %vote $+
msg %votechan result: yes: %yes ( $+ $calc(%yes / $calc(%yes + %no) * 100) $+ % $+ ) no: %no ( $+ $calc(%no / $calc(%yes + %no) * 100) $+ % $+ )
msg %votechan voters: $if(%votere,%votere,ingen..)
if (!%no && !%yes) { msg %votechan pluralis: no one voted.. }
elseif (%nej == %yes) { msg %votechan pluralis: draw! }
elseif (%nej > %yes) { msg %votechan pluralis: no! }
elseif (%nej < %yes) { msg %votechan pluralis: yes! }
unset %vote* %yes %no
}
on *:text:!yes:#: {
if (# == %votechan) && (%votening == til) {
if ($nick isn't %votere) { return }
set %votere %votere $nick (yes)
notice %votere Thanks for voting! $nick $+ !
inc %yes 1
}
}
on *:text:!no:#: {
if (# == %votechan) && (%votening == til) {
if ($nick isn't %votere) { return }
set %votere %votere $nick (no)
notice %votere Thanks for voting! $nick $+ !
inc %no 1
}
}