Hello.
This is a script which i modified for my personal use.
I found this script http://www.hawkee.com/snippet/2660/ by nify who originally posted it 5 years ago.
Since it was good script but didn't had everything i needed, i modified it.
It is a script that allows people in seperate channels to make a vote/poll and vote on it, at the end it shows the results
The commands are :
!addvote
!addoption(1-5)
!startvote - starts the vote
!stopvote - stops the vote (does NOT show results, just resets variables)
!vote(1-5) - vote for option (1-5)
!vresults - stops the votes and shows the results.
!vHelp - Shows help dialog.
The script by itself has a timer when its supposed to end, but if you sometime don't want to wait the timer to end in order to see the results just type !vresults - which stops the votes and shows the result.
Thanks to nify who made this long time ago.
My Modifications :
I want this to be perfect script since it's my first work for www.hawkee.com so i will continue editing.
Last edit which i want to add is to not have fixed number of voting options and instead of that to have possibility to add number of voting options with a command.
Well, i would need help for that so if someone wants to help me i would appreciate it!!
Have a nice day!!
####
;Modified Voting Script by Dashovski
;commands
; !addvote <time-seconds> <vote/poll here>
; !addoption(1-5) <vote option>
; !startvote - starts the vote
; !stopvote - stops the vote (does NOT show results, just resets variables)
; !vote(1-5) - vote for option one
; !vresults - stops the votes and shows the results.
; !vhelp - shows the help
####
alias -l c1 { return $+($chr(3),12,$1-) }
alias -l c2 { return $+($chr(3),04,$1-) }
alias -l c3 { return $+($chr(3),07,$1-) }
alias -l c4 { return $+($chr(3),03,$1-) }
alias -l c5 { return $+($chr(3),01,$1-) }
alias -l c6 { return $+($chr(3),08,$1-) }
alias -l c7 { return $+($chr(3),10,$1-) }
alias -l c8 { return $+($chr(3),11,$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 ] ] $3-
set %time $2
notice $nick $c1 Voting question has been set up, please now type $c2 !addoption(1-5) $c4 <vote option(1-5)> $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:!addoption4*:#: {
if ($2- == $null) && (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 you need to add a fourth vote option.
halt
else
}
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
set %vote.option4 [ $+ [ $chan ] ] $2-
notice $nick $c1 thanks, your fourth vote option has been added.
}
}
on *:text:!addoption5*:#: {
if ($2- == $null) && (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c1 you need to add a fifth vote option.
halt
else
}
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
set %vote.option5 [ $+ [ $chan ] ] $2-
notice $nick $c1 thanks, your fifth 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 $c2 ON $c1 for : $c2 $chan $c1 !! $c1 The subject is: $c5 %vote.question [ $+ [ $chan ] ]
the options for the vote are;
set %vote.1 [ $+ [ $chan ] ] 0
set %vote.2 [ $+ [ $chan ] ] 0
set %vote.3 [ $+ [ $chan ] ] 0
set %vote.4 [ $+ [ $chan ] ] 0
set %vote.5 [ $+ [ $chan ] ] 0
timer 1 1 msg $chan $c4 Option 1 is: $c3 %vote.option1 [ $+ [ $chan ] ]
timer 1 2 msg $chan $c4 Option 2 is: $c3 %vote.option2 [ $+ [ $chan ] ]
timer 1 3 msg $chan $c4 Option 3 is: $c3 %vote.option3 [ $+ [ $chan ] ]
timer 1 4 msg $chan $c4 Option 4 is: $c3 %vote.option4 [ $+ [ $chan ] ]
timer 1 5 msg $chan $c4 Option 5 is: $c3 %vote.option5 [ $+ [ $chan ] ]
timer 1 6 msg $chan $c1 You have $c2 %time seconds $c1 to give your vote, starting now!!
.timer99 1 %time _vote $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.option4 [ $+ [ $chan ] ]
unset %vote.option5 [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
unset %vote.nick [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
/unset %voted. [ $+ [ $chan ] ]
set %vote.setting [ $+ [ $chan ] ] OFF
msg $chan $c1 Voting has been stoped by $c2 $nick $+ !
.timer99 off
}
}
on *:text:!vote 1*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c7 I'm sorry but you may vote only once per $c5 Subject $c7 .
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c7 Your vote has been counted. Thank you for voting.
inc %vote.1 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
}
}
on *:text:!vote 2*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c7 I'm sorry but you may vote only once per $c5 Subject $c7 .
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c7 Your vote has been counted. Thank you for voting.
inc %vote.2 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
}
}
on *:text:!vote 3*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c7 I'm sorry but you may vote only once per $c5 Subject $c7 .
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c7 Your vote has been counted. Thank you for voting.
inc %vote.3 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
}
}
on *:text:!vote 4*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c7 I'm sorry but you may vote only once per $c5 Subject $c7 .
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c7 Your vote has been counted. Thank you for voting.
inc %vote.4 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
}
}
on *:text:!vote 5*:#: {
if ($nick == %voted. [ $+ [ $chan ] ]) {
notice $nick $c7 I'm sorry but you may vote only once per $c5 Subject $c7 .
halt
else
}
if (%vote.setting [ $+ [ $chan ] ] == ON) {
notice $nick $c7 Your vote has been counted. Thank you for voting.
inc %vote.5 [ $+ [ $chan ] ] +1
set %voted. [ $+ [ $chan ] ] $nick
}
}
on *:text:!vresult*:#: {
if ($nick == %vote.nick [ $+ [ $chan ] ]) && (%vote.setting [ $+ [ $chan ] ] == ON) {
msg $chan $c1 Voting is now $c2 CLOSED.
var %vote.1 = %vote.1 [ $+ [ $chan ] ]
var %vote.2 = %vote.2 [ $+ [ $chan ] ]
var %vote.3 = %vote.3 [ $+ [ $chan ] ]
var %vote.4 = %vote.4 [ $+ [ $chan ] ]
var %vote.5 = %vote.5 [ $+ [ $chan ] ]
var %total = $calc(%vote.1 + %vote.2 + %vote.3 + %vote.4 + %vote.5)
var %vote.1-p = $round($calc(%vote.1 / %total * 100),5)
var %vote.2-p = $round($calc(%vote.2 / %total * 100),5)
var %vote.3-p = $round($calc(%vote.3 / %total * 100),5)
var %vote.4-p = $round($calc(%vote.4 / %total * 100),5)
var %vote.5-p = $round($calc(%vote.5 / %total * 100),5)
timer 1 1 msg $chan $c1 The time is $c2 UP $c1 , the results from the voting are :
timer 1 1 msg $chan $c3 Total votes $c5 : $iif(%total == $null,0,%total)
timer 1 3 msg $chan $c4 Option 1 : $c3 %vote.option1 [ $+ [ $1 ] ] $c5 - $iif(%vote.1 == $null,0,%vote.1) ( $+ %vote.1-p $+ $chr(37) $+ )
timer 1 5 msg $chan $c4 Option 2 : $c3 %vote.option2 [ $+ [ $1 ] ] $c5 - $iif(%vote.2 == $null,0,%vote.2) ( $+ %vote.2-p $+ $chr(37) $+ )
timer 1 7 msg $chan $c4 Option 3 : $c3 %vote.option3 [ $+ [ $1 ] ] $c5 - $iif(%vote.3 == $null,0,%vote.3) ( $+ %vote.3-p $+ $chr(37) $+ )
timer 1 9 msg $chan $c4 Option 4 : $c3 %vote.option4 [ $+ [ $1 ] ] $c5 - $iif(%vote.4 == $null,0,%vote.4) ( $+ %vote.4-p $+ $chr(37) $+ )
timer 1 11 msg $chan $c4 Option 5 : $c3 %vote.option5 [ $+ [ $1 ] ] $c5 - $iif(%vote.5 == $null,0,%vote.5) ( $+ %vote.5-p $+ $chr(37) $+ )
timer 1 13 msg $chan $c1 Voting $c2 ended $c1 , please wait $c2 1 minute $c1 before seting up new subject!!
.timer99 off
unset %vote.option1 [ $+ [ $chan ] ]
unset %vote.option2 [ $+ [ $chan ] ]
unset %vote.option3 [ $+ [ $chan ] ]
unset %vote.option4 [ $+ [ $chan ] ]
unset %vote.option5 [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
unset %vote.nick [ $+ [ $chan ] ]
unset %vote.question [ $+ [ $chan ] ]
/unset %voted. [ $+ [ $chan ] ]
set %vote.setting [ $+ [ $chan ] ] OFF
}
}
alias _vote {
;Syntax: /_vote <#channel>
;Action: displays vote results for <#channel>
var %vote.1 = %vote.1 [ $+ [ $1 ] ]
var %vote.2 = %vote.2 [ $+ [ $1 ] ]
var %vote.3 = %vote.3 [ $+ [ $1 ] ]
var %vote.4 = %vote.4 [ $+ [ $1 ] ]
var %vote.5 = %vote.5 [ $+ [ $1 ] ]
var %total = $calc(%vote.1 + %vote.2 + %vote.3 + %vote.4 + %vote.5)
var %vote.1-p = $round($calc(%vote.1 / %total * 100),5)
var %vote.2-p = $round($calc(%vote.2 / %total * 100),5)
var %vote.3-p = $round($calc(%vote.3 / %total * 100),5)
var %vote.4-p = $round($calc(%vote.4 / %total * 100),5)
var %vote.5-p = $round($calc(%vote.5 / %total * 100),5)
timer 1 1 msg $1 $c1 The time is $c2 UP $c1 , the results from the voting are :
timer 1 1 msg $1 $c3 Total votes $c5 : $iif(%total == $null,0,%total)
timer 1 3 msg $1 $c4 Option 1 : $c3 %vote.option1 [ $+ [ $1 ] ] $c5 - $iif(%vote.1 == $null,0,%vote.1) ( $+ %vote.1-p $+ $chr(37) $+ )
timer 1 5 msg $1 $c4 Option 2 : $c3 %vote.option2 [ $+ [ $1 ] ] $c5 - $iif(%vote.2 == $null,0,%vote.2) ( $+ %vote.2-p $+ $chr(37) $+ )
timer 1 7 msg $1 $c4 Option 3 : $c3 %vote.option3 [ $+ [ $1 ] ] $c5 - $iif(%vote.3 == $null,0,%vote.3) ( $+ %vote.3-p $+ $chr(37) $+ )
timer 1 9 msg $1 $c4 Option 4 : $c3 %vote.option4 [ $+ [ $1 ] ] $c5 - $iif(%vote.4 == $null,0,%vote.4) ( $+ %vote.4-p $+ $chr(37) $+ )
timer 1 11 msg $1 $c4 Option 5 : $c3 %vote.option5 [ $+ [ $1 ] ] $c5 - $iif(%vote.5 == $null,0,%vote.5) ( $+ %vote.5-p $+ $chr(37) $+ )
timer 1 13 msg $1 $c1 Voting $c2 ended $c1 , please wait $c2 1 minute $c1 before seting up new subject!!
unset %vote.option1 [ $+ [ $1 ] ]
unset %vote.option2 [ $+ [ $1 ] ]
unset %vote.option3 [ $+ [ $1 ] ]
unset %vote.option4 [ $+ [ $1 ] ]
unset %vote.option5 [ $+ [ $1 ] ]
unset %vote.question [ $+ [ $1 ] ]
unset %vote.nick [ $+ [ $1 ] ]
unset %vote.question [ $+ [ $1 ] ]
/unset %voted. [ $+ [ $1 ] ]
set %vote.setting [ $+ [ $1 ] ] OFF
}
on *:TEXT:!vHelp*:#: { if ($nick isop $chan || $nick ishop $chan) {
.notice $nick Voting script help and commands for use.
.notice $nick Adding vote/poll question : !addvote <time-seconds> <vote/poll here>
.notice $nick Adding voting option : !addoption(1-5) <vote option>
.notice $nick Starting the voting : !startvote - starts the vote
.notice $nick Stoping the voting : !stopvote - stops the vote (does NOT show results, just resets variables)
.notice $nick Voting : !vote(1-5) - vote for option one to five.
.notice $nick Voting results : !vresults - stops the votes and shows the results.
.notice $nick Voting Script by Dashovski }
}
Found it in 10 seconds: http://www.hawkee.com/snippet/2660/
http://lmgtfy.com/?q=+notice+%24nick+%24c1+you+need+to+enter+a+vote+question
2nd result