Poll Feature

By Wanabepc on Aug 20, 2009

Hey all,

This is my second snippet post. I have made a Poll System that only Ops can start and end the poll and users may only vote once per poll.

The commands are;

!startpoll (ops only) Creates ans Starts the poll
!voteyes = To vote Yes
!voteno = To vote No
!poll = Brings the Poll's question up
!results = Shows the user the results only if they have voted
!endpoll = (ops only) Ends the Poll

Anyone may use this and edit it to how they like.

Like my other Script this is desiged to work with my bot who is called TheChill, feel free to put your bots name in here or your name.

All constructive critisim is welcome, if you find any bugs leave a comment and I will try and fix them.

on *:TEXT:!startpoll*:#: {
  if ($me == thechill && $nick !isop #) { notice $nick Only Admins can use this command!
  }
  if ($me == thechill && $nick isop # && %pollq != $null) { notice $nick there is already a poll in progress 
  }
  if ($me == thechill && $nick isop # && %pollq == $null && $2- == $null) { notice $nick Please use the correct syntax, as in !startpoll <question> 
  }
  if ($me == thechill && $nick isop # && %pollq == $null && $2- != $null) {
    msg $chan 4 A poll has started for: $2- 
    msg $chan Use !voteyes for yes or !voteno for no, you may only vote once
    set %pollq $2-
    set %polly 0
  set %polln 0 }
}
on *:TEXT:!voteyes:#: {
  if ($me == thechill && %pollq == $null) { notice $nick There is no poll on at this time 
  }
  if ($me == thechill && %pollq != $null && $address isin %voter) { notice $nick you have already voted in this poll
  }
  if ($me == thechill && $address !isin %voter) {
    notice $nick Thanks for the vote of Yes
    inc %polly 
  /set %voter $addtok(%voter,$address,32) }
}
on *:TEXT:!voteno:#: {
  if ($me == thechill && %pollq == $null) { notice $nick There is no poll on at this time 
  }
  if ($me == thechill && %pollq != $null && $address isin %voter) { notice $nick you have already voted in this poll
  }
  if ($me == thechill && $address !isin %voter) {
    notice $nick Thanks for the vote of No
    inc %polln 
  /set %voter $addtok(%voter,$address,32) }
}
on *:TEXT:!poll:#: { 
  if ($me == thechill && %pollq == $null) { notice $nick there is no poll in progress at this time
  }
  if ($me == thechill && %pollq != $null) {
    notice $nick The current poll question is; %pollq
  notice $nick Use !voteyes for yes or !voteno for no, you may only vote once }
}
on *:TEXT:!results:#: {
  if ($me == thechill && $address !isin %voter) { notice $nick you need to vote before seeing the results 
  }
  if ($me == thechill && $address isin %voter) {
    notice $nick for the Poll; %poll the votes stand at;
    notice $nick Yes: %polly
  notice $nick No: %polln } 
}
on *:TEXT:!endpoll*:#: {
  if ($me == thechill && $nick !isop #) { notice $nick Only Admins can use this command!
  }
  if ($me == thechill && %pollq == $null) { notice $nick There is no poll to end at this time
  }
  if ($me == thechill && $nick isop # && %pollq != $null) {
    msg $chan 4 The Poll has now ended for the question: %pollq and the results are;
    msg $chan 4 Yes: %polly
    msg $chan 4 No: %polln
  } 
  if ($me == thechill && %pollq != $null && %polly < %polln) { 
    msg $chan 4 The Winning Answer is No with %polln points 
  }
  if ($me == thechill && %pollq != $null && %polln < %polly) {
    msg $chan 4 The Winning Answer is Yes with %polly points
  }
  if ($me == thechill && %pollq != $null && %polln == %polly) {
    msg $chan 4 We have a Tie, the admin will now decide the answer! 
  }
  unset %pollq
  unset %polly
  unset %polln
  unset %voter
}

Comments

Sign in to comment.
dmarksbarber   -  Nov 27, 2012

Does this work on multiple channels?

 Respond  
Heng_Sky   -  Dec 25, 2009

Hello m new for script can u teach me how to write script of how to set script if i have it done]

 Respond  
Wanabepc   -  Sep 08, 2009

Thanks for telling me that you are editing the script.

Rgds

Wanabepc

 Respond  
Esjay   -  Sep 05, 2009

I decided to do a little bit of a help feature for people who forget easily, or are new. If you want to include it, use this,
on *:TEXT:!poll help:#: { notice $nick !startpoll (ops only) Creates and starts the poll | notice $nick !voteyes = To vote Yes |

and you have to type !poll help

 Respond  
Wanabepc   -  Aug 23, 2009

Thanks for the feedback!

And thanks for letting me know that you made some changes. Hope you enjoy :)

 Respond  
slub77   -  Aug 23, 2009

Dude great work there :D

Suggestion would be to make a pop up menu allowing you to turn off the poll or allow the poll to be used.

I changed all the notice to msg and $nick to chan that way it simpler and i got rid of colour as most of the channels i use do not allow colour as one of the modes :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.