rendered paste bodyon *:text:!vote*:##mirc: {
if ($nick == r0ad_2_h3ll ) || ($nick isop $chan) {
if (!$2 || $chr(63) !isin $2-) { .notice $nick Command incomplete. Syntax: !vote <question>? | halt }
if (%vote [ $+ [ $chan ] ]) { msg $chan A vote is currently held. | halt }
set %vote [ $+ [ $chan ] ] $2-
msg $chan Please vote! Question: $2-
msg $chan To vote please use 3Yes or 5No. You have 35 seconds to do so.
.timer 1 35 _vote $chan
}
}
on *:text:yes:##mirc: {
if (%vote [ $+ [ $chan ] ]) {
if (%voted- [ $+ [ $chan ] ] [ $+ [ $nick ] ]) { notice $nick You have already voted | halt }
inc %yes [ $+ [ $chan ] ]
set -u35 %voted- [ $+ [ $chan ] ] [ $+ [ $nick ] ] Yes
notice $nick Thank you for voting.
}
}
on *:text:no:##mirc: {
if (%vote [ $+ [ $chan ] ]) {
if (%voted- [ $+ [ $chan ] ] [ $+ [ $nick ] ]) { notice $nick You have already voted | halt }
inc %no [ $+ [ $chan ] ]
set -u35 %voted- [ $+ [ $chan ] ] [ $+ [ $nick ] ] No
}
}
alias _vote {
;Syntax: /_vote <#channel>
;Action: displays vote results for <#channel>
var %yes %yes [ $+ [ $1 ] ], %no %no [ $+ [ $1 ] ], %total $calc(%yes + %no), %yes-p $round($calc(%yes / %total * 100),2), %no-p $round($calc(%no / %total * 100),2)
msg $$1 Vote is over! Question was: %vote [ $+ [ $1 ] ]
msg $1 [7Total votes $+ $iif(%total == $null,0,%total) $+ ] 3Yes $+ $iif(%yes == $null,0,%yes) $+ ( $+ %yes-p $+ $chr(37) $+ ) 5No $+ $iif(%no == $null,0,%no) $+ ( $+ %no-p $+ $chr(37) $+ )
unset %vote [ $+ [ $1 ] ] %no [ $+ [ $1 ] ] %yes [ $+ [ $1 ] ]
}