All pastes #928105 Raw Edit

Something

public text v1 · immutable
·published 2008-03-04 20:22 UTC
rendered paste body
alias results { return Yes: %vyes $+ , No: %vno }
on *:TEXT:!mbvote *:#: { if (%votestatus. [ $+ [ $chan ] ] != $null) && (%voteon. [ $+ [ $chan ] ] == 1) {
    notice $nick A vote has already in progress.
  }
  elseif (!$2) && (%voteon. [ $+ [ $chan ] ] == 0) {
    notice $nick You must specify a question.
  }
  elseif (%votestatus. [ $+ [ $chan ] ] == $null) && (%voteon. [ $+ [ $chan ] ] == 1) {
    set %vote $2-
    set %votestatus. [ $+ [ $chan ] ] 1
    set %vyes 0
    set %vno 0
    msg $chan 12 $+ $nick wants to vote! Type !mbvyes or !mbvno to take part, the vote will last 30 seconds.
    msg $chan 12The question is: %vote
    timer 1 30 msg $chan 4The conclusion of the vote %vote are: $!results
    timer 1 30 unset %vyes
    timer 1 30 unset %vno
    timer 1 30 unset %votestatus.*
    unset %voted.*
  }
}
on *:TEXT:!mbvyes:#: { if (%votestatus. [ $+ [ $chan ] ] != $null) && (%voteon. [ $+ [ $chan ] ] == 1) && (%voted. [ $+ [ $nick ] ] == $null) {
    set %voted. [ $+ [ $nick ] ] 1
    inc %vyes 1
    notice $nick 3Thank you, your vote has been placed.
  }
  elseif (%votestatus. [ $+ [ $chan ] ] == $null) && (%voteon. [ $+ [ $chan ] ] == 1) {
    notice $nick 10There is no vote, if you would like to start one type !mbvote <question>
  }
  elseif (%voted. [ $+ [ $nick ] ] == 1) && (%votestatus. [ $+ [ $chan ] ] != $null) && (%voteon. [ $+ [ $chan ] ] == 1) {
    notice $nick 4You have already voted!
    halt
  }
}
on *:TEXT:!mbvno:#: { if (%votestatus. [ $+ [ $chan ] ] != $null) && (%voteon. [ $+ [ $chan ] ] == 1) && (%voted. [ $+ [ $nick ] ] == $null) {
    set %voted. [ $+ [ $nick ] ] 1
    inc %vno 1
    notice $nick 3 Thank you, your vote has been placed.
  }
  elseif (%votestatus. [ $+ [ $chan ] ] == $null) && (%voteon. [ $+ [ $chan ] ] == 1) {
    notice $nick 10There is no vote, if you would like to start one type !mbvote <question>
  }
  elseif (%voted. [ $+ [ $nick ] ] == 1) (%votestatus. [ $+ [ $chan ] ] != $null) && (%voteon. [ $+ [ $chan ] ] == 1) {
    notice $nick 4You have already voted!
    halt
  }
}
on *:TEXT:!mbvoteoff:#: { if ($nick == Mosher_Stevo) || ($nick == [-NightHawk-]) || ($nick isop $chan) {
    unset %votestatus.*
    set %voteon. [ $+ [ $chan ] ] 0
    msg $chan 4Votes are now off!
  }
}
on *:TEXT:!mbvoteon:#: { if ($nick == Mosher_Stevo) || ($nick == [-NightHawk-]) || ($nick isop $chan) {
    set %voteon. [ $+ [ $chan ] ] 1
    msg $chan 3Votes are now on!
  }
}