rendered paste bodyon *:TEXT:!poll*:#:{
if (%poll.on) { .notice $nick A poll is already running in %poll.chan | halt }
if ($2 isnum 1-) {
if ($2 < 6) {
set %poll.time $calc( $2 * 60)
}
else {
set %poll.time 300
}
set %poll.question $3-
}
else {
set %poll.time 300
set %poll.question $2-
}
set %poll.on 1
set %poll.chan $chan
msg $chan 7Poll started by-4 $nick $+
msg $chan 7Question-4 %poll.question 7Time-4 $calc( %poll.time / 60 ) Minutes
enable #pollson
.timer 1 %poll.time endpoll
}
alias endpoll {
if (%poll.yes == $null) { set %poll.yes 0 }
if (%poll.no == $null) { set %poll.no 0 }
msg %poll.chan 7Poll Ended::4 Question-7 %poll.question
msg %poll.chan 7Results:4 %poll.yes 7Yes Votes4 %poll.no 7No Votes4 $calc($round($calc( %poll.yes / ( %poll.yes + %poll.no) ),2)*100) $+ % 7Said Yes
unset %poll.*
}
#pollson on
on *:TEXT:!yes:%poll.chan:{
if (%poll. [ $+ [ $nick ] ] == $null) {
if (%poll.yes == $null) {
set %poll.yes 1
}
else {
inc %poll.yes 1
}
set %poll. [ $+ [ $nick ] ] 1
}
}
on *:TEXT:!no:%poll.chan:{
if (%poll. [ $+ [ $nick ] ] == $null) {
if (%poll.no == $null) {
set %poll.no 1
}
else {
inc %poll.no 1
}
set %poll. [ $+ [ $nick ] ] 1
}
}
on *:TEXT:!endpoll:%poll.chan:{
if ($nick isop $chan) {
endpoll
}
}
on *:join:%poll.chan:{
if ($nick != $me) {
.notice $nick 7Current Poll4 %poll.question
}
}
#pollison end