Also why no do all ini no vars like:
on *:TEXT:*:#: {
if (!poll == $1) {
if (!$readini(Poll.ini,Polls,Question)) { .notice $nick There is no poll going on at this time. }
elseif ($readini(Poll.ini,Polls,Question)) { .notice $nick The current poll question is: $readini(poll.ini,polls,question) }
}
elseif ($1 == !pollcmds) {
if (!$readini(Poll.ini,Polls,Question)) { .notice $nick There is no poll going on at this time. }
elseif ($readini(Poll.ini,Polls,Question)) { .notice $nick Poll commands: !yes to vote yes, !no to vote no, !poll to see the question, !results to view the current results of the poll (only applicable if you've voted already) }
}
elseif ($1 == !yes) {
if (!$readini(Poll.ini,Polls,Question)) { .notice $nick There is no poll going at the moment }
if ($readini(Poll.ini,Polls,Question)) {
var %voted $readini(poll.ini,polls,voted)
var %a = $numtok(%voted,32)
while (%a) {
if ( $gettok(%voted,%a,32) isin $1- ) { .notice $nick You have already voted }
elseif ( $gettok(%voted,%a,32) !isin $1- ) { writeini poll.ini polls voted $nick $readini(poll.ini,polls,voted) | inc %yes 1 | writeini poll.ini polls yes %yes | .notice $nick Thanks for voting }
}
}
}
elseif ($1 == !no) {
if (!$readini(Poll.ini,Polls,Question)) { .notice $nick There is no poll going at the moment }
if ($readini(Poll.ini,Polls,Question)) {
var %voted $readini(poll.ini,polls,voted)
var %a = $numtok(%voted,32)
while (%a) {
if ( $gettok(%voted,%a,32) isin $1- ) { .notice $nick You have already voted }
elseif ( $gettok(%voted,%a,32) !isin $1- ) { writeini poll.ini polls voted $nick $readini(poll.ini,polls,voted) | inc %no 1 | writeini poll.ini polls no %no | .notice $nick Thanks for voting }
}
}
}
elseif ($1 == !results) {
var %voted $readini(poll.ini,polls,voted)
var %a = $numtok(%voted,32)
while (%a) {
if ( $gettok(%voted,%a,32) isin $1- ) { .notice $nick The polls as of now stand at $readini(poll.ini,polls,yes) yes's and $readini(poll.ini,polls,no) no's }
elseif ( $gettok(%voted,%a,32) !isin $1- ) { .notice $nick You need to vote to see the results }
}
}
}
alias pollstart {
writeini poll.ini polls question $1-
/amsg [POLL] Poll started: $readini(poll.ini,polls,question) (type !pollcmds to see the poll commands.)
}
alias pollend {
/amsg [POLL] Poll ended: $readini(poll.ini,polls,question) - results: (yes: $readini(poll.ini,polls,yes) $+ $chr(41) (No: $readini(poll.ini,polls,no) $+ $chr(41)
/write -c poll.ini
}