Advertisement
Guest User

Untitled

a guest
Mar 7th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.82 KB | None | 0 0
  1.   if ($1-2 == !set vote ) && ($nick isop $chan) {
  2.     unset %vote $+ * $+ $chan $+ *
  3.     set %voteoptions. $+ $chan $lower($3-)
  4.     msg $chan Vote set! Your options are: $lower($3-). Type !vote OPTION to vote.
  5.     set -u3600 %vote. $+ $chan on
  6.   }
  7.   if ( $1 == !vote ) {
  8.     if ( $2 == on ) && ( $nick isop $chan ) {
  9.       msg $chan Voting on !set vote option1 option2 option3 etc to set options. !vote to vote.
  10.       set -u3600 %vote. $+ $chan on
  11.     }
  12.     elseif ( $2 == off ) && ($nick isop $chan) {
  13.       msg $chan Voting has been turned off.
  14.       unset %vote $+ * $+ $chan $+ *
  15.     }
  16.     elseif ($2 == results) && ($3 == $null) {
  17.       ;code to find results and output
  18.       var %ix $numtok(%voteoptions. [ $+ [ $chan ] ] ,32), %iz %ix, %iy 1, %result, %output
  19.       ; Create tokenized results for sorting
  20.       while (%iz) {
  21.         var %option $gettok(%voteoptions. [ $+ [ $chan ] ] ,%iz,32)
  22.         %result = %result $iif($($+(%,votechoice.,$chan,%option),2),$v1,0) $+ $chr(3) $+ %option
  23.         dec %iz
  24.       }
  25.       ; Reverse numeric sort
  26.       %result = $sorttok(%result,32,nr)
  27.       ; Build result message from sorted tokens
  28.       while (%iy <= %ix) {
  29.         var %tok $gettok(%result,%iy,32)
  30.         %output = %output Votes for $gettok(%tok,2,3) $+ : $iif($gettok(%tok,1,3) > 0,$v1,No votes)
  31.         ; Add delimiter
  32.         if (%iy != %ix) { %output = %output $+ , }
  33.         inc %iy
  34.       }
  35.       msg $chan Vote Results -> %output
  36.     }
  37.     elseif ($2 != $null) {
  38.       ;checks to see if what they typed was an option, if it is, check to see if it exists. if no, make it and inc it. If it does, inc it
  39.       if ($istok(%voteoptions. [ $+ [ $chan ] ],$2,32)) || ($istok(%voteoptions. [ $+ [ $chan ] ],$remove($2-,$chr(32)),32)) ( {
  40.         inc %votechoice. $+ $chan $+ $remove($2-,$chr(32))
  41.       }
  42.     }
  43.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement