Advertisement
westor

BET Module (Modified) for FuryRang v1.0

Feb 10th, 2015
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 8.29 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 !beton 1 or !beton 2 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 == 1) {
  37.         if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  38.         .msg $chan ( $+ $nick $+ ) The BET has been stopped to option 1..
  39.         if (!%bet_win) { .msg $chan ( $+ $nick $+ ): There is NOT any user bet at 1. }
  40.         elseif (%bet_win) { .msg $chan ( $+ $nick $+ ): The BET nick(s) are %bet_win - (Total: $numtok(%bet_win,44) $+ ) }
  41.         bet_addpoints $chan %bet_win
  42.         if (%bet_lose) { bet_delpoints $chan %bet_lose }
  43.         unset %bet_win %bet_lose %bet %bet_pause
  44.       }
  45.       if ($3 == 2) {
  46.         if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  47.         .msg $chan ( $+ $nick $+ ) The BET has been stopped to option 2..
  48.         if (!%bet_lose) { .msg $chan ( $+ $nick $+ ): There is NOT any user bet at 2. }
  49.         elseif (%bet_lose) { .msg $chan ( $+ $nick $+ ): The BET nick(s) are %bet_lose - (Total: $numtok(%bet_lose,44) $+ ) }
  50.         bet_delpoints $chan %bet_lose
  51.         if (%bet_win) { bet_addpoints $chan %bet_win }
  52.         unset %bet_win %bet_lose %bet %bet_pause
  53.       }
  54.     }
  55.   }
  56.   if ($1 == !beton) {
  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.     if ($2 == 1) {
  61.       var %fix = $chan $+ . $+ $nick
  62.       var %p = $readini(Points.ini,n,%fix,Points)
  63.       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 }
  64.       if (%p < 25) { .msg $chan ( $+ $nick $+ ): Error, You have %p points but you must have at least 25 points to enter the bet! | return }
  65.       if ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at 1! | return }
  66.       if ($istok(%bet_lose,$nick,44)) { set -e %bet_lose $remtok(%bet_lose,$nick,1,44) | var %ch = 1 }
  67.       set -e %bet_win $addtok(%bet_win,$nick,44)
  68.       .msg $chan ( $+ $nick $+ ): You $iif(%ch,have change your,have) bet at 1. - Good luck!
  69.     }
  70.     elseif ($2 == 2) {
  71.       var %fix = $chan $+ . $+ $nick
  72.       var %p = $readini(Points.ini,n,%fix,Points)
  73.       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 }
  74.       if (%p < 25) { .msg $chan ( $+ $nick $+ ): Error, You have %p points but you must have at lease 25 points to enter the bet! | return }
  75.       if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at 2! | return }
  76.       if ($istok(%bet_win,$nick,44)) { set -e %bet_win $remtok(%bet_win,$nick,1,44) | var %ch = 1 }
  77.       set -e %bet_lose $addtok(%bet_lose,$nick,44)
  78.       .msg $chan ( $+ $nick $+ ): You $iif(%ch,have change your,have) bet at 2. - Good luck!
  79.     }
  80.   }
  81.   if ($1 == !remove) {
  82.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  83.     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 }
  84.     if (%bet_pause) { return }
  85.     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 2! }
  86.     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 1! }
  87.     else { .msg $chan ( $+ $nick $+ ): Error, You have NOT bet yet! }
  88.   }
  89.   if ($1 == !results) || ($1 == !stats) {
  90.     if (!$check_mod($nick,$chan)) { .msg $chan ( $+ $nick $+ ): Error, You are NOT an channel moderator! | return }
  91.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  92.     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 }
  93.     if (%bet_pause) { return }
  94.     .msg $chan ( $+ $nick $+ ): Bet(s) at 1: $iif(%bet_win,$numtok(%bet_win,44),0)
  95.     .msg $chan ( $+ $nick $+ ): Bet(s) at 2: $iif(%bet_lose,$numtok(%bet_lose,44),0)
  96.     .msg $chan ( $+ $nick $+ ): Total Bet(s): $calc($iif(%bet_win,$numtok(%bet_win,44),0) + $iif(%bet_lose,$numtok(%bet_lose,44),0))
  97.   }
  98.   if ($1 == !mybet) {
  99.     if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
  100.     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 }
  101.     if (%bet_pause) { return }
  102.     if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at lose! }
  103.     elseif ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at win! }
  104.     else { .msg $chan ( $+ $nick $+ ): Error, You have NOT bet yet! }
  105.   }
  106.   if ($1 == !bethelp) { .msg $chan ( $+ $nick $+ ): BET Commands are: !Bet open - !Bet stop - !Bet pause - !Bet resume - !Bet result 1/2 - !Beton 1 - !Beton 2 - !remove - !results - !mybet }
  107. }
  108.  
  109. alias check_mod {
  110.   if (!$1) { return }
  111.   if (!$2) { return }
  112.   if ($me !ison $2) { return 0 }
  113.   if ($1 !ison $2) { return 0 }
  114.   var %f = mods.txt
  115.   if (!$isfile(%f)) { return 0 }
  116.   if (!$lines(%f)) { return 0 }
  117.   var %r = $read(%f,nw,$1)
  118.   if (%r) { return 1 }
  119.   elseif (!%r) { return 0 }
  120. }
  121.  
  122. alias bet_addpoints {
  123.   if (!$1) { return }
  124.   if (!%bet) { return }
  125.   var %GIVE_POINTS = 25
  126.   var %c = $1
  127.   var %l = $2
  128.   var %t = $numtok(%l,44)
  129.   var %i = 1
  130.   while (%i <= %t) {
  131.     var %n = $gettok(%l,%i,44)
  132.     var %fix = %c $+ . $+ %n
  133.     var %p = $calc($readini(Points.ini,%fix,Points) + %give_points)
  134.     if (%n) { writeini -n $qt(Points.ini) %fix Points %p }
  135.     inc %i
  136.   }
  137. }
  138.  
  139. alias bet_delpoints {
  140.   if (!$1) { return }
  141.   if (!%bet) { return }
  142.   var %TAKE_POINTS = 25
  143.   var %c = $1
  144.   var %l = $2
  145.   var %t = $numtok(%l,44)
  146.   var %i = 1
  147.   while (%i <= %t) {
  148.     var %n = $gettok(%l,%i,44)
  149.     var %fix = %c $+ . $+ %n
  150.     var %p = $calc($readini(Points.ini,%fix,Points) - %take_points)
  151.     if (%n) { writeini -n $qt(Points.ini) %fix Points %p }
  152.     inc %i
  153.   }
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement