Guest User

Untitled

a guest
Jul 21st, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.35 KB | None | 0 0
  1. alias resultpollcode {
  2.   var %toknum 1
  3.   if (%voteoptions) {
  4.     while ($gettok(%nforoptions,%toknum,44)) {
  5.       var %pollresults $addtok(%pollresults,[ $+ $gettok(%voteoptions,%toknum,9) $+ : $gettok(%nforoptions,%toknum,44) ],0)
  6.       inc %toknum
  7.     }
  8.     msg %pollchannel {{<<< Results: %pollresults >>>}}
  9.     msg %pollchannel >>>3Top results with a score of $gettok($sorttok(%nforoptions,44,nr),1,44) are:<<<
  10.     var %toppollnum 1
  11.     while ($gettok($sorttok(%nforoptions,44,nr),%toppollnum,44) == $gettok($sorttok(%nforoptions,44,nr),1,44)) {
  12.       msg %pollchannel >>> $+ $gettok(%voteoptions,$findtok(%nforoptions,$gettok($sorttok(%nforoptions,44,nr),%toppollnum,44),%toppollnum,44),9) $+ <<<
  13.       inc %toppollnum
  14.     }
  15.   }
  16.   else msg %pollchannel {{<<< Results: No Results! >>>}}
  17.   unset %voteoptions | unset %nforoptions | unset %votenicks | unset %pollison | unset %pollchannel
  18. }
  19.  
  20. on *:text:*:#:{
  21.   if ($1 == !poll) {
  22.     if (%pollison == 1) { notice $nick poll is already on }
  23.     elseif (!$2) { .notice $nick enter something to vote for }
  24.     else {
  25.       set -e %pollison 1
  26.       set -e %pollchannel #
  27.       msg # {{<<< Vote for: $2- >>>}}
  28.       .timerpoll 1 30 msg # 15 secs left to vote for {{<<< $2- >>>}}
  29.       .timerpoll 1 44 msg # {{<<< Poll over for: $2- >>>}}
  30.       .timerpoll 1 46 resultpollcode
  31.     }
  32.   }
  33.   elseif ($1 == !pollhalt && %pollison && $nick isop #) {
  34.     msg # >>poll halted<<
  35.     .timerpoll off
  36.     unset %voteoptions | unset %nforoptions | unset %votenicks | unset %pollison | unset %pollchannel
  37.   }
  38.   elseif ($1 == !vote) {
  39.     if (# != %pollchannel) { .notice $nick sorry theres already a poll in %pollchannel }
  40.     elseif ($address($nick,2) isin %votenicks) { .notice $nick you cant vote more than once! }
  41.     elseif (!$2) { Usage: !vote <what to vote for> }
  42.     elseif ($address($nick,2) !isin %votenicks) && (%pollison == 1) {
  43.       if ($istok(%voteoptions,$strip($2-,burc),9)) { set %nforoptions $puttok(%nforoptions,$calc($gettok(%nforoptions,$findtok(%voteoptions,$strip($2-,burc),1,9),44)  + 1),$findtok(%voteoptions,$strip($2-,burc),1,9),44) }
  44.       else {
  45.         set -e %voteoptions $addtok(%voteoptions,$strip($2-,burc),9)
  46.         set -e %nforoptions %nforoptions $+ ,1
  47.       }
  48.       set -e %votenicks $addtok(%votenicks,$address($nick,2),44)
  49.       .notice $nick thanks for your vote ;)
  50.     }
  51.   }
  52. }
Add Comment
Please, Sign In to add comment