forked from minecartchris/CC-Casnio
Fix blackjack not working at all
This commit is contained in:
+22
-16
@@ -1,4 +1,5 @@
|
|||||||
--black
|
--black
|
||||||
|
rednet.open("back")
|
||||||
|
|
||||||
local function interactWithCard(userUUID, mode, money)
|
local function interactWithCard(userUUID, mode, money)
|
||||||
if mode == "updateBalance" then
|
if mode == "updateBalance" then
|
||||||
@@ -42,7 +43,14 @@ end
|
|||||||
--local tmp = peripheral.wrap("bottom")
|
--local tmp = peripheral.wrap("bottom")
|
||||||
--tmp.ejectDisk()
|
--tmp.ejectDisk()
|
||||||
|
|
||||||
os.pullEvent=os.pullEventRaw
|
os.pullEvent= function(...)
|
||||||
|
while true do
|
||||||
|
local t = table.pack(os.pullEventRaw(...))
|
||||||
|
if t[1] ~= "terminate" then
|
||||||
|
return table.unpack(t,1,t.n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
print("Was Made By Gaurdian15")
|
print("Was Made By Gaurdian15")
|
||||||
if fs.exists("/disk/terminate") then
|
if fs.exists("/disk/terminate") then
|
||||||
error("Service mode active",2)
|
error("Service mode active",2)
|
||||||
@@ -64,18 +72,16 @@ local function calculate(win, amount, money)
|
|||||||
--if not disk.isPresent() then
|
--if not disk.isPresent() then
|
||||||
--os.reboot()
|
--os.reboot()
|
||||||
--end
|
--end
|
||||||
|
if win then
|
||||||
if win == "n" then
|
|
||||||
money = money - amount
|
|
||||||
house = house + amount
|
|
||||||
elseif win == "y" then
|
|
||||||
money = money + amount
|
money = money + amount
|
||||||
house = house - amount
|
else
|
||||||
|
money = money - amount
|
||||||
end
|
end
|
||||||
|
return money
|
||||||
end
|
end
|
||||||
print("Was Made By Gaurdian15")
|
print("Was Made By Gaurdian15")
|
||||||
--local money2 = fs.open("/disk2/money.lua", "r")
|
--local money2 = fs.open("/disk2/money.lua", "r")
|
||||||
money, playerUUID, username = interactWithCard(nil, "getBalance", nil)
|
local money, playerUUID, username = interactWithCard(nil, "getBalance", nil)
|
||||||
--money2.close()
|
--money2.close()
|
||||||
|
|
||||||
money = tonumber(money)
|
money = tonumber(money)
|
||||||
@@ -138,31 +144,31 @@ while true do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(pcard>21) then
|
if(pcard>21) then
|
||||||
calculate(n, bet, money)
|
money = calculate(false, bet, money)
|
||||||
print("You Busted")
|
print("You Busted")
|
||||||
elseif(acard>21) then
|
elseif(acard>21) then
|
||||||
calculate(y, bet, money)
|
money = calculate(true, bet, money)
|
||||||
print("Dealer Bust's")
|
print("Dealer Bust's")
|
||||||
elseif (pcard>acard) then
|
elseif (pcard>acard) then
|
||||||
calculate(y, bet, money)
|
moeny = calculate(true, bet, money)
|
||||||
print("You Won")
|
print("You Won")
|
||||||
elseif(acard>pcard) then
|
elseif(acard>pcard) then
|
||||||
calculate(n, bet, money)
|
money = calculate(false, bet, money)
|
||||||
print("The Dealer won")
|
print("The Dealer won")
|
||||||
elseif(acard==pcard) then
|
elseif(acard==pcard) then
|
||||||
print("Push No One Wins")
|
print("Push No One Wins")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
print("Your new balance is: "..money)
|
||||||
|
|
||||||
--money2 = fs.open("/disk2/money.lua", "w")
|
--money2 = fs.open("/disk2/money.lua", "w")
|
||||||
interactWithCard(playerUUID, "updateBalance", money)
|
interactWithCard(playerUUID, "updateBalance", money)
|
||||||
--money2.close()
|
--money2.close()
|
||||||
|
|
||||||
h = fs.open("disk/house.lua", "w")
|
--h = fs.open("disk/house.lua", "w")
|
||||||
h.write(house)
|
--h.write(house)
|
||||||
h.close()
|
--h.close()
|
||||||
print("If removing your card do it now")
|
print("If removing your card do it now")
|
||||||
sleep(5)
|
sleep(5)
|
||||||
os.reboot()
|
os.reboot()
|
||||||
|
|||||||
Reference in New Issue
Block a user