G2A Many GEOs
SHARE
TWEET

Blackjack - ComputerCraft

HyperQ Mar 15th, 2013 576 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   --[[ Blackjack Game V2.0 ]]--
  2. --[[ Created By ChiknNuggets ]]--
  3.  
  4. local CardName = {"Ace of Spades", "Ace Of Clubs", "Ace Of Hearts", "Ace Of Diamonds", "2 of Spades", "2 of Clubs", "2 of Hearts", "2 of Diamonds", "3 of Spades", "3 of Clubs", "3 of Hearts", "3 of Diamonds", "4 of Spades", "4 of Clubs", "4 of Hearts", "4 of Diamonds", "5 of Spades", "5 of Clubs", "5 of Hearts", "5 of Diamonds", "6 of Spades", "6 of Clubs", "6 of Hearts", "6 of Diamonds", "7 of Spades", "7 of Clubs", "7 of Hearts", "7 of Diamonds", "8 of Spades", "8 of Clubs", "8 of Hearts", "8 of Diamonds", "9 of Spades", "9 of Clubs", "9 of Hearts", "9 of Diamonds", "10 of Clubs", "10 of Spades", "10 of Hearts", "10 of Diamonds", "Jack of Clubs", "Jack of Spades", "Jack of Hearts", "Jack of Diamonds", "Queen of Clubs", "Queen of Spades", "Queen of Hearts", "Queen of Diamonds", "King of Clubs", "King of Spades", "King of Hearts", "King of Diamonds"}
  5. local CardValue = {11, 11, 11, 11, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}
  6. local StartingCash = 500 -- How Much cash the person starts with
  7. local playersCards = {}
  8. local dealervisibleCards = {}
  9. local dealerhiddenCards = {}
  10. local AcesD = 0
  11. local AcesDh = 0
  12. local AcesP = 0
  13. local playercount = 0
  14. local dealervisiblecount = 0
  15. local dealerhiddencount = 0
  16. local dealertotalcount = 0
  17. local stay = false
  18. local broke = false
  19. local Cash = StartingCash
  20.  
  21. local function quit()
  22.         term.setBackgroundColor(colors.black)
  23.         term.setTextColor(colors.yellow)
  24.         term.setCursorPos(1,1)
  25.         term.clear()
  26.         error()
  27. end
  28.  
  29. local function getColourOf(hex)
  30.     local value = tonumber(hex, 16)
  31.     if not value then return nil end
  32.     value = math.pow(2,value)
  33.     return value
  34. end
  35.  
  36. function math.randomEx(minv,maxv)
  37.     local bExcluded
  38.     local restricted = {}
  39.         for i=1,#playersCards do table.insert(restricted,playersCards[i]) end
  40.         for i=1,#dealervisibleCards do table.insert(restricted,dealervisibleCards[i]) end
  41.         for i=1,#dealerhiddenCards do table.insert(restricted,dealerhiddenCards[i]) end
  42.     local iNum
  43.     repeat
  44.         bExcluded = false;
  45.         iNum = math.random(minv,maxv)
  46.         for _, iVal in ipairs( restricted ) do
  47.             if iNum == tonumber(iVal) then
  48.                 bExcluded = true
  49.                 break
  50.             end
  51.         end
  52.     until not bExcluded
  53.     return iNum
  54. end
  55.  
  56. local function drawPictureTable(image, xinit, yinit)
  57.     for y=1,#image do
  58.         for x=1,#image[y] do
  59.             term.setCursorPos(xinit + x-1, yinit + y-1)
  60.             local col = getColourOf(string.sub(image[y], x, x))
  61.             if col ~= nil then
  62.                 term.setBackgroundColour(col)
  63.                 term.write(" ")
  64.             end
  65.         end
  66.     end
  67. end
  68.  
  69. local function GUIdrawAll()
  70.         drawPictureTable(
  71.         {"fffffffffffffffffffffffffffffffffffffffffffffffffff",
  72.          "fffffffffffffffffffffffffffffffffffffffffffffffffff",
  73.          "f888888888888888888888888888888888888888888888888ff",
  74.          "f888888888888888888888888888888888888888888888888ff",
  75.          "f888888888888888888888888888888888888888888888888ff",
  76.          "f888888888888888888888888888888888888888888888888ff",
  77.          "f888888888888888888888888888888888888888888888888ff",
  78.          "f888888888888888888888888888888888888888888888888ff",
  79.          "f8888888888888888888fffffffffff888888888888888888ff",
  80.          "fffffffffffffffffffff444444444fffffffffffffffffffff",
  81.          "fffffffffffffffffffffffffffffffffffffffffffffffffff",
  82.          "f888888888888888888888888888888888888ff4444444444ff",
  83.          "f888888888888888888888888888888888888ffffffffffffff",
  84.          "f888888888888888888888888888888888888888888888888ff",
  85.          "f888888888888888888888888888888888888888888888888ff",
  86.          "f888888888888888888888888888888888888888888888888ff",
  87.          "f888888888888888888888888888888888888888888888888ff",
  88.          "f888888888888888888888888888888888888888888888888ff",
  89.          "fffffffffffffffffffffffffffffffffffffffffffffffffff"},1,1)
  90.         term.setCursorPos(3,2)
  91.         term.setTextColor(colors.white)
  92.         term.setBackgroundColor(colors.black)
  93.         write("Dealers Hand:")
  94.         term.setCursorPos(51,1)
  95.         write("X")
  96.         term.setCursorPos(3,11)
  97.         write("Your Hand:")
  98.         term.setCursorPos(40,11)
  99.         write("Your Cash:")
  100.         term.setCursorPos(23,9)
  101.         write("The Pot")
  102.         term.setTextColor(colors.black)
  103.         term.setBackgroundColor(colors.yellow)
  104.         term.setCursorPos(40,12)
  105.         write("$"..Cash)
  106.         if pot then term.setCursorPos(22+(string.len("$"..pot)/2),10);write("$"..pot) end
  107. end
  108.  
  109. local function hitstand()
  110.         drawPictureTable({"fffffffffffff","ffeeeeeeeeeef","fffffffffffff","ff5555555555f","fffffffffffff"},38,15)
  111.         term.setCursorPos(43,16)
  112.         term.setBackgroundColor(colors.red)
  113.         term.setTextColor(colors.white)
  114.         write("Hit")
  115.         term.setCursorPos(43,18)
  116.         term.setBackgroundColor(colors.lime)
  117.         term.setTextColor(colors.black)
  118.         write("Stay")
  119.         while true do
  120.                 local event,p1,p2,p3 = os.pullEvent()
  121.                 if event == "mouse_click" and p1 == 1 then
  122.                         if p2 >= 40 and p2 <= 49 then
  123.                                 if p3 == 16 then -- Hit Function
  124.                                         drawPictureTable({"888888888888f","888888888888f","888888888888f","888888888888f","fffffffffffff"},38,15)
  125.                                         return 1
  126.                                 elseif p3 == 18 then -- Stand Function
  127.                                         drawPictureTable({"888888888888f","888888888888f","888888888888f","888888888888f","fffffffffffff"},38,15)
  128.                                         return 2
  129.                                 end
  130.                         elseif p2 == 51 and p3 == 1 then quit() end
  131.                 end
  132.         end
  133.        
  134.         drawPictureTable({"8888888888888","8888888888888","8888888888888","8888888888888","8888888888888"},38,15)
  135. end
  136.  
  137.  
  138. function Notify(msg,btnmsg)
  139.         drawPictureTable({"ffffffffffffffffffffffffffff","f88888888888888888888888888f","f88888888888888888888888888f","f88888888888888888888888888f","f88888888777777777788888888f","f88888888888888888888888888f","ffffffffffffffffffffffffffff"},(51-28)/2,(19-7)/2)
  140.         term.setBackgroundColor(colors.lightGray)
  141.         term.setTextColor(colors.white)
  142.         if string.len(msg) > 23 then msg = string.sub(msg,1,23-string.len(msg)) end
  143.         term.setCursorPos((51-#msg)/2,8)
  144.         write(msg)
  145.         if string.len(btnmsg) > 7 then btnmsg = string.sub(btnmsg,1,7-string.len(btnmsg)) end
  146.         term.setCursorPos((51-#btnmsg)/2,10)
  147.         term.setBackgroundColor(colors.gray)
  148.         write(btnmsg)
  149.         while true do
  150.                 local event,p1,p2,p3 = os.pullEvent()
  151.                 if event == "mouse_click" and p1 == 1 and p2 >=20 and p2 <= 29 and p3 == 10 then break
  152.                 elseif event == "mouse_click" and p1 == 1 and p2 == 51 and p3 == 1 then quit() end
  153.         end
  154. end
  155.  
  156. function PlaceBet()
  157.         local chipsize = 1
  158.         if Cash > 1 and Cash <= 5 then chipsize = 1
  159.         elseif Cash > 5 and Cash <= 25 then chipsize = 5
  160.         elseif Cash > 25 and Cash <= 100 then chipsize = 25
  161.         elseif Cash > 100 then chipsize = 100 end
  162.  
  163.         local pot = chipsize
  164.         drawPictureTable({"fffffffffffffffffffffffff","f88888888888888888888888f","f88888888888888888888888f","f88777777777777887777788f","f88444444444444884444488f","f88777777777777887777788f","f88888888888888888888888f","f88777777777777888888888f","f88888888888888888888888f","fffffffffffffffffffffffff"},12,6)
  165.         term.setBackgroundColor(colors.gray)
  166.         term.setTextColor(colors.white)
  167.         term.setCursorPos(15,9)
  168.         write("    Raise   ")
  169.         term.setCursorPos(15,11)
  170.         write("    Lower   ")
  171.         term.setCursorPos(17,13)
  172.         write("Place bet")
  173.         term.setCursorPos(29,9)
  174.         write("/\\ /\\")
  175.         term.setCursorPos(29,11)
  176.         write("\\/ \\/")
  177.         term.setCursorPos(13,6)
  178.         term.setBackgroundColor(colors.black)
  179.         term.setTextColor(colors.white)
  180.         write("Place Your Bet")
  181.         term.setBackgroundColor(colors.yellow)
  182.         term.setTextColor(colors.black)
  183.         term.setCursorPos(16+((10-string.len("$"..pot))/2),10)
  184.         print("$"..pot)
  185.         while true do
  186.                 term.setBackgroundColor(colors.yellow)
  187.                 term.setTextColor(colors.black)
  188.                 term.setCursorPos(29,10)
  189.                 print("     ")
  190.                 term.setCursorPos(27+((10-string.len("$"..chipsize))/2),10)
  191.                 print("$"..chipsize)   
  192.                 local event,p1,p2,p3 = os.pullEvent()
  193.                 if (event == "key" and p1 == 200 and Cash >= pot+chipsize) or (event == "mouse_click" and p1 == 1 and p2 >= 15 and p2 <= 26 and p3 == 9 and Cash >= pot+chipsize) and pot <= 40000 then pot = pot+chipsize
  194.                 elseif (event == "key" and p1 == 208 and Cash >=pot-chipsize and pot-chipsize > 0) or (event == "mouse_click" and p1 == 1 and p2 >= 15 and p2 <= 26 and p3 == 11 and Cash >=pot-chipsize and pot > chipsize) and pot > chipsize then pot = pot-chipsize
  195.                 elseif event == "mouse_click" and p1 == 1 and p2 >= 29 and p2 <= 33 and p3 == 9 then
  196.                         if chipsize == 1 then chipsize = 5
  197.                         elseif chipsize == 5 then chipsize = 25
  198.                         elseif chipsize == 25 then chipsize = 100
  199.                         elseif chipsize == 100 then chipsize = 500
  200.                         elseif chipsize == 500 then chipsize = 1000 end
  201.                 elseif event == "mouse_click" and p1 == 1 and p2 >= 29 and p2 <= 33 and p3 == 11 then
  202.                         if chipsize == 1000 then chipsize = 500
  203.                         elseif chipsize == 500 then chipsize = 100
  204.                         elseif chipsize == 100 then chipsize = 25
  205.                         elseif chipsize == 25 then chipsize = 5
  206.                         elseif chipsize == 5 then chipsize = 1 end
  207.                 end
  208.                
  209.                
  210.                 term.setBackgroundColor(colors.yellow)
  211.                 term.setTextColor(colors.black)
  212.                 term.setCursorPos(15,10)
  213.                 print("          ")
  214.                 term.setCursorPos(16+((10-string.len("$"..pot))/2),10)
  215.                 print("$"..pot)
  216.                 term.setCursorPos(29,10)
  217.                 print("     ")
  218.                 term.setCursorPos(27+((10-string.len("$"..chipsize))/2),10)
  219.                 print("$"..chipsize)
  220.                 if (event == "mouse_click" and p1 == 1 and p2 >= 15 and p2 <= 26 and p3 == 13) or (event == "key" and p1 == 28) then Cash = Cash-pot;return pot*2
  221.                 elseif event == "mouse_click" and p1 == 1 and p2 == 51 and p3 == 1 then quit() end
  222.         end
  223. end
  224.  
  225. function newcard(playername)
  226.         local player
  227.         local drawncard = math.randomEx(1,52)
  228.         if playername == "Player" then
  229.                 player = playersCards
  230.                 playercount = playercount + CardValue[drawncard]
  231.         elseif playername == "DealerV" then
  232.                 player = dealervisibleCards
  233.                 dealervisiblecount = dealervisiblecount + CardValue[drawncard]
  234.         elseif playername == "DealerH" then
  235.                 player = dealerhiddenCards
  236.                 dealerhiddencount = dealerhiddencount + CardValue[drawncard]
  237.         else return false end
  238.         if drawncard <= 4 then
  239.                 if playername == "Player" then
  240.                         AcesP = AcesP+1
  241.                 elseif playername == "DealerV" then
  242.                         AcesD = AcesD+1
  243.                 elseif playername == "DealerH" then
  244.                         AcesDh = AcesDh + 1    
  245.                 end
  246.         end
  247.         table.insert(player,drawncard)
  248.         CheckCounts()
  249.         refreshCards()
  250. end
  251.  
  252. function refreshCards()
  253.         term.setBackgroundColor(colors.lightGray)
  254.         term.setTextColor(colors.white)
  255.         if #playersCards > 0 and #playersCards <= 6 then
  256.                 for i=1,#playersCards do
  257.                         term.setCursorPos(2,11+i)
  258.                         print(CardName[playersCards[i]])
  259.                 end
  260.         end
  261.         if #dealerhiddenCards == 1 then
  262.                 for i=1,#dealerhiddenCards do
  263.                         term.setCursorPos(2,2+i)
  264.                         if stay == false then
  265.                                 print("*Un-Turned")
  266.                         elseif stay == true then
  267.                                 print(CardName[dealerhiddenCards[i]])
  268.                         end
  269.                 end
  270.         end
  271.         if #dealervisibleCards > 0 and #dealervisibleCards <= 5 then
  272.                 for i=1,#dealervisibleCards do
  273.                         term.setCursorPos(2,2+#dealerhiddenCards+i)
  274.                         print(CardName[dealervisibleCards[i]])
  275.                 end
  276.         end
  277.        
  278. end
  279.  
  280. function reset()
  281.         if broke == true then Cash = StartingCash end
  282.         AcesD = 0
  283.         AcesDh = 0
  284.         AcesP = 0
  285.         playercount = 0
  286.         dealervisiblecount = 0
  287.         dealerhiddencount = 0
  288.         playersCards = {}
  289.         dealervisibleCards = {}
  290.         dealerhiddenCards = {}
  291.         pot = 0
  292.         stay = false
  293. end
  294.  
  295. function CheckCounts()
  296.         if playercount > 21 and AcesP > 0 then
  297.                 playercount = playercount - 10
  298.                 AcesP = AcesP - 1
  299.                 GUIdrawAll()
  300.         end
  301.         if dealervisiblecount+dealerhiddencount > 21 and AcesD > 0 and stay == true then
  302.                 dealervisiblecount = dealervisiblecount - 10
  303.                 AcesD = AcesD - 1
  304.                 GUIdrawAll()
  305.         end
  306.        
  307.         term.setBackgroundColor(colors.black)
  308.         term.setTextColor(colors.white)
  309.         if AcesP >= 1 then
  310.                 term.setCursorPos(3,11)
  311.                 write("Your Hand: ("..playercount.."/"..(playercount-10)..")")
  312.         elseif AcesP == 0 then
  313.                 term.setCursorPos(3,11)
  314.                 write("Your Hand: ("..playercount..")")
  315.         end
  316.        
  317.         if AcesD >= 1 and stay == false then
  318.                 term.setCursorPos(3,2)
  319.                 write("Dealers Hand: ("..dealervisiblecount.."/"..(dealervisiblecount-10)..")")
  320.         elseif (AcesD + AcesDh) > 1 and stay == true then
  321.                 term.setCursorPos(3,2)
  322.                 write("Dealers Hand: ("..(dealervisiblecount+dealerhiddencount).."/"..(dealervisiblecount+dealerhiddencount-10)..")")
  323.         elseif AcesD == 0 and stay == false then
  324.                 term.setCursorPos(3,2)
  325.                 write("Dealers Hand: ("..dealervisiblecount..")")      
  326.         elseif AcesD == 0 and stay == true then
  327.                 term.setCursorPos(3,2)
  328.                 write("Dealers Hand: ("..(dealervisiblecount+dealerhiddencount)..")")
  329.         end
  330. end
  331.  
  332. function dealerDraw()
  333.         term.setBackgroundColor(colors.lightGray)
  334.         term.setTextColor(colors.white)
  335.         term.setCursorPos(2,3)
  336.         print(CardName[dealerhiddenCards[1]])
  337.         while dealervisiblecount + dealerhiddencount < 17 do
  338.                 newcard("DealerV")
  339.         end
  340.         CheckCounts()
  341. end
  342. while true do
  343.         drawPictureTable(
  344.         {"fffffffffffffffffffffffffffffffffffffffffffffffffff",
  345.          "f7777777777777777fffffffffffffffff7777777777777777f",
  346.          "f7700000000000077fffffffffffffffff7700000000000077f",
  347.          "f7700000000000077fffffffffffffffff7700000000000077f",
  348.          "f7700f80000f80077fffffffffffffffff7700000000000077f",
  349.          "f77008f00008f0077fffffffffffffffff7700000000000077f",
  350.          "f7700000000000077fffffffffffffffff7700000ff0000077f",
  351.          "f7700f80f80f80077fffffffffffffffff770000ffff000077f",
  352.          "f77008f08f08f0077fffffffffffffffff77000ffffff00077f",
  353.          "f7700000000000077fffffffffffffffff7700ffffffff0077f",
  354.          "f7700f80f80f80077fffffffffffffffff7700ffffffff0077f",
  355.          "f77008f08f08f0077fffffffffffffffff77000ffffff00077f",
  356.          "f7700000000000077fffff5555555fffff7700000ff0000077f",
  357.          "f7700f80000f80077fffffffffffffffff770000ffff000077f",
  358.          "f77008f00008f0077fffffffffffffffff7700000000000077f",
  359.          "f7700000000000077fffffffffffffffff7700000000000077f",
  360.          "f7700000000000077fffffffffffffffff7700000000000077f",
  361.          "f7777777777777777fffffffffffffffff7777777777777777f",
  362.          "fffffffffffffffffffffffffffffffffffffffffffffffffff"},1,1)
  363.          term.setBackgroundColor(colors.white)
  364.          term.setTextColor(colors.black)
  365.          term.setCursorPos(37,3)
  366.          write("A")
  367.          term.setCursorPos(48,17)
  368.          write("A")
  369.          term.setCursorPos(4,3)
  370.          write("10")
  371.          term.setCursorPos(14,17)
  372.          write("10")
  373.          term.setBackgroundColor(colors.black)
  374.          term.setTextColor(colors.white)
  375.          term.setCursorPos(51,1)
  376.          write("X")
  377.          term.setCursorPos(22,6)
  378.          write("Blackjack")
  379.          term.setBackgroundColor(colors.lime)
  380.          term.setTextColor(colors.black)
  381.          term.setCursorPos(24,13)
  382.          write("Start")
  383.         while true do
  384.                 event,p1,p2,p3 = os.pullEvent()
  385.                 if event == "mouse_click" and p1 == 1 then
  386.                         if (p2 == 51 and p3 == 1) then quit()
  387.                         elseif (p2 >= 23 and p2 <= 29 and p3 == 13) then break end
  388.                 end
  389.         end
  390.         while true do
  391.                 GUIdrawAll()
  392.                 pot = PlaceBet()
  393.                 GUIdrawAll()
  394.                 sleep(.5)
  395.                 newcard("Player")
  396.                 sleep(.5)
  397.                 newcard("DealerH")
  398.                 sleep(.5)
  399.                 newcard("Player")
  400.                 sleep(.5)
  401.                 newcard("DealerV")
  402.                 sleep(.5)
  403.                 while true do
  404.                         if playercount == 21 and (dealerhiddencount + dealervisiblecount) ~=21 and #playersCards == 2 and (#dealervisibleCards + #dealerhiddenCards) == 2 then
  405.                                 sleep(1.5)
  406.                                 Notify("Blackjack, You won $"..pot,"Continue")
  407.                                 Cash = Cash + pot
  408.                                 break
  409.                         elseif playercount ~= 21 and (dealerhiddencount + dealervisiblecount) == 21 and #playersCards == 2 and (#dealervisibleCards + #dealerhiddenCards) == 2 then
  410.                                 sleep(1.5)
  411.                                 term.setBackgroundColor(colors.lightGray)
  412.                                 term.setTextColor(colors.white)
  413.                                 term.setCursorPos(2,3)
  414.                                 print(CardName[dealerhiddenCards[1]])
  415.                                 term.setBackgroundColor(colors.black)
  416.                                 term.setTextColor(colors.white)
  417.                                 term.setCursorPos(3,2)
  418.                                 write("Dealers Hand: ("..(dealervisiblecount+dealerhiddencount)..")")
  419.                                 if Cash > 0 then
  420.                                         Notify("Dealer Has BlackJack","Continue")
  421.                                 else
  422.                                         Notify("Dealer Has BlackJack","Continue")
  423.                                         Notify("You're Broke, Game Over","Menu")
  424.                                         broke = true
  425.                                 end
  426.                                 break
  427.                         elseif playercount == (dealervisiblecount+dealerhiddencount) and playercount == 21 then
  428.                                 sleep(1.5)
  429.                                 Notify("Drawed, you get $"..pot/2,"Continue")
  430.                                 Cash = Cash + (pot/2)
  431.                                 break
  432.                         end    
  433.                         local choice = hitstand()
  434.                         sleep(.5)
  435.                         if choice == 1 then
  436.                                 newcard("Player")
  437.                                 if playercount > 21 then
  438.                                         if Cash > 0 then
  439.                                                 sleep(1.5)
  440.                                                 Notify("Bad Luck, You Busted!","Continue")
  441.                                                 break
  442.                                         else
  443.                                                 sleep(1.5)
  444.                                                 Notify("You're Broke, Game Over","Menu")
  445.                                                 broke = true
  446.                                                 break
  447.                                         end
  448.                                 elseif playercount == 21 then
  449.                                         stay = true
  450.                                         dealerDraw()
  451.                                         if (dealervisiblecount+dealerhiddencount) ~= 21 then
  452.                                                 sleep(1.5)
  453.                                                 Notify("Congrats, You won $"..pot,"Continue")
  454.                                                 Cash = Cash + pot
  455.                                                 break
  456.                                         elseif (dealervisiblecount+dealerhiddencount) == 21 then
  457.                                                 sleep(1.5)
  458.                                                 Notify("Drawed, you get $"..pot/2,"Continue")
  459.                                                 Cash = Cash + (pot/2)
  460.                                                 break
  461.                                         end
  462.                                 end    
  463.                         elseif choice == 2 then
  464.                                 stay = true
  465.                                 dealerDraw()
  466.                                 if playercount <= 21 and (dealervisiblecount+dealerhiddencount) <=21 and (dealervisiblecount+dealerhiddencount) < playercount then
  467.                                         sleep(1.5)
  468.                                         Notify("Congrats, You won $"..pot,"Continue")
  469.                                         Cash = Cash + pot
  470.                                 elseif playercount <= 21 and (dealervisiblecount+dealerhiddencount) <=21 and (dealervisiblecount+dealerhiddencount) > playercount then
  471.                                         sleep(1.5)
  472.                                         if Cash > 0 then Notify("Dealer Wins, Bad Luck","Continue")
  473.                                         else Notify("Dealer Wins, Bad Luck","Continue");Notify("You're Broke, Game Over","Menu");broke = true end
  474.                                 elseif playercount == (dealervisiblecount+dealerhiddencount) and playercount <=21 then
  475.                                         sleep(1.5)
  476.                                         Notify("Drawed, you get $"..pot/2,"Continue")
  477.                                         Cash = Cash + (pot/2)
  478.                                 elseif playercount <=21 and (dealervisiblecount+dealerhiddencount) > 21 then
  479.                                         sleep(1.5)
  480.                                         Notify("Congrats, You won $"..pot,"Continue")
  481.                                         Cash = Cash + pot
  482.                                 end
  483.                                 break
  484.                         end
  485.                 end
  486.                 GUIdrawAll()
  487.                 refreshCards()
  488.                 sleep(2)
  489.                 reset()
  490.                 if broke == true then
  491.                         broke = false
  492.                         break
  493.                 end
  494.         end
  495. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top