Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($1-2 == !set vote ) && ($nick isop $chan) {
- unset %vote $+ * $+ $chan $+ *
- set %voteoptions. $+ $chan $lower($3-)
- msg $chan Vote set! Your options are: $lower($3-). Type !vote OPTION to vote.
- set -u3600 %vote. $+ $chan on
- }
- if ( $1 == !vote ) {
- if ( $2 == on ) && ( $nick isop $chan ) {
- msg $chan Voting on !set vote option1 option2 option3 etc to set options. !vote to vote.
- set -u3600 %vote. $+ $chan on
- }
- elseif ( $2 == off ) && ($nick isop $chan) {
- msg $chan Voting has been turned off.
- unset %vote $+ * $+ $chan $+ *
- }
- elseif ($2 == results) && ($3 == $null) {
- ;code to find results and output
- var %ix $numtok(%voteoptions. [ $+ [ $chan ] ] ,32), %iz %ix, %iy 1, %result, %output
- ; Create tokenized results for sorting
- while (%iz) {
- var %option $gettok(%voteoptions. [ $+ [ $chan ] ] ,%iz,32)
- %result = %result $iif($($+(%,votechoice.,$chan,%option),2),$v1,0) $+ $chr(3) $+ %option
- dec %iz
- }
- ; Reverse numeric sort
- %result = $sorttok(%result,32,nr)
- ; Build result message from sorted tokens
- while (%iy <= %ix) {
- var %tok $gettok(%result,%iy,32)
- %output = %output Votes for $gettok(%tok,2,3) $+ : $iif($gettok(%tok,1,3) > 0,$v1,No votes)
- ; Add delimiter
- if (%iy != %ix) { %output = %output $+ , }
- inc %iy
- }
- msg $chan Vote Results -> %output
- }
- elseif ($2 != $null) {
- ;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
- if ($istok(%voteoptions. [ $+ [ $chan ] ],$2,32)) || ($istok(%voteoptions. [ $+ [ $chan ] ],$remove($2-,$chr(32)),32)) ( {
- inc %votechoice. $+ $chan $+ $remove($2-,$chr(32))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement