works for every user. Type !vote [time in minutes, 1-60 min] [Vote Question]
on *:text:!vote*:#:{
if (%vote. [ $+ [ $chan ] ]) { notice $nick Vote is already running: $+ $readini(db2.ini,$chan,vote) $+ }
if (!$2) { notice $nick Vote syntax !vote [time in minutes, 1-60 minutes] [Question] }
if ($2 isnum 1-60) && ($3) && (!%vote. [ $+ [ $chan ] ]) { set %vtime. $+ $chan $calc( $2 * 60 ) | writeini db2.ini $chan vote $3- | set %vote. $+ $chan on | msg $chan $nick Started Vote, Question is: $+ $3- $+ Time limit is $2 $+ min. | timer 1 %vtime. [ $+ [ $chan ] ] unset %vote | timer 1 %vtime. [ $+ [ $chan ] ] unset %vtime. [ $+ [ $chan ] ] | timer 1 %vtime. [ $+ [ $chan ] ] unset %vq. [ $+ [ $chan ] ] | timer 1 %vtime. [ $+ [ $chan ] ] Vote $chan }
}
alias vote {
if (%yes. [ $+ [ $$1 ] ] < %no. [ $+ [ $$1 ] ]) || (!%yes. [ $+ [ $$1 ] ]) { msg $$1 Right answer to Vote was NO }
if (%yes. [ $+ [ $$1 ] ] > %no. [ $+ [ $$1 ] ]) || (!%no. [ $+ [ $$1 ] ]) { msg $$1 Right answer to Vote was YES }
if (%yes. [ $+ [ $$1 ] ]) || (%no. [ $+ [ $$1 ] ]) { msg $$1 Vote is end, Vote Was: $+ $readini(db2.ini,$$1,vote) $+ ( $+ $+ $iif(%yes. [ $+ [ $$1 ] ],%yes. [ $+ [ $$1 ] ],no one) $+ $+ ) Answered yes, ( $+ $+ $iif(%no. [ $+ [ $$1 ] ],%no. [ $+ [ $$1 ] ],no one) $+ $+ ) answered No. | remini db2.ini $chan vote | unset %yes. [ $+ [ $$1 ] ] | unset %no. [ $+ [ $$1 ] ] | unset %vote. [ $+ [ $$1 ] ] | halt }
if (!%yes. [ $+ [ $$1 ] ]) && (!%no. [ $+ [ $$1 ] ]) { msg $$1 No one answered the vote. | remini db2.ini $chan vote | unset %yes. [ $+ [ $$1 ] ] | unset %no. [ $+ [ $$1 ] ] | unset %vote. [ $+ [ $$1 ] ] }
}
on *:text:!yes:#:{ if (%vote. [ $+ [ $chan ] ]) && ($readini(db2.ini,$chan,$address($nick,2)) != answered) { %time = %vtime. [ $+ [ $chan ] ] | writeini db2.ini $chan $address($nick,2) Answered | timer 1 %time remini db2.ini $chan $address($nick,2) | inc %yes. $+ $chan | notice $nick Your Vote Is Count. | halt }
if ($readini(db2.ini,$chan,$address($nick,2)) == answered) { notice $nick You have Answered Already. }
if (!%vote. [ $+ [ $chan ] ]) { notice $nick Vote is not running }
}
on *:text:!no:#:{ if (%vote. [ $+ [ $chan ] ]) && ($readini(db2.ini,$chan,$address($nick,2)) != answered) { %time = %vtime. [ $+ [ $chan ] ] | writeini db2.ini $chan $address($nick,2) Answered | timer 1 %time remini db2.ini $chan $address($nick,2) | inc %no. $+ $chan | notice $nick Your Vote Is Count. | halt }
if ($readini(db2.ini,$chan,$address($nick,2)) == answered) { notice $nick You have Answered Already. }
if (!%vote. [ $+ [ $chan ] ]) { notice $nick Vote is not running }
}
At the
if (%vote. [ $+ [ $chan ] ]) { notice $nick Vote is already running: $+ $readini(db2.ini,$chan,vote) $+ }
you already find if the vote is already running on the channel, add \" | Halt \".
if you\'ve done that, the:
&& (!%vote. [ $+ [ $chan ] ])
isnt needed anymore.
and instead of all making %no, %yes, %time, ...
Make it it\'ll all contain this: %vote.no, %vote.yes, %vote.time,...
Using \" unsetall \" will result in much problems, so you can use \" unset %vote.* \"
It\'s ok for the rest, however it could be simplified alot. 7/10