All pastes #130944 Raw Edit

Untitled

public text v1 · immutable
#130944 ·published 2006-08-14 07:24 UTC
rendered paste body
on *:TEXT:!poll*:#:{
  if (%poll.running == true) {
    .notice $nick Poll is already runnning on %chan $+ !
    /halt
  }  
  set %poll.running true  
  set %poll.starter $nick
  set %chan $chan
  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 1 $calc($2 * 60) /end
  }
  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 1 120 /end
  }
}
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:#:{
  if (%poll.running == false) {
    .notice $nick No poll is running!
    /halt
  }
  if ($nick == %poll.starter) {
    /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: %yes - $ceil($calc((%yes / (%yes + %no)) * 100)) $+ %
    /msg $chan 7No: %no - $ceil($calc((%no / (%yes + %no)) * 100)) $+ %
    timerVOTE off
    unset %yes | unset %no | set %poll.running false
  }
  else { .notice $nick You don't have permission to end this poll! }
}
alias -l end {
  /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: %yes - $ceil($calc((%yes / (%yes + %no)) * 100)) $+ %
  /msg %chan 7No: %no - $ceil($calc((%no / (%yes + %no)) * 100)) $+ %
  unset %yes | unset %no | set %poll.running false
}