on *:TEXT:!vote *:#: {
if ($2 == start) {
if (%vote == null) {
if ($nick isop $chan) {
msg $chan $nick has started a poll
msg $chan 7 $3-
msg $chan type 4!vote yes 1or 4!vote no 1to participate
set %vote on
set %votenick $nick
set %voteyes 0
set %voteno 0
set %votetopic $3-
}
}
}
if (%vote != null) {
if ($2 == yes) {
set %voteyes $calc(%voteyes + 1)
notice $nick Your vote has been counted as yes
}
}
if (%vote != null) {
if ($2 == no) {
set %voteno $calc(%voteno + 1)
notice $nick Your vote has been counted as no
}
}
if ($2 == stop) {
if ($nick isop $chan) {
msg $chan Current poll started by %votenick has been ended by $nick
msg $chan Results are 4Yes:7 %voteyes 4No:7 %voteno
if (%voteyes > %voteno) {
msg $chan %votetopic 4YES!
}
elseif (%voteyes < %voteno) {
msg $chan %votetopic 4NO!
}
set %vote null
}
}
}