All pastes #131219 Raw Edit

Untitled

public text v1 · immutable
#131219 ·published 2006-08-14 12:05 UTC
rendered paste body
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
    /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
}