Advertisement
illpastethat

World Cup Poll/Vote

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