All pastes #130717 Raw Edit

Anonymous

public text v1 · immutable
#130717 ·published 2006-08-14 04:38 UTC
rendered paste body
on *:TEXT:!poll*:#:{
  if ($2 isnum) {
    msg $chan 3 $+ $nick has started a poll:4 $3- 
    msg $chan 12 Vote will last for $2 minutes.
    msg $chan 3Type 12!yes or !no 3to count your vote.
    set %yes 0 | set %no 0 | unset %*.poll
    /timerVOTE 0 $calc($2 * 60) /signal -n results
  }
  else {
    msg $chan 3 $+ $nick has started a poll:4 $2- 
    msg $chan 12 Vote will last for 2 minutes.
    msg $chan 3Type !yes, or !no to count your vote.
    set %yes 0 | set %no 0 | unset %*.poll
    /timerVOTE 0 120 /signal -n results
  }
}
on *:text:!yes:#:{
  if (% [ $+ [ $nick $+ .poll ] ] == $null) { /set % [ $+ [ $nick $+ .poll ] ] 1 | .notice $nick Thank you for your vote, Yes has been counted! | inc %yes 1 }
  elseif (% [ $+ [ $nick $+ .poll ] ] == 2) { .notice $nick You're vote has been changed to yes! | inc %yes 1 | dec %no 1 | /set % [ $+ [ $nick $+ .poll ] ] 1 }
  elseif (% [ $+ [ $nick $+ .poll ] ] == 1) { .notice $nick You've already voted yes! }
}
on *:text:!no:#:{
  if (% [ $+ [ $nick $+ .poll ] ] == $null) { /set % [ $+ [ $nick $+ .poll ] ] 2 | .notice $nick Thank you for your vote, No has been counted! | inc %no 1 }
  elseif (% [ $+ [ $nick $+ .poll ] ] == 1) { .notice $nick You're vote has been changed to no! | inc %no 1 | dec %yes 1 | /set % [ $+ [ $nick $+ .poll ] ] 2 }
  elseif (% [ $+ [ $nick $+ .poll ] ] == 2) { .notice $nick You've already voted no! }
}
on *:TEXT:!endpoll:#:{
  /msg $chan 4The poll has been ended by $nick $+ .  The answer is $iif($(%yes,2) > $(%no,2),11Yes!,$iif($(%yes,2) == $(%no,2),11Tie/No Votes!,11No!)) $+
  /msg $chan 3Results: 
  /msg $chan 7Yes: $ceil($calc((%yes / (%yes + %no)) * 100)) $+ %
  /msg $chan 7No: $ceil($calc((%no / (%yes + %no)) * 100)) $+ %
  timerVOTE off
  unset %yes | unset %no
}
on *:SIGNAL:results:{
  /msg $chan 4The poll has ended. The answer is $iif($(%yes,2) > $(%no,2),11Yes!,$iif($(%yes,2) == $(%no,2),11Tie/No Votes!,11No!)) $+
  /msg $chan 3Results: 
  /msg $chan 7Yes: $ceil($calc((%yes / (%yes + %no)) * 100)) $+ %
  /msg $chan 7No: $ceil($calc((%no / (%yes + %no)) * 100)) $+ %
  unset %yes | unset %no
}