Advertisement
westor

Twitch BET System for Scootycoolguy v1.0

Mar 2nd, 2015
485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 8.56 KB | None | 0 0
  1. ON !*:TEXT:*:#: {
  2.   tokenize 32 $strip($1-,burci)
  3.   if ($1 == !bet) {
  4.     if (!$check_mod($nick,$chan)) { .msg $chan ( $+ $nick $+ ): Error, You are NOT an channel moderator! | return }
  5.     if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Try again and enter the correct value, more info at !bethelp | return }
  6.     if ($2 == open) || ($2 == start) || ($2 == on) {
  7.       if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  8.       if (%bet) { .msg $chan ( $+ $nick $+ ): Error, There is already an BET running try again later or use !bet stop to stop the bet! | return }
  9.       set -e %bet $nick $chan
  10.       .msg $chan ( $+ $nick $+ ): The BET has been started, use now !win or !lose to enter the bet.
  11.     }
  12.     if ($2 == stop) || ($2 == end) || ($2 == off) {
  13.       if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  14.       if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  15.       unset %bet_win %bet_lose %bet %bet_pause
  16.       .msg $chan ( $+ $nick $+ ): The BET has been stopped.
  17.     }
  18.     if ($2 == resume) {
  19.       if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  20.       if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  21.       if (!%bet_pause) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any bet paused since now! | return }
  22.       unset %bet_pause
  23.       .msg $chan ( $+ $nick $+ ): The BET has been resumed.
  24.     }
  25.     if ($2 == pause) {
  26.       if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  27.       if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  28.       if (%bet_pause) { .msg $chan ( $+ $nick $+ ): Error, The BET is already paused! | return }
  29.       set -e %bet_pause $nick
  30.       .msg $chan ( $+ $nick $+ ): The BET has been paused.
  31.     }
  32.     if ($2 == result) || ($2 == results) {
  33.       if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  34.       if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  35.       if (!$3) { .msg $chan ( $+ $nick $+ ): Error, Try again and enter the result win or lose . | return }
  36.       if ($3 == win) || ($3 == won) {
  37.         if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  38.         .msg $chan ( $+ $nick $+ ) The BET has been stopped to win..
  39.         if (!%bet_win) { .msg $chan ( $+ $nick $+ ): There is NOT any user bet at win. }
  40.         elseif (%bet_win) { .msg $chan ( $+ $nick $+ ): The BET nick(s) are %bet_win - (Total: $numtok(%bet_win,44) $+ ) }
  41.         if (%bet_lose) { bet_delpoints $chan %bet_lose }
  42.         if (%bet_win) { bet_addpoints $chan %bet_win }
  43.         unset %bet_win %bet_lose %bet %bet_pause
  44.       }
  45.       if ($3 == lose) || ($3 == lost) {
  46.         if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  47.         .msg $chan ( $+ $nick $+ ) The BET has been stopped to lose..
  48.         if (!%bet_lose) { .msg $chan ( $+ $nick $+ ): There is NOT any user bet at lose. }
  49.         elseif (%bet_lose) { .msg $chan ( $+ $nick $+ ): The BET nick(s) are %bet_lose - (Total: $numtok(%bet_lose,44) $+ ) }
  50.         if (%bet_lose) { bet_addpoints $chan %bet_lose }
  51.         if (%bet_win) { bet_delpoints $chan %bet_win }
  52.         unset %bet_win %bet_lose %bet %bet_pause
  53.       }
  54.     }
  55.   }
  56.   if ($1 == !win) {
  57.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  58.     if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  59.     if (%bet_pause) { return }
  60.     var %fix = $chan $+ . $+ $nick
  61.     var %p = $readini(Points.ini,n,%fix,Points)
  62.     if (!%p) { .msg $chan ( $+ $nick $+ ): Error, You have NOT any points award yet, you must have at least 25 points to enter the bet! | return }
  63.     if (%p < 25) { .msg $chan ( $+ $nick $+ ): Error, You have %p points but you must have at least 25 points to enter the bet! | return }
  64.     if ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at win! | return }
  65.     if ($istok(%bet_lose,$nick,44)) { set -e %bet_lose $remtok(%bet_lose,$nick,1,44) | var %ch = 1 }
  66.     set -e %bet_win $addtok(%bet_win,$nick,44)
  67.     .msg $chan ( $+ $nick $+ ): You $iif(%ch,have change your,have) bet at win. - Good luck!
  68.   }
  69.   if ($1 == !lose) || ($1 == !lost) {
  70.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  71.     if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  72.     if (%bet_pause) { return }
  73.     var %fix = $chan $+ . $+ $nick
  74.     var %p = $readini(Points.ini,n,%fix,Points)
  75.     if (!%p) { .msg $chan ( $+ $nick $+ ): Error, You have NOT any points award yet, you must have at least 25 points to enter the bet! | return }
  76.     if (%p < 25) { .msg $chan ( $+ $nick $+ ): Error, You have %p points but you must have at lease 25 points to enter the bet! | return }
  77.     if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at lose! | return }
  78.     if ($istok(%bet_win,$nick,44)) { set -e %bet_win $remtok(%bet_win,$nick,1,44) | var %ch = 1 }
  79.     set -e %bet_lose $addtok(%bet_lose,$nick,44)
  80.     .msg $chan ( $+ $nick $+ ): You $iif(%ch,have change your,have) bet at lose. - Good luck!
  81.   }
  82.   if ($1 == !remove) {
  83.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  84.     if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  85.     if (%bet_pause) { return }
  86.     if ($istok(%bet_lose,$nick,44)) { set -e %bet_lose $remtok(%bet_lose,$nick,1,44) | .msg $chan ( $+ $nick $+ ): You have been removed from the bet at lose! }
  87.     elseif ($istok(%bet_win,$nick,44)) { set -e %bet_win $remtok(%bet_win,$nick,1,44) | .msg $chan ( $+ $nick $+ ): You have been removed from the bet at win! }
  88.     else { .msg $chan ( $+ $nick $+ ): Error, You have NOT bet yet! }
  89.   }
  90.   if ($1 == !results) || ($1 == !stats) {
  91.     if (!$check_mod($nick,$chan)) { .msg $chan ( $+ $nick $+ ): Error, You are NOT an channel moderator! | return }
  92.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  93.     if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  94.     if (%bet_pause) { return }
  95.     .msg $chan ( $+ $nick $+ ): Bet(s) at win: $iif(%bet_win,$numtok(%bet_win,44),0)
  96.     .msg $chan ( $+ $nick $+ ): Bet(s) at lose: $iif(%bet_lose,$numtok(%bet_lose,44),0)
  97.     .msg $chan ( $+ $nick $+ ): Total Bet(s): $calc($iif(%bet_win,$numtok(%bet_win,44),0) + $iif(%bet_lose,$numtok(%bet_lose,44),0))
  98.   }
  99.   if ($1 == !mybet) {
  100.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  101.     if (!%bet) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any BET running try again later or use !bet open to start a new bet! | return }
  102.     if (%bet_pause) { return }
  103.     if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at lose! }
  104.     elseif ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at win! }
  105.     else { .msg $chan ( $+ $nick $+ ): Error, You have NOT bet yet! }
  106.   }
  107.   if ($1 == !bethelp) { .msg $chan ( $+ $nick $+ ): BET Commands are: !Bet open - !Bet stop - !Bet pause - !Bet resume - !Bet result win/lose - !win - !lose - !remove - !results - !mybet }
  108. }
  109.  
  110. alias check_mod {
  111.   if (!$1) { return }
  112.   if (!$2) { return }
  113.   if ($me !ison $2) { return 0 }
  114.   if ($1 !ison $2) { return 0 }
  115.   var %f = mods.txt
  116.   if (!$isfile(%f)) { return 0 }
  117.   if (!$lines(%f)) { return 0 }
  118.   var %r = $read(%f,nw,$1)
  119.   if (%r) { return 1 }
  120.   elseif (!%r) { return 0 }
  121. }
  122.  
  123. alias bet_addpoints {
  124.   if (!$1) { return }
  125.   if (!%bet) { return }
  126.   var %GIVE_POINTS = 25
  127.   var %c = $1
  128.   var %l = $2
  129.   var %t = $numtok(%l,44)
  130.   var %i = 1
  131.   while (%i <= %t) {
  132.     var %n = $gettok(%l,%i,44)
  133.     var %fix = %c $+ . $+ %n
  134.     var %p = $calc($readini(Points.ini,%fix,Points) + %give_points)
  135.     if (%n) { writeini -n $qt(Points.ini) %fix Points %p }
  136.     inc %i
  137.   }
  138. }
  139.  
  140. alias bet_delpoints {
  141.   if (!$1) { return }
  142.   if (!%bet) { return }
  143.   var %TAKE_POINTS = 25
  144.   var %c = $1
  145.   var %l = $2
  146.   var %t = $numtok(%l,44)
  147.   var %i = 1
  148.   while (%i <= %t) {
  149.     var %n = $gettok(%l,%i,44)
  150.     var %fix = %c $+ . $+ %n
  151.     var %p = $calc($readini(Points.ini,%fix,Points) - %take_points)
  152.     if (%n) { writeini -n $qt(Points.ini) %fix Points %p }
  153.     inc %i
  154.   }
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement