On *:text:!poll *:#:{
if (($nick isop $chan) || ($read(Pseudomods.txt,nw,$nick))) { msg $chan /me Poll started, type " $+ $2 $+ " to vote for " $+ $3 $+ " or " $+ $4 $+ " to vote for " $+ $5 $+ ".
set %choose1 $2
set %choose2 $4
set %opt1 $3
set %opt2 $5
set %num1 0
set %num2 0
write -c PollOp1.txt
write -c PollOp2.txt
set %pollStat ON
}
}
on *:text:%choose1:#:{
if ($read(PollOp1.txt,w,$nick)) return
else {
write PollOp1.txt $nick
%num1 inc
if ($read(PollOp2.txt,w,$nick)) {
%num2 dec
write -ds $nick
}
}
}
on *:text:%choose2:#:{
if ($read(PollOp2.txt,w,$nick)) return
else {
write PollOp2.txt $nick
%num2 inc
if ($read(PollOp2.txt,w,$nick)) {
%num1 dec
write -ds $nick
}
}
}
on *:text:!endPoll:#:{
if (($nick isop $chan) || ($read(Pseudomods.txt,nw,$nick))) {
if (%pollStat) {
if (%num1 == %num2) { msg $chan /me It was a tie with " $+ %num1 $+ " votes for each option. }
else if (%num1 > %num2) { msg $chan /me " $+ %opt1 $+ " with " $+ %num1 $+ " votes against " $+ %num2 $+ " . }
else if (%num1 < %num2) { msg $chan /me " $+ %opt2 $+ " with " $+ %num2 $+ " votes against " $+ %num1 $+ " . }
unset %opt1
unset %opt2
unset %choose1
unset %choose2
unset %num1
unset %num2
unset %pollStat
}
}
}