on *:TEXT:!Blackjack:#: { if (%blackjack [ $+ [ $address($nick,2) ] ] == $true) notice $nick You're already in a game else { unset %total [ $+ [ $address($nick,2) ] ] set %blackjack [ $+ [ $address($nick,2) ] ] $true set %card1 [ $+ [ $address($nick,2) ] ] $r(1,13) set %card2 [ $+ [ $address($nick,2) ] ] $r(1,13) notice $nick The dealer gives you $card(%card1 [ $+ [ $address($nick,2) ] ],$nick) of $ccolor and $card(%card2 [ $+ [ $address($nick,2) ] ],$nick) of $ccolor $+ . You have $card(total,$nick,2) in your hands now. if ($card(total,$nick,2) == 21) { writeini blackjack.ini Win $address($nick,2) $calc($readini(blackjack.ini,win,$address($nick,2) + 1) writeini blackjack.ini Blackjack $address($nick,2) $calc($readini(blackjack.ini,blackjack,$address($nick,2)) + 1) notice $nick Congratulations, you have blackjack! unset % $+ * [ $+ [ $address($nick,2) ] ] winlosecounter $nick } } } alias card { if ($1 == total) { if ($3) set %total [ $+ [ $address($2,2) ] ] $calc($value(%card1 [ $+ [ $address($2,2) ] ]) + $value(%card2 [ $+ [ $address($2,2) ] ])) elseif (!$3) set %total [ $+ [ $address($2,2) ] ] $calc(%total [ $+ [ $address($2,2) ] ] + $value(%card [ $+ [ %hit [ $+ [ $address($2,2) ] ] ] ] [ $+ [ $address($2,2) ] ])) if (%total [ $+ [ $address($2,2) ] ] > 21) && (!%acecount [ $+ [ $address($2,2) ] ]) { notice $nick You're busted! You have a total of %total [ $+ [ $address($2,2) ] ] $+ . writeini blackjack.ini los $address($nick,2) $calc($readini(blackjack.ini,los,$address($nick,2)) + 1) unset % $+ * [ $+ [ $address($2,2) ] ] winlosecounter $2 } elseif (%total [ $+ [ $address($2,2) ] ] > 21) { dec %acecount [ $+ [ $address($2,2) ] ] if (%acecount [ $+ [ $address($2,2) ] ] == 0) unset %acecount [ $+ [ $address($2,2) ] ] dec %total [ $+ [ $address($2,2) ] ] 10 } return %total [ $+ [ $address($2,2) ] ] } if ($1 == 1) { inc %acecount [ $+ [ $address($2,2) ] ] return an Ace } if ($1 == 2) return a Two if ($1 == 3) return a Three if ($1 == 4) return a Four if ($1 == 5) return a Five if ($1 == 6) return a Six if ($1 == 7) return a Seven if ($1 == 8) return an Eight if ($1 == 9) return a Nine if ($1 == 10) return a Ten if ($1 == 11) return a Jack if ($1 == 12) return a Queen if ($1 == 13) return a King } alias value { if ($1 isnum 2-10) return $1 if ($1 isnum 11-13) return 10 if ($1 == 1) return 11 } on *:TEXT:!Hit:#: { if (%blackjack [ $+ [ $address($nick,2) ] ] == $true) { if (!%hit [ $+ [ $address($nick,2) ] ]) set %hit [ $+ [ $address($nick,2) ] ] 3 else inc %hit [ $+ [ $address($nick,2) ] ] set %card [ $+ [ %hit [ $+ [ $address($nick,2) ] ] ] ] [ $+ [ $address($nick,2) ] ] $r(1,13) notice $nick The dealer gives you $card(%card [ $+ [ %hit [ $+ [ $address($nick,2) ] ] ] ] [ $+ [ $address($nick,2) ] ]) of $ccolor $+ . You have $card(total,$nick) in your hands now. } } on *:TEXT:!Stand:#: { var %x = $r(1,3) if (%x == 1) var %j = $r(22,25) else var %h = $r(17,21) notice $nick The dealer has $iif(%j,$v1,%h) $+ . You have %total [ $+ [ $address($nick,2) ] ] $+ . $iif(%h > %total [ $+ [ $address($nick,2) ] ],You lost.,You won!) if (%h < %total [ $+ [ $address($nick,2) ] ]) || (!%h) writeini blackjack.ini win $address($nick,2) $calc($readini(blackjack.ini,win,$address($nick,2)) + 1) else writeini blackjack.ini los $address($nick,2) $calc($readini(blackjack.ini,los,$address($nick,2)) + 1) unset % $+ * [ $+ [ $address($nick,2) ] ] winlosecounter $nick } alias ccolor { var %color = $r(1,4) if (%color == 1) return Diamands if (%color == 2) return Hearts if (%color == 3) return Spades if (%color == 4) return Clubs } alias winlosecounter { if ($1 == on) { set %winlose on //echo -a The win/lose counter is now on. } elseif ($1 == off) { unset %winlose //echo -a The win/lose counter is now ff. } elseif (%winlose == on) notice $nick Your Wins: $iif($readini(blackjack.ini,win,$address($nick,2)),$v1,0) Losses: $iif($readini(blackjack.ini,los,$address($nick,2)),$v1,0) Blackjacks: $iif($readini(blackjack.ini,Blackjack,$address($nick,2)),$v1,0) halt }