**Vote script updates**

By UK-Sw1ft on Jan 29, 2010

Well its been 4-5 years since iv been on this site.. i havnt realy got any more better at scripting since i quit..

first script iv updated is this one.. my vote script :)

commands are as follows:

Only if nick isop
-votestatus (Shows status of current vote)
-vote <on/off> (turns it on or off)
-voteq (Will set the question)
-votea <1> <2> <3> <4> (I.E -votea Yes No Maybe Prob)
-votestart (to start the vote)
Public
!vote 1/2/3/4
!votehelp

Tested & works

Any comments/suggestions are welcome

Thank you.

EDIT forgot to mention, that my bot is 6.16 as i prefure that version, not sure if it will work on high versions, if not, you will ned 6.16, sorry.

on 1:TEXT:*:#CHANNEL:{
  if $nick isop $chan {
    if $1 == -votestatus {
      if ($istokcs($nick, %timer, 44)) { halt }
      set %timer $addtok(%timer, $nick, 44) 
      timer $+ $nick 1 4 set %timer $remtok(%timer, $nick, 44)
      if %vote == off { 
        notice $nick No vote on-going $nick $+ . 
        halt 
      }
      msg $chan Question: $+([,,%vote.q,,])
      msg $chan Results: $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
      halt
    }
    if $1 == -vote {
      if ($istokcs($nick, %timer, 44)) { halt }
      set %timer $addtok(%timer, $nick, 44) 
      timer $+ $nick 1 4 set %timer $remtok(%timer, $nick, 44)
      if !$2 { notice $nick Correct syntex: -vote <on/off> | halt }
      if $2 == help { 
        notice $nick Here is how to start a vote.
        notice $nick Correct syntex: -vote <on/off> (to turn it on or off.
        notice $nick Correct syntex: -voteq <question>  (So set the voting questions)
        notice $nick Then once question is set, -votea <Vote1> <Vote2> <Vote3> <Vote4> (I.E -votea Yes No maybe dunno)
        halt 
      }
      if $2 == on {
        if %vote == on { notice $nick There is currently a vote allready going on. | halt }
        writeini vote.ini VOTE $chan ON
        set %vote on
        set %vote.c $chan
        notice $nick Voteing is now enabled.
        notice $nick Correct syntex: -voteq <question>  (So set the voting questions)
        notice $nick Then once question is set, -votea <Vote1> <Vote2> <Vote3> <Vote4> (I.E -votea Yes No maybe dunno)  
        Halt 
      }
      if $2 == off {
        if %vote == off { notice $nick There's no vote to cancle. | halt }
        writeini vote.ini VOTE $chan off
        set %vote off
        timervote* off
        var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
        var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
        notice $nick voting has been cancled/disabled. 
        remini vote.ini voted
        halt 
      }
    }
    if $1 == -voteq {
       if ($istokcs($nick, %timer, 44)) { halt }
      set %timer $addtok(%timer, $nick, 44) 
      timer $+ $nick 1 4 set %timer $remtok(%timer, $nick, 44)
      if %vote == off { notice $nick No vote is currently enabled/on going. | halt }
      if !$2 {
        notice $nick Correct syntex: -voteq <question>  (So set the voting questions)
        notice $nick Then once question is set, -votea <Vote1> <Vote2> <Vote3> <Vote4> (I.E -votea Yes No maybe dunno) 
        halt 
      }
      if $right($2-,1) != ? { 
        notice $nick Please make sure its a question, i didnt see a '?' in there. 
        halt
      } 
      set %vote.q $2-
      notice $nick Question set to: $+([,,%vote.q,,]) 
      notice $nick now, -votea <Vote1> <Vote2> <Vote3> <Vote4> (I.E -votea Yes No maybe dunno) 
      halt
    }
    if $1 == -votea {
            if ($istokcs($nick, %timer, 44)) { halt }
      set %timer $addtok(%timer, $nick, 44) 
      timer $+ $nick 1 4 set %timer $remtok(%timer, $nick, 44)
      if %vote == off { notice $nick No vote is currently enabled/on going. | halt }
      if %vote.set == on { halt }
      if %vote.q || !$2 && !$3 && !$4 && !$5 { 
        notice $nick Correct syntex: -votea <Vote1> <Vote2> <Vote3> <Vote4> (I.E -votea Yes No maybe dunno) 
        halt
      }
      set %vote.set ON
      set %voted.1 $2
      set %voted.2 $3
      set %voted.3 $4
      set %voted.4 $5
      notice $nick Ok, Question and Votes are now set.
      notice $nick Question: $+([,,%vote.q,,])
      notice $nick Vote: $+([,,%voted.1,,]) - $+([,,%voted.2,,]) - $+([,,%voted.3,,]) - $+([,,%voted.4,,])
      notice $nick Ok, now, -votestart To start the vote.
      halt
    }
    if $1 == -votestart {
      if !%vote.q && %vote != on { 
        if %vote.s == on { halt }
        notice $nick Here is how to start a vote.
        notice $nick Correct syntex: -vote <on/off> (to turn it on or off.
        notice $nick Correct syntex: -voteq <question>  (So set the voting questions)
        notice $nick Then once question is set, -votea <Vote1> <Vote2> <Vote3> <Vote4> (I.E -votea Yes No maybe dunno)
        halt
      }
      set %vote.s ON
      msg $chan Vote now $+([,,%vote,,],.) This vote is on for 24 hours.
      msg $chan Question: $+([,,%vote.q,,])
      msg $chan !Vote 1 for $+([,,%voted.1,,]) - !Vote 2 for $+([,,%voted.2,,]) - !Vote 3 for $+([,,%voted.3,,]) - !Vote 4 for $+([,,%voted.4,,])
      timervote1 1 86400 votefin
      timervote4 0 3600 msg $chan vote in progress..
      timervote2 0 3600 msg $chan Question: $+([,,%vote.q,,])
      timervote3 0 3600 msg $chan !Vote 1 for $+([,,%voted.1,,]) - !Vote 2 for $+([,,%voted.2,,]) - !Vote 3 for $+([,,%voted.3,,]) - !Vote 4 for $+([,,%voted.4,,])
      halt
    }
  }
  if $1 == !vote {
         if ($istokcs($nick, %timer, 44)) { halt }
      set %timer $addtok(%timer, $nick, 44) 
      timer $+ $nick 1 4 set %timer $remtok(%timer, $nick, 44)
    if %vote == off { halt }
    if $readini(vote.ini,voted,$address($nick,1) == vote) { notice $nick you can only vote once $nick $+ . | halt }
    if !$2 { 
      msg $chan !Vote 1 for $+([,,%voted.1,,]) - !Vote 2 for $+([,,%voted.2,,]) - !Vote 3 for $+([,,%voted.3,,]) - !Vote 4 for $+([,,%voted.4,,])
      halt
    }
    if !$istok(1 2 3 4,$2,32) {     
      msg $chan !Vote 1 for $+([,,%voted.1,,]) - !Vote 2 for $+([,,%voted.2,,]) - !Vote 3 for $+([,,%voted.3,,]) - !Vote 4 for $+([,,%voted.4,,])
      halt
    }
    writeini vote.ini VOTED $address($nick,1) vote
    inc $+(%,vote.,$2)
    msg $chan Question: $+([,,%vote.q,,])
    msg $chan Results: $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    halt
  }  
  if $1 == !votehelp {
          if ($istokcs($nick, %timer, 44)) { halt }
      set %timer $addtok(%timer, $nick, 44) 
      timer $+ $nick 1 4 set %timer $remtok(%timer, $nick, 44)
    if %vote == off { halt }
    msg $chan !Vote 1 for $+([,,%voted.1,,]) - !Vote 2 for $+([,,%voted.2,,]) - !Vote 3 for $+([,,%voted.3,,]) - !Vote 4 for $+([,,%voted.4,,])
    halt
  }
}

alias votefin {
  if (%vote.1 > %vote.2) || (%vote.1 > %vote.3) || (%vote.1 > %vote.4) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  Results For Question $+([,,%vote.q,,])
    msg %vote.c  $+([,,%voted.1,,]) WINS With $+([,,%vote.1,,])  Votes. 
    msg %vote.c  $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE %vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
  elseif (%vote.2 > %vote.1) || (%vote.2 > %vote.3) || (%vote.4 > %vote.4) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  Results For Question $+([,,%vote.q,,])
    msg %vote.c  $+([,,%voted.2,,]) WINS With $+([,,%vote.2,,])  Votes.
    msg %vote.c $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE %vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
  elseif (%vote.3 > %vote.2) || (%vote.3 > %vote.4) || (%vote.3 > %vote.1) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  Results For Question $+([,,%vote.q,,])
    msg %vote.c  $+([,,%voted.3,,]) WINS With $+([,,%vote.3,,])  Votes.
    msg %vote.c $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE%vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
  elseif (%vote.4 > %vote.1) || (%vote.4 > %vote.2) || (%vote.4 > %vote.3) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  $+([,,%voted.4,,]) WINS With $+([,,%vote.4,,])  Votes.
    msg %vote.c $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE %vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
  elseif (%vote.1 == %vote.2) || (%vote.1 == %vote.3) || (%vote.1 == %vote.4) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  Results For Question $+([,,%vote.q,,])
    msg %vote.c Vote was a DRAW!
    msg %vote.c $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE %vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
  elseif (%vote.2 == %vote.1) || (%vote2 == %vote.3) || (%vote.2 == %vote.4) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  Results For Question $+([,,%vote.q,,])
    msg %vote.c Vote was a DRAW!
    msg %vote.c $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE %vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
  elseif (%vote.3 == %vote.1) || (%vote.3 == %vote.2) || (%vote.3 == %vote.4) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  Results For Question $+([,,%vote.q,,])
    msg %vote.c Vote was a DRAW!
    msg %vote.c $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE %vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
  elseif (%vote.4 == %vote.1) || (%vote.4 == %vote.2) || (%vote.4 == %vote.3) {
    msg %vote.c  Voting Has Now Finished!
    msg %vote.c  Results For Question $+([,,%vote.q,,])
    msg %vote.c Vote was a DRAW!
    msg %vote.c $+([,,%voted.1,,]) - $+(,$chr(40),,%vote.1,,$chr(41)) - $+([,,%voted.2,,]) - $+(,$chr(40),,%vote.2,,$chr(41)) - $+([,,%voted.3,,]) - $+(,$chr(40),,%vote.3,,$chr(41)) - $+([,,%voted.4,,]) - $+(,$chr(40),,%vote.4,,$chr(41))
    set %vote off
    writeini vote.ini VOTE %vote.c off
    remini vote.ini voted
    var %c = 1 | while (%c <= $var(%vote.*,0)) { set $var(%vote.*,%c) 0 | inc %c }
    var %c = 1 | while (%c <= $var(%voted.*,0)) { set $var(%voted.*,%c) 0 | inc %c }
    timervote* off
  }
}

Comments

Sign in to comment.
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.