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) %ja ( $+ $calc(%ja / $calc(%ja + %nej) * 100) $+ % $+ ),yes $+ $chr(58) 0 (0%))):{ .echo -q bla }
..$iif(%votening,$iif(%nej,no $+ $chr(58) %nej ( $+ $calc(%nej / $calc(%nej + %ja) * 100) $+ % $+ ),no $+ $chr(58) 0 (0%))):{ .echo -q bla }
}
alias vote {
if (%vote) { kte_echo -a there is allready 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,stem)
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 til
}
}
alias voteoff {
msg %votechan vote is over!
msg %votechan questionl: $+ %vote $+
msg %votechan result: yes: %ja ( $+ $calc(%ja / $calc(%ja + %nej) * 100) $+ % $+ ) no: %nej ( $+ $calc(%nej / $calc(%ja + %nej) * 100) $+ % $+ )
msg %votechan voters: $iif(%votere,%votere,ingen..)
if (!%nej && !%ja) { msg %votechan pluralis: no one voted.. }
elseif (%nej == %ja) { msg %votechan pluralis: draw! }
elseif (%nej > %ja) { msg %votechan pluralis: no! }
elseif (%nej < %ja) { msg %votechan pluralis: yes! }
unset %vote* %ja %nej
}
on *:text:!yes:#: {
if (# == %votechan) && (%votening == til) {
if ($nick isin %votere) { return }
set %votere %votere $nick (yes)
notice %votere thx for the vote $nick $+ !
inc %ja 1
}
}
on *:text:!no:#: {
if (# == %votechan) && (%votening == til) {
if ($nick isin %votere) { return }
set %votere %votere $nick (nej)
notice %votere thx for the vote $nick $+ !
inc %nej 1
}