Very Very simple vote script.

By juhapuha on Oct 11, 2007

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 }
}

Comments

Sign in to comment.
criminal   -  May 08, 2008

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

 Respond  
Korvin   -  Feb 18, 2008

lucky, 200th comment

 Respond  
Korvin   -  Feb 18, 2008

honestly i wouldnt know how this would give anyone any new ideas, accept ideas of suicide xD its an ok script, could be a lot shorter and a lot better but ok if you\'re just starting out.

 Respond  
juhapuha   -  Feb 18, 2008

Maybe useless, maybe not..someone could like.. my scripts are always like an example, and maybe giving new ideas.

 Respond  
Zorgon   -  Oct 17, 2007

... It\'s a very short script. It\'s not long at all.
It\'s exactly what the maker said.. it\'s very, VERY simple and, quite frankly, rather useless.. But a good effort nonetheless.

 Respond  
Tippy   -  Oct 14, 2007

Wow there\'s alot of code there maybe you could simple it out I didn\'t try it or load it so maybe you can make it better and a bit shorter :) Keep it up

Regards,

Tippy

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.