All pastes #249480 Raw Edit

Something

public text v1 · immutable
#249480 ·published 2006-11-15 20:42 UTC
rendered paste body
alias resultyes { return %pollyes }
alias resultno { return %pollno }


on *:text:!gpoll *:#: {
  unset %poll*
  set -u60 %gpoll on
  amsg Global Poll started by $nick $+ . $$2- $+ ? Type !yes to answer yes and !no to answer no.
  timer 1 60 amsg Yes: $!resultyes No: $!resultno
}
on *:text:!yes*:#: {
  if (%gpoll == on) {
    if (%pollnick. [ $+ [ $nick ] ] == $null) {
      set %pollnick. [ $+ [ $nick ] ] yes 
      inc %pollyes
      notice $nick Thank you $nick for your vote.
    }
    else {
      notice $nick Please refrain from voting twice.
    }
  }
}
on *:text:!no*:#: {
  if (%gpoll == on) {
    if (%pollnick. [ $+ [ $nick ] ]  == $null) {
      set %pollnick. [ $+ [ $nick ] ] yes 
      inc %pollno
      notice $nick Thank you $nick for your vote.
    }
    else {
      notice $nick Please refrain from voting twice.
    }
  }
}