All pastes #752132 Raw Edit

Poll Script

public text v1 · immutable
#752132 ·published 2007-10-28 01:54 UTC
rendered paste body
on *:text:!poll *:#: {
  set %gpoll on
  amsg Global Poll started by $nick $+ . $$2- $+ ? Type !yes to answer yes and !no to answer no.
  timer 1 60 amsg Global Poll Results: %pollyes Yes's and %pollno No's.
  unset %pollyes
  unset %pollno
  unset %gpoll
}
on *:text:!yes *:#: {
  if (%poll == on) {
    if (%pollnick. [ $+ [ $nick ] ] != yes) {
      set %pollnick. [ $+ [ $nick ] ] yes 
      inc %pollyes 1
      notice $nick Thank you $nick for your vote.
      unset %pollnick. [ $+ [ $nick ] ]
    }
    else {
      notice $nick Please refrain from voting twice.
    }
  }
}
on *:text:!no *:#: {
  if (%gpoll == on) {
    set %pollnick. [ $+ [ $nick ] ] no
    if (%pollnick. [ $+ [ $nick ] ] != no) {
      inc %pollno 1
      notice $nick Thank you $nick for you vote.
      unset %pollnick. [ $+ [ $nick ] ]
    }
    else{
    notice $nick Please refrain from voting twice..
  }
}