Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Modified
- ; Adding support for !win <points> and !lose <points>
- ON !*:TEXT:*:#: {
- tokenize 32 $strip($1-)
- if ($1 == !bet) {
- if (!$check_mod($nick,$chan)) { .msg $chan ( $+ $nick $+ ): Error, You are NOT an channel moderator! | return }
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Try again and enter the correct value, more info at !bethelp | return }
- if ($2 == open) || ($2 == start) || ($2 == on) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- if (%bet) { .msg $chan ( $+ $nick $+ ): Error, There is already an BET running try again later or use !bet stop to stop the bet! | return }
- set -e %bet $nick $chan
- .msg $chan ( $+ $nick $+ ): The BET has been started, use now !win <points> or !lose <points> to enter the bet.
- }
- if ($2 == stop) || ($2 == end) || ($2 == off) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- unset %bet_win %bet_lose %bet %bet_pause
- .msg $chan ( $+ $nick $+ ): The BET has been stopped.
- }
- if ($2 == resume) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (!%bet_pause) { .msg $chan ( $+ $nick $+ ): Error, There is NOT any bet paused since now! | return }
- unset %bet_pause
- .msg $chan ( $+ $nick $+ ): The BET has been resumed.
- }
- if ($2 == pause) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (%bet_pause) { .msg $chan ( $+ $nick $+ ): Error, The BET is already paused! | return }
- set -e %bet_pause $nick
- .msg $chan ( $+ $nick $+ ): The BET has been paused.
- }
- if ($2 == result) || ($2 == results) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (!$3) { .msg $chan ( $+ $nick $+ ): Error, Try again and enter the result win or lose . | return }
- if ($3 == win) || ($3 == won) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- .msg $chan ( $+ $nick $+ ) The BET has been stopped to win..
- if (!%bet_win) { .msg $chan ( $+ $nick $+ ): There is NOT any user bet at win. }
- elseif (%bet_win) { .msg $chan ( $+ $nick $+ ): The BET nick(s) are %bet_win - (Total: $numtok(%bet_win,44) $+ ) }
- if (%bet_lose) { bet_delpoints $chan %bet_lose }
- if (%bet_win) { bet_addpoints $chan %bet_win }
- unset %bet_win %bet_lose %bet %bet_pause %bet_ [ $+ [ $chan ] $+ ] _*
- }
- if ($3 == lose) || ($3 == lost) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- .msg $chan ( $+ $nick $+ ) The BET has been stopped to lose..
- if (!%bet_lose) { .msg $chan ( $+ $nick $+ ): There is NOT any user bet at lose. }
- elseif (%bet_lose) { .msg $chan ( $+ $nick $+ ): The BET nick(s) are %bet_lose - (Total: $numtok(%bet_lose,44) $+ ) }
- if (%bet_lose) { bet_addpoints $chan %bet_lose }
- if (%bet_win) { bet_delpoints $chan %bet_win }
- unset %bet_win %bet_lose %bet %bet_pause %bet_ [ $+ [ $chan ] $+ ] _*
- }
- }
- }
- if ($1 == !win) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a bet number! | return }
- if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify only numbers! | return }
- if (%bet_pause) { return }
- var %fix = $chan $+ . $+ $nick
- var %p = $readini(Points.ini,n,%fix,Points)
- var %po = %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points
- if (!%p) { .msg $chan ( $+ $nick $+ ): Error, You have NOT any points award yet! | return }
- if ($2 > %p) { .msg $chan ( $+ $nick $+ ): Error, Your points are %p so you cannot use a larger number! | return }
- if ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at win with %po bet points! | return }
- if ($istok(%bet_lose,$nick,44)) { set -e %bet_lose $remtok(%bet_lose,$nick,1,44) | var %ch = 1 }
- set -e %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points $2
- set -e %bet_win $addtok(%bet_win,$nick,44)
- .msg $chan ( $+ $nick $+ ): You have $iif(%ch,change your) bet at win with $2 bet points. - Good luck!
- }
- if ($1 == !lose) || ($1 == !lost) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a bet number! | return }
- if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify only numbers! | return }
- if (%bet_pause) { return }
- var %fix = $chan $+ . $+ $nick
- var %p = $readini(Points.ini,n,%fix,Points)
- var %po = %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points
- if (!%p) { .msg $chan ( $+ $nick $+ ): Error, You have NOT any points award yet! | return }
- if ($2 > %p) { .msg $chan ( $+ $nick $+ ): Error, Your points are %p so you cannot use a larger number! | return }
- if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at lose with %po bet points! | return }
- if ($istok(%bet_win,$nick,44)) { set -e %bet_win $remtok(%bet_win,$nick,1,44) | var %ch = 1 }
- set -e %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points $2
- set -e %bet_lose $addtok(%bet_lose,$nick,44)
- .msg $chan ( $+ $nick $+ ): You have $iif(%ch,change your) bet at lose with $2 bet points. - Good luck!
- }
- if ($1 == !remove) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (%bet_pause) { return }
- var %po = %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points
- if ($istok(%bet_lose,$nick,44)) { set -e %bet_lose $remtok(%bet_lose,$nick,1,44) | unset %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points | .msg $chan ( $+ $nick $+ ): You have been removed from the bet at lose with %po bet points! }
- elseif ($istok(%bet_win,$nick,44)) { set -e %bet_win $remtok(%bet_win,$nick,1,44) | unset %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points | .msg $chan ( $+ $nick $+ ): You have been removed from the bet at win with %po bet points! }
- else { .msg $chan ( $+ $nick $+ ): Error, You have NOT bet yet! }
- }
- if ($1 == !results) || ($1 == !stats) {
- if (!$check_mod($nick,$chan)) { .msg $chan ( $+ $nick $+ ): Error, You are NOT an channel moderator! | return }
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (%bet_pause) { return }
- .msg $chan ( $+ $nick $+ ): Bet(s) at win: $iif(%bet_win,$numtok(%bet_win,44),0)
- .msg $chan ( $+ $nick $+ ): Bet(s) at lose: $iif(%bet_lose,$numtok(%bet_lose,44),0)
- .msg $chan ( $+ $nick $+ ): Total Bet(s): $calc($iif(%bet_win,$numtok(%bet_win,44),0) + $iif(%bet_lose,$numtok(%bet_lose,44),0))
- }
- if ($1 == !mybet) {
- if (%bet) && ($gettok(%bet,2,32) !== $chan) { return }
- 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 }
- if (%bet_pause) { return }
- var %po = %bet_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _points
- if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at lose with %po bet points! }
- elseif ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at win with %po bet points! }
- else { .msg $chan ( $+ $nick $+ ): Error, You have NOT bet yet! }
- }
- 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 }
- }
- alias check_mod {
- if (!$1) { return }
- if (!$2) { return }
- if ($me !ison $2) { return 0 }
- if ($1 !ison $2) { return 0 }
- var %f = mods.txt
- if (!$isfile(%f)) { return 0 }
- if (!$lines(%f)) { return 0 }
- var %r = $read(%f,nw,$1)
- if (%r) { return 1 }
- elseif (!%r) { return 0 }
- }
- alias bet_addpoints {
- if (!$1) { return }
- if (!%bet) { return }
- var %c = $1
- var %l = $2
- var %t = $numtok(%l,44)
- var %i = 1
- while (%i <= %t) {
- var %n = $gettok(%l,%i,44)
- var %fix = %c $+ . $+ %n
- var %po = %bet_ [ $+ [ $1 ] $+ ] _ [ $+ [ %n ] $+ ] _points
- var %p = $calc($readini(Points.ini,%fix,Points) + %po)
- if (%n) && (%po) && (%p) { writeini -n $qt(Points.ini) %fix Points %p }
- inc %i
- }
- }
- alias bet_delpoints {
- if (!$1) { return }
- if (!%bet) { return }
- var %c = $1
- var %l = $2
- var %t = $numtok(%l,44)
- var %i = 1
- while (%i <= %t) {
- var %n = $gettok(%l,%i,44)
- var %fix = %c $+ . $+ %n
- var %po = %bet_ [ $+ [ $1 ] $+ ] _ [ $+ [ %n ] $+ ] _points
- var %p = $calc($readini(Points.ini,%fix,Points) - %po)
- if (%n) && (%po) && (%p) { writeini -n $qt(Points.ini) %fix Points %p }
- inc %i
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement