ON !*:TEXT:*:#: {
tokenize 32 $strip($1-,burci)
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 or !lose 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) $+ ) }
bet_addpoints $chan %bet_win
if (%bet_lose) { bet_delpoints $chan %bet_lose }
unset %bet_win %bet_lose %bet %bet_pause
}
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) $+ ) }
bet_delpoints $chan %bet_lose
if (%bet_win) { bet_addpoints $chan %bet_win }
unset %bet_win %bet_lose %bet %bet_pause
}
}
}
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 (%bet_pause) { return }
var %fix = $chan $+ . $+ $nick
var %p = $readini(Points.ini,n,%fix,Points)
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 }
if (%p < 25) { .msg $chan ( $+ $nick $+ ): Error, You have %p points but you must have at least 25 points to enter the bet! | return }
if ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at win! | return }
if ($istok(%bet_lose,$nick,44)) { set -e %bet_lose $remtok(%bet_lose,$nick,1,44) | var %ch = 1 }
set -e %bet_win $addtok(%bet_win,$nick,44)
.msg $chan ( $+ $nick $+ ): You $iif(%ch,have change your,have) bet at win. - 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 (%bet_pause) { return }
var %fix = $chan $+ . $+ $nick
var %p = $readini(Points.ini,n,%fix,Points)
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 }
if (%p < 25) { .msg $chan ( $+ $nick $+ ): Error, You have %p points but you must have at lease 25 points to enter the bet! | return }
if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): Error, You have already bet at lose! | return }
if ($istok(%bet_win,$nick,44)) { set -e %bet_win $remtok(%bet_win,$nick,1,44) | var %ch = 1 }
set -e %bet_lose $addtok(%bet_lose,$nick,44)
.msg $chan ( $+ $nick $+ ): You $iif(%ch,have change your,have) bet at lose. - 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 }
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! }
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! }
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 }
if ($istok(%bet_lose,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at lose! }
elseif ($istok(%bet_win,$nick,44)) { .msg $chan ( $+ $nick $+ ): You have bet at win! }
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 %GIVE_POINTS = 25
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 %p = $calc($readini(Points.ini,%fix,Points) + %give_points)
if (%n) { writeini -n $qt(Points.ini) %fix Points %p }
inc %i
}
}
alias bet_delpoints {
if (!$1) { return }
if (!%bet) { return }
var %TAKE_POINTS = 25
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 %p = $calc($readini(Points.ini,%fix,Points) - %take_points)
if (%n) { writeini -n $qt(Points.ini) %fix Points %p }
inc %i
}
}