All pastes #130571 Raw Edit

Stuff

public text v1 · immutable
#130571 ·published 2006-08-14 02:12 UTC
rendered paste body
on *:TEXT:!poll*:#:{
  if ($2 isnum) {
    msg $chan $nick has started a poll: $3- for $2 minutes.
    msg $chan Type !vote yes, or !vote no to count your vote.
    set %yes 0 | set %no 0
    /timerVOTE 1 $calc($2 * 60) signal -n results $chan
   }
   else {
   msg $chan $nick has started a poll: $3- for 2 minutes.
   msg $chan Type !vote yes, or !vote no to count your vote.
   set %yes 0 | set %no 0
  /timerVOTE 1 120 signal -n results $chan
}
}
on *:text:!yes:#:{
.notice $nick Thank you for your vote, Yes has been counted!
inc %yes 1
}
on *:text:!no:#:{
.notice $nick Thank you for your vote, Yes has been counted!
inc %no 1
}
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
}