Advertisement
illpastethat

Worldcup Poll Vote Elimination Round

Jun 26th, 2014
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. alias pollset {
  2.   ;/timer 11:00 1 1 /newpoll USA Germany
  3.   /timer 15:00 1 1 /newpoll Algeria Russia
  4. }
  5. alias newpoll {
  6.   if ($2) {
  7.     unset %vote*
  8.     set %vote1_name $1 | set %vote2_name $2-
  9.     set %vote1 0 | set %vote2 0
  10.     set %gametime $iif(%gametime == 4,12,4)
  11.     if (%gametime == 12) {
  12.       timer 11:30 1 1 /msg #worldcup  0430 minutes till the match!! 12Who will win? 4Vote using .vote $+(<,%vote1_name,|,%vote2_name,>)
  13.       timer 11:55 1 1 /msg #worldcup  045 minutes till the match!! 12Who will win? 4Vote using .vote $+(<,%vote1_name,|,%vote2_name,>) 12(Voting ends in 15mins)
  14.       timer 12:08 1 1 /msg #worldcup 04Gentleman, place your final bets. 12Last call for votes.
  15.       timer 12:12 1 1 /endpoll
  16.     }
  17.     elseif (%gametime == 4) {
  18.       timer 15:30 1 1 /msg #worldcup  0430 minutes till the match!! 12Who will win? 4Vote using .vote $+(<,%vote1_name,|,%vote2_name,>)
  19.       timer 15:55 1 1 /msg #worldcup  045 minutes till the match!! 12Who will win? 4Vote using .vote $+(<,%vote1_name,|,%vote2_name,>) 12(Voting ends in 15mins)
  20.       timer 16:08 1 1 /msg #worldcup 04Gentleman, place your final bets. 12Last call for votes.
  21.       timer 16:12 1 1 /endpoll
  22.     }
  23.     set %poll on
  24.     msg #worldcup 4New poll: Who will win %vote1_name or %vote2_name $+ ? - Vote using .vote $+(<,%vote1_name,|,%vote2_name,>)
  25.   }
  26. }
  27. on $*:text:/^[!.](vote)(\s|$)/Si:#worldcup: {
  28.   if ($($+(%,botflood.,$nick),2)) {
  29.     if ($($+(%,botflood.,$nick),2) >= 50) {
  30.       ignore -u60 $address($nick,2)
  31.       msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
  32.       halt
  33.     }
  34.     elseif ($($+(%,botflood.,$nick),2) >= 40) {
  35.       msg $chan $+($nick,$chr(44)) Please do not flood the bot.
  36.       inc -z $+(%,botflood.,$nick) 20
  37.       halt
  38.     }
  39.     else { inc -z $+(%,botflood.,$nick) 25 }
  40.   }
  41.   else { inc -z $+(%,botflood.,$nick) 25 }
  42.   if (%poll == off) {
  43.     if (%pollflood != true) {
  44.       msg $chan 4Poll Closed - Results: $poll
  45.       set -u30 %pollflood true
  46.     }
  47.     halt
  48.   }
  49.   if ($istok(%voted,$address($nick,2),44)) {
  50.     msg $chan Sorry $nick $+ , you have already voted on this match.
  51.   }
  52.   if ($2 == draw) { msg $chan $nick $+ , there can't be a draw at this stage! Try .vote $+(<,%vote1_name,|,%vote2_name,>) | halt }
  53.   else {
  54.     if (($2 isin %vote1_name) || ($2 isin %vote2_name)) {
  55.       if ($2 isin %vote1_name) { inc %vote1 }
  56.       elseif ($2 isin %vote2_name) { inc %vote2 }
  57.       set %voted $addtok(%voted,$address($nick,2),44)
  58.       msg $chan $poll
  59.     }
  60.     else {
  61.       msg $chan $nick $+ , try .vote $+(<,%vote1_name,|,%vote2_name,>)
  62.     }
  63.   }
  64. }
  65. on *:input:#worldcup: {
  66.   if (($1 == .vote) || ($1 == !vote)) {
  67.     if (($2 isin %vote1_name) || ($2 isin %vote2_name)) {
  68.       if ($2 isin %vote1_name) { inc %vote1 }
  69.       elseif ($2 isin %vote2_name) { inc %vote2 }
  70.       set %voted $addtok(%voted,$address($nick,2),44)
  71.       .timer -m 1 100 msg $chan $poll
  72.     }
  73.   }
  74. }
  75. on $*:text:/^[!.](poll)(\s|$)/Si:#worldcup: {
  76.   if ($($+(%,botflood.,$nick),2)) {
  77.     if ($($+(%,botflood.,$nick),2) >= 50) {
  78.       ignore -u60 $address($nick,2)
  79.       msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
  80.       halt
  81.     }
  82.     elseif ($($+(%,botflood.,$nick),2) >= 40) {
  83.       msg $chan $+($nick,$chr(44)) Please do not flood the bot.
  84.       inc -z $+(%,botflood.,$nick) 20
  85.       halt
  86.     }
  87.     else { inc -z $+(%,botflood.,$nick) 25 }
  88.   }
  89.   else { inc -z $+(%,botflood.,$nick) 25 }
  90.   msg $chan 4 $+ $iif(%poll == on,Current poll:,Final Poll Results:) $poll
  91. }
  92. alias endpoll {
  93.   set %poll off
  94.   msg #worldcup Final Poll Results: $+(3,%vote1_name,:) %vote1 $percent(%vote1) - $+(4,%vote2_name,:) %vote2 $percent(%vote2)
  95. }
  96. alias poll {
  97.   return Who will win? $+(3,%vote1_name,:) %vote1 $percent(%vote1) - $+(4,%vote2_name,:) %vote2 $percent(%vote2)
  98. }
  99. alias percent {
  100.   var %votes $calc(%vote1 + %vote2)
  101.   return $+($chr(40),$gettok($calc($calc($1 / %votes) * 100),1,$asc(.)),%,$chr(41),)
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement