this is a script i made that allows people in seperate channels to make a vote/poll and vote on it, at the end when you choose to end it, it shows the results :)
just type !addvote then add the posible answers with the !addoption"1,2 or 3"
then you can vote by typing !vote "1,2 or 3"
to show the final result type !vresults.
i dont mind people changing/altering it to make it better.
iv checked the script as much as i can but please remember i am quite new with scripting, only been doing it about a month so if you find a bug please tell me, thanks and i hope you enjoy.
commands;
!addvote <vote/poll here>
!addoption1
!addoption2
!addoption3
!startvote - starts the vote
!stopvote - stops the vote (does NOT show results, just resets variables)
!vote 1 - vote for option one
!vote 2 - vote for option two
!vote 3 - vote for option three
!vresults - stops the votes and shows the results.
!vote 3 wasent working, FIXED. XD
####
;vote script by n_y_f_i
;commands
; !addvote <vote/poll here>
; !addoption1 <first posible vote>
; !addoption2 <second posible vote>
; !addoption3 <thrid posible vote>
; !startvote - starts the vote
; !stopvote - stops the vote (does NOT show results, just resets variables)
; !vote 1 - vote for option one
; !vote 2 - vote for option two
; !vote 3 - vote for option three
; !vresults - stops the votes and shows the results.
####
alias -l c1 { return $+($chr(3),12,$1-) }
alias -l c2 { return $+($chr(3),04,$1-) }
on *:text:!addvote*:#: {
if ($2- == $null) {
notice $nick $c1 you need to enter a vote question.
halt
else
}
if ($nick isop $chan || $nick ishop $chan) {
set %vote.setting [ $+ [ $chan ] ] ON
set %vote.nick [ $+ [ $chan ] ] $nick
set %vote.question [ $+ [ $chan ] ] $2-
notice $nick $c1 thanks for setting a vote, please now type $c2 !addoption1 <vote option one>, !addoption2 <vote option two>, !addoption3 <vote option three> $c1 $+ .
}
}
on *:text:!addoption1*:#: {
if ($2- == $null) && (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 you need to add a first vote option.
halt
else
}
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
set %vote.option1 [ $+ [ $chan ] ] $2-
notice $nick $c1 thanks, your first vote option has been added.
}
}
on *:text:!addoption2*:#: {
if ($2- == $null) && (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 you need to add a second vote option.
halt
else
}
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
set %vote.option2 [ $+ [ $chan ] ] $2-
notice $nick $c1 thanks, your second vote option has been added.
}
}
on *:text:!addoption3*:#: {
if ($2- == $null) && (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 you need to add a third vote option.
halt
else
}
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
set %vote.option3 [ $+ [ $chan ] ] $2-
notice $nick $c1 thanks, your third vote option has been added.
}
}
on *:text:!startvote*:#: {
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
msg $chan $c1 a vote has been set up for $c2 $chan $+ ! $c1 the vote is: $c2 %vote.question [ $+ [ $chan ] ]
the options for the vote are;
set %vote.1 [ $+ [ $chan ] ] 0
set %vote.2 [ $+ [ $chan ] ] 0
set %vote.3 [ $+ [ $chan ] ] 0
timer 1 1 msg $chan $c1 option one is: $c2 %vote.option1 [ $+ [ $chan ] ]
timer 1 3 msg $chan $c1 option two is: $c2 %vote.option2 [ $+ [ $chan ] ]
timer 1 2 msg $chan $c1 option three is: $c2 %vote.option3 [ $+ [ $chan ] ]
}
}
on *:text:!stopvote*:#: {
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
unset %vote.option1 [ $+ [ $chan ] ]
unset %vote.option2 [ $+ [ $chan ] ]
unset %vote.option3 [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
unset %vote.nick [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
set %vote.setting [ $+ [ $chan ] ] OFF
msg $chan $c1 vote has been stoped by $c2 $nick $+ !
}
}
on *:text:!vote 1*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c1 you can only vote once every $c2 10 $c1 minutes even if it is a different poll, sorry.
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 thanks, your vote has been counted.
inc %vote.1 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
timer 1 600 /unset %voted. [ $+ [ $chan ] ]
}
}
on *:text:!vote 2*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c1 you can only vote once every $c2 10 $c1 minutes even if it is a different poll, sorry.
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 thanks, your vote has been counted.
inc %vote.2 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
timer 1 600 /unset %voted. [ $+ [ $chan ] ]
}
}
on *:text:!vote 3*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c1 you can only vote once every $c2 10 $c1 minutes even if it is a different poll, sorry.
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 thanks, your vote has been counted.
inc %vote.3 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
timer 1 600 /unset %voted. [ $+ [ $chan ] ]
}
}
on *:text:!vresult*:#: {
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
msg $chan $c1 votes are now $c2 CLOSED.
timer1 1 1 msg $chan $c1 results for vote: $c2 %vote.question [ $+ [ $chan ] ]
timer2 1 3 msg $chan $c1 first option: $c2 %vote.option1 [ $+ [ $chan ] ]
timer3 1 5 msg $chan $c1 result: $c2 %vote.1 [ $+ [ $chan ] ]
timer4 1 7 msg $chan $c1 second option: $c2 %vote.option2 [ $+ [ $chan ] ]
timer5 1 9 msg $chan $c1 result: $c2 %vote.2 [ $+ [ $chan ] ]
timer6 1 11 msg $chan $c1 third option: $c2 %vote.option3 [ $+ [ $chan ] ]
timer7 1 13 msg $chan $c1 result: $c2 %vote.3 [ $+ [ $chan ] ]
unset %vote.option1 [ $+ [ $chan ] ]
unset %vote.option2 [ $+ [ $chan ] ]
unset %vote.option3 [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
unset %vote.nick [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
set %vote.setting [ $+ [ $chan ] ] OFF
}
}
on :text:!startvote:#: {
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
msg $chan $c1 a vote has been set up for $c2 $chan $+ ! $c1 the vote is: $c2 %vote.question [ $+ [ $chan ] ]
the options for the vote are;
set %vote.1 [ $+ [ $chan ] ] 0
set %vote.2 [ $+ [ $chan ] ] 0
set %vote.3 [ $+ [ $chan ] ] 0
timer 1 1 msg $chan $c1 option one is: $c2 %vote.option1 [ $+ [ $chan ] ]
timer 1 3 msg $chan $c1 option two is: $c2 %vote.option2 [ $+ [ $chan ] ]
timer 1 2 msg $chan $c1 option three is: $c2 %vote.option3 [ $+ [ $chan ] ]
}
}
For here I suggest putting an if vote.question == $null it should notice the person that they must type !addvote first.
I was trying to do this myself but failed. I kept getting if insufficent peramiters. If you or someone else could do it that would be great.
Other then that great script I love it.
it is limited to who can make the votes, notice the !addvote part, it will only set %vote.nick if the person is halfop/op in the channel, therfore if not, they cannot access the rest of the script apart from the !vote\'s, and thanks for positive comment, iv fixed the typo, sorry, it was ment to be third.
Isn\'t this line:
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
set %vote.option3 [ $+ [ $chan ] ] $2-
notice $nick $c1 thanks, your second vote option has been added.
meant to be:
notice $nick $c1 thanks, your third vote option has been added
since its set %vote option 3?
I like the anti-spam/ anti-flood built in by limiting votes... good move. Maybe limiting who has access to create the voting options might be good...