Sorry, I kinda rushed this..

[18:09] <Vote> Type !result to view the poll results.
[18:09] <me> !result
[18:09] <Vote> 5 people voted...
[18:09] <Vote> Andy voted No
[18:09] <Vote> mairi voted Yes
[18:09] <Vote> me voted Yes
[18:09] <Vote> betty voted No
[18:09] <Vote> Donna voted Yes

Code:
alias votes {
  if ($group(#votes) == on) { 
    echo -a Voting game already on. 
  }
  elseif ($group(#votes) == off) { 
    if ($active ischan) {
      set %vote.chan $chan    
      set %vote.question $$1-
      .enable #votes
      msg %vote.chan Voting started.
      msg %vote.chan Question: %vote.question
      msg %vote.chan Type either !vote yes or !vote no.
      msg %vote.chan You have 5 minutes starting now!
      vote.init
    }
  }
}

alias vote.init {
  .timer 1 60 msg %vote.chan You have 4 minutes remaining.
  .timer 1 120 msg %vote.chan You have 3 minutes remaining.
  .timer 1 180 msg %vote.chan You have 2 minutes remaining.
  .timer 1 240 msg %vote.chan You have 1 minute remaining.  Hurry!!
  .timer 1 300 msg %vote.chan Your time is up!
  .timer 1 302 msg %vote.chan Type !result to view the poll results.
}

#votes off
on 1:Text:!vote *:%vote.chan: {
  if (!$hget(votes)) { hmake votes 1000 } 
  if (yes == $2) {
    if ($hfind(votes,$nick)) {
      .notice $nick You have already voted, don't be greedy. 
    }
    elseif (!$hfind(votes,$nick)) { 
      .notice $nick Your vote has been casted. 
      hadd votes $nick Yes 
    }
  }
  if (no == $2) {
    if ($hfind(votes,$nick)) {
      .notice $nick You have already voted, don't be greedy.
    }
    elseif (!$hfind(votes,$nick)) {
      .notice $nick Your vote has been casted. 
      hadd votes $nick No 
    }
  }
}

on 1:Text:!result*:%vote.chan: {
  var %result = $hget(votes,0).item
  msg %vote.chan %result people voted...
  while (%result) {
    msg %vote.chan $hget(votes,%result).item voted $hget(votes,%result).data
    dec %result
  }
  .hfree votes
  .disable #votes
  unset %vote.*
} 
#votes end

Last edited by SladeKraven; 01/03/05 06:11 PM.