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
}