Switch to edit mode.
Name(s): b*et ebt1: maxbet = 500000.0
2: money = 0
3: if (player:isa($project))
4: return player:tell("Hmm, let me think...no.")
5: endif
6: argstr = strsub(argstr, "$", "")
7: if (!is_player(player) || player:isa($project))
8: raise(E_PERM)
9: elseif (!listassoc(this.lastbet, player))
10: this.lastbet = {@this.lastbet, {player, 1000.0}}
11: elseif (gs = this:gs(player))
12: return player:tell("You still have an unfinished game that you started ", ctime(gs[2]), ".")
13: endif
14: if (!(player in $list_utils:slice(this.money)))
15: this:increase_money(player, 1000.0)
16: endif
17: money = this:money(player)
18: if (argstr)
19: tobet = tofloat(argstr + ".0")
20: else
21: tobet = listassoc(this.lastbet, player)[2]
22: endif
23: if (money && money < tobet)
24: if (money > 999.0)
25: return player:tell("You can't afford it. You have ", this:m_string(money), " left.")
26: else
27: return player:tell("You can't afford it. You have ", this:m_string(money), " left. When you're broke, you will be given $1,000.")
28: endif
29: elseif (!money)
30: player:tell("You're broke! Someone gives you $1,000 in free chips.")
31: this:increase_money(player, 1000)
32: if (!(tobet < 1001.0))
33: return player:tell("Please bet again.")
34: endif
35: endif
36: if (tobet <= 0.0)
37: return player:tell("Please bet again.")
38: elseif (tobet > this:money(player))
39: return player:tell("It looks like you can't afford it. Hehe.")
40: elseif (tobet > maxbet)
41: return player:tell("The maximum amount you're allowed to bet is $500,000.")
42: endif
43: bet = tobet
44: this.lastbet[$list_utils:iassoc(player, this.lastbet)][2] = tobet
45: player:tell("You bet ", this:m_string(bet), ".")
46: this:decrease_money(player, bet)
47: this.games = {@this.games, {player, time(), $list_utils:randomly_permute(this.default_deck), {}, {}, 0, 0, bet, 0}}
48: ".games: {person,time,{deck}, {dealer's cards}, {person's cards}, 0, stood, bet}"
49: this.betted = this.betted + 1
50: "$md:even(player);"
51: this:deal()
52: "Last modified by James (#6397) on Tue Mar 13 19:28:28 2007 EDT."