on *:TEXT:!poll*:#:{ if ($nick isop $chan) { msg $chan $nick 3has started a poll: $3- for $2 minutes. msg $chan Type 3!vote yes, or !vote no to count your vote. set %yes 0 | set %no 0 | unset %voted /timerVOTE 1 $calc($2 * 60) signal -n results $chan } else { .notice $nick Only OPs can trigger votes. } } on *:text:!yes:#:{ if ($address($nick,3) $+ * iswm %voted) { .notice $nick You have already voted. | halt } if ($timer(VOTE)) { .notice $nick Thank you for your vote, Yes has been counted! inc %yes 1 set %voted %voted $address($nick,3) } else { .notice $nick There is currently no vote in progress. } } on *:text:!no:#:{ if ($address($nick,3) $+ * iswm %voted) { .notice $nick You have already voted. | halt } if ($timer(VOTE)) { .notice $nick Thank you for your vote, No has been counted! inc %no 1 set %voted %voted $address($nick,3) } else { .notice $nick There is currently no vote in progress. } } on *:TEXT:!endpoll:#:{ if (($timer(VOTE)) && ($nick isop $chan)) { msg $chan The poll has been ended by $nick $+ . The answer is $iif($(%yes,2) > $(%no,2),yes,$iif($(%yes,2) == $(%no,2),tie/no votes,no)) $+ msg $chan Results: Yes: %yes $ceil($calc((%yes) /(%yes + %no) * 100)) $+ % msg $chan No: %no $ceil($calc((%no) /(%yes + %no) * 100)) $+ % timerVOTE off } } on *:SIGNAL:results: { /msg $1 The poll has ended. The answer is $iif($(%yes,2) > $(%no,2),yes,$iif($(%yes,2) == $(%no,2),tie/no votes,no)) $+ Results: Yes: %yes $ceil($calc((%yes) /(%yes + %no) * 100)) $+ % No: %no $ceil($calc((%no) /(%yes + %no) * 100)) $+ % unset %yes | unset %no }