All pastes #162465 Raw Edit

Mine

public text v1 · immutable
·published 2006-09-06 15:26 UTC
rendered paste body
on *:text:!setpoll *:#shinzaki:{
  if ($+(%,poll,.,$chan,.,question) != $null) { .notice $nick There is a poll running }  
  else {
    if (($nick isop $chan) && ($+(%,poll,.,$chan,.,question) == $null)) {
      set $+(%,poll,.,$chan,.,question) $2-
      msg $chan 7 A new Poll has been started. The current question is 5 $2- $+ . 7To see the poll again, and your options for voting, type !poll
    }
  }
}
on *:text:!poll:#shinzaki:{
  if ($+(%,poll,.,$chan,.,question) != $null) {
    .notice $nick Question: $+(%,poll,.,$chan,.,question)
    .notice $nick If you vote yes, please type !vote yes
    .notice $nick If you vote no, please type !vote no
  }
  else { .notice $nick there is no poll running in $chan $+ . }
}
on *:text:!vote*:#shinzaki:{
  if ($+(%,poll,.,$chan,.,$nick) == $null) {
    If (($2 == yes) || ($2 == no)) { set $+(%,poll,.,$chan,.,$nick) VOTED }
    else { halt }
    if ($2 == yes) {
      if ($+(%,poll,.,$chan,.,yes) == $null) { set $+(%,poll,.,$chan,.,yes) 0 }
      if ($+(%,poll,.,$chan,.,no) == $null) { set $+(%,poll,.,$chan,.,no) 0 }
      inc $+(%,poll,.,$chan,.,yes) 1
      .notice $nick Your answer has been recorded. You voted $2
    }
    if ($2 == no) { 
      if ($+(%,poll,.,$chan,.,no) == $null) { set $+(%,poll,.,$chan,.,no) 0 }
      if ($+(%,poll,.,$chan,.,yes) == $null) { set $+(%,poll,.,$chan,.,yes) 0 }
      inc $+(%,poll,.,$chan,.,no) 1
      .notice $nick Your answer has been Recorded. You voted $2
    }
  }
  else { .notice $nick You have already voted in this Poll }
}
 
on *:text:!stoppoll:#shinzaki:{
  if ($+(%,poll,.,$chan,.,question) != $null) {
    if ($nick isop $chan) {
      msg $chan These where the results of the Poll: Yes Votes: $($+(%,poll,.,$chan,.,yes),2) No Votes: $($+(%,poll,.,$chan,.,no),2)
      unset %poll [ $+ [ $chan ] $+ ]
    }
    else { .notice $nick you need to be a channel operater to use this function. }
  }
  else { .notice $nick how can you stop a poll which isn't running? }
}
on *:text:!pollresults:#shinzaki: { 
  msg $chan 13These are the current results of the running poll (Current poll: $($+(%,poll,.,$chan,.,question)))
  msg $chan Yes Votes: $($+(%,poll,.,$chan,.,yes),2) No Votes: $($+(%,poll,.,$chan,.,no),2)
  if ($nick isop $chan) {
    notice $nick To stop the running Poll, type !stoppoll
  }
}