Code:
local Hands = {
-- 1 is card area
-- 2 is power up
-- 3 is currency
-- 4 is counter
-- 5 is an power up bonus
['White'] = {
['1'] = '47d19c',
['2'] = 'a66157',
['3'] = 'd43b95',
['4'] = '7b820b',
['5'] = 0,
},
['Red'] = {
['1'] = 'c03005',
['2'] = 'efb15c',
['3'] = '856f67',
['4'] = '32b444',
['5'] = 0,
},
['Orange'] = {
['1'] = '7a9754',
['2'] = '6a9181',
['3'] = 'd0ba7d',
['4'] = 'c5896f',
['5'] = 0,
},
['Yellow'] = {
['1'] = 'e0925f',
['2'] = '08f4d5',
['3'] = '9bf0f1',
['4'] = 'a11841',
['5'] = 0,
},
['Green'] = {
['1'] = '861fbb',
['2'] = '91f462',
['3'] = 'fdaeed',
['4'] = '400e1b',
['5'] = 0,
},
['Blue'] = {
['1'] = 'b00ab7',
['2'] = 'ce1e35',
['3'] = '80280c',
['4'] = 'e322fc',
['5'] = 0,
},
['Purple'] = {
['1'] = '2e731d',
['2'] = '5d2feb',
['3'] = '01ac2b',
['4'] = '04338e',
['5'] = 0,
},
['Pink'] = {
['1'] = '02ccea',
['2'] = 'a43b96',
['3'] = '5ce2b3',
['4'] = '6028b2',
['5'] = 0,
},
}
local Chips = {
-- Name = Number, Amount Up, Amount Down, GUID
['$1'] = { ['1'] = 1, ['2'] = 5, ['3'] = 0, ['4'] = "1f6e09" },
['$5'] = { ['1'] = 5, ['2'] = 2, ['3'] = 5, ['4'] = "482941" },
['$10'] = { ['1'] = 10, ['2'] = 5, ['3'] = 2, ['4'] = "291225" },
['$25'] = { ['1'] = 25, ['2'] = 2, ['3'] = 5, ['4'] = "23fd4f" },
['$50'] = { ['1'] = 50, ['2'] = 2, ['3'] = 2, ['4'] = "81fbcb" },
['$100'] = { ['1'] = 100, ['2'] = 5, ['3'] = 2, ['4'] = "a2c928" },
['$250'] = { ['1'] = 250, ['2'] = 2, ['3'] = 5, ['4'] = "928314" },
['$500'] = { ['1'] = 500, ['2'] = 2, ['3'] = 5, ['4'] = "a8a4cf" },
['$1000'] = { ['1'] = 1000, ['2'] = 5, ['3'] = 2, ['4'] = "38a247" },
['$2500'] = { ['1'] = 2500, ['2'] = 2, ['3'] = 5, ['4'] = "6b0365" },
['$5000'] = { ['1'] = 5000, ['2'] = 2, ['3'] = 5, ['4'] = "d40713" },
['$10000'] = { ['1'] = 10000, ['2'] = 5, ['3'] = 2, ['4'] = "cadde9" },
['$25000'] = { ['1'] = 25000, ['2'] = 2, ['3'] = 5, ['4'] = "0c5bd3" },
['$50000'] = { ['1'] = 50000, ['2'] = 2, ['3'] = 5, ['4'] = "a8af60" },
['$100000'] = { ['1'] = 100000, ['2'] = 0, ['3'] = 2, ['4'] = "d1dd8f" },
}
Deck = {}
Deck_guid = ""
Deck_counter = '7ce289'
Dealer_bust = false
Dealer_pu = 0
function IsCard( obj )
if not obj.name == 'Card' then return false end
if obj.getName() == '1' or obj.getName() == '2' or obj.getName() == '3' or obj.getName() == '4' or obj.getName() == '5' or obj.getName() == '6' or obj.getName() == '7' or obj.getName() == '8' or obj.getName() == '9' or obj.getName() == '10' or obj.getName() == 'One' or obj.getName() == 'Two' or obj.getName() == 'Three' or obj.getName() == 'Four' or obj.getName() == 'Five' or obj.getName() == 'Six' or obj.getName() == 'Seven' or obj.getName() == 'Eight' or obj.getName() == 'Nine' or obj.getName() == 'Ten' or obj.getName() == 'Jack' or obj.getName() == 'Queen' or obj.getName() == 'King' or obj.getName() == 'Ace' then return true end
return false
end
function GetCards( guid )
local tbl, tbl2 = getObjectFromGUID(guid).getObjects(), {}
for k, v in pairs(tbl) do
if IsCard(v) then
tbl2[#tbl2 + 1] = v
end
end
return tbl2
end
function IsPowerUp( obj )
if not obj.name == 'CustomModel' then return false end
if obj.getName() == 'Goomba' or obj.getName() == 'Mushroom' or obj.getName() == '1-Up' or obj.getName() == 'Yoshi Egg' or obj.getName() == 'Fire Flower' or obj.getName() == 'Robert-Omb' or obj.getName() == 'Boo' or obj.getName() == 'Chain Chomp' or obj.getName() == '? Block' or obj.getName() == 'Star' or obj.getName() == 'Gold Coin' or obj.getName() == 'Brick Block' or obj.getName() == 'Metal Block' then return true end
return false
end
function IsChips( obj )
if not obj.name == 'CustomModel' then return false end
if obj.getName() == '$1' or obj.getName() == '$5' or obj.getName() == '$10' or obj.getName() == '$25' or obj.getName() == '$50' or obj.getName() == '$100' or obj.getName() == '$250' or obj.getName() == '$500' or obj.getName() == '$1000' or obj.getName() == '$2500' or obj.getName() == '$5000' or obj.getName() == '$10000' or obj.getName() == '$25000' or obj.getName() == '$50000' or obj.getName() == '$100000' then return true end
return false
end
function GetCardValve( obj )
if not IsCard(obj) then return end
if obj.getName() == 'One' then
return 1
end
if obj.getName() == 'Two' then
return 2
end
if obj.getName() == 'Three' then
return 3
end
if obj.getName() == 'Four' then
return 4
end
if obj.getName() == 'Five' then
return 5
end
if obj.getName() == 'Six' then
return 6
end
if obj.getName() == 'Seven' then
return 7
end
if obj.getName() == 'Eight' then
return 8
end
if obj.getName() == 'Nine' then
return 9
end
if obj.getName() == 'Ten' then
return 10
end
if obj.getName() == '1' then
return 1
end
if obj.getName() == '2' then
return 2
end
if obj.getName() == '3' then
return 3
end
if obj.getName() == '4' then
return 4
end
if obj.getName() == '5' then
return 5
end
if obj.getName() == '6' then
return 6
end
if obj.getName() == '7' then
return 7
end
if obj.getName() == '8' then
return 8
end
if obj.getName() == '9' then
return 9
end
if obj.getName() == '10' then
return 10
end
if obj.getName() == 'Jack' then
return 10
end
if obj.getName() == 'Queen' then
return 10
end
if obj.getName() == 'King' then
return 10
end
if obj.getName() == 'Ace' then
return 11
end
return 0
end
function DoPowerUp( obj, ply )
if not obj.name == 'CustomModel' then return end
if obj.getName() == 'Goomba' then
local cpos, dpos = getObjectFromGUID(Hands[ply]['1']).getPosition(), getObjectFromGUID('ca1f69').getPosition()
for k, v in pairs(getObjectFromGUID('ca1f69').getObjects()) do
if IsCard(v) then
v.setPositionSmooth(cpos)
end
end
for k, v in pairs(getObjectFromGUID(Hands[ply]['1']).getObjects()) do
if IsCard(v) then
v.setPositionSmooth(dpos)
end
end
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == 'Mushroom' then
Hands[ply]['5'] = Hands[ply]['5'] + 10
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == '1-Up' then
Hands[ply]['5'] = Hands[ply]['5'] + 1
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == 'Yoshi Egg' then
for k, v in pairs(getObjectFromGUID('ca1f69').getObjects()) do
if IsCard(v) then
destroyObject(v)
end
end
local params = {}
params.position = getObjectFromGUID('ca1f69').getPosition()
params.rotation = {0, 0, 0}
params.top = true
Deck.takeObject(params)
local params2 = {}
params2.position = getObjectFromGUID('aa904f').getPosition()
params2.rotation = {0, 0, Deck.getRotation().z}
params2.top = true
Deck.takeObject(params2)
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == 'Fire Flower' then
Dealer_pu = Dealer_pu + -3
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == 'Robert-Omb' then
Dealer_bust = true
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == 'Boo' then
local zone = getObjectFromGUID('aa904f')
for k, v in pairs(zone.getObjects()) do
if IsCard(v) then
v.flip()
end
end
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == 'Chain Chomp' then
local zone = getObjectFromGUID(Hands[ply]['1'])
for k, v in pairs(zone.getObjects()) do
if IsCard(v) then
destroyObject(v)
end
end
local v = Hands[ply]['1']
local pos = getObjectFromGUID(v).getPosition()
pos.x = pos.x + 1
local pos2 = { pos.x - 1, pos.y, pos.z }
local params = {}
params.position = pos
params.rotation = {0, 0, Deck.getRotation().z - 180}
params.flip = true
params.top = true
Deck.takeObject(params)
params.position = pos2
params.rotation = {0, 0, Deck.getRotation().z - 180}
Deck.takeObject(params)
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == '? Block' then
local chest = getObjectFromGUID('2dfdf8')
chest.shuffle()
local params = {}
params.position = getObjectFromGUID(Hands[ply]['1']).getPosition()
params.rotation = {0, 0, Deck.getRotation().z - 180}
params.top = true
chest.takeObject(params)
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5})
end
if obj.getName() == 'Star' then
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5})
return -- can't go bust
end
if obj.getName() == 'Gold Coin' then
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5})
return -- everyone wins
end
if obj.getName() == 'Brick Block' then
local zone = getObjectFromGUID(Hands[ply]['1'])
for k, v in pairs(zone.getObjects()) do
if IsCard(v) then
destroyObject(v)
end
end
broadcastToAll(Player[ply].steam_name .. " used " .. obj.getName() .. " power up.\n" .. obj.getDescription(), {0.25, 1.0, 0.5} )
end
if obj.getName() == 'Metal Block' then
return -- does nothing
end
destroyObject(obj)
local count = 0 + Dealer_pu
for k, v in pairs(getObjectFromGUID('ca1f69').getObjects()) do
if IsCard(v) then
if v.getRotation().z > 180 then
count = count + GetCardValve(v)
end
end
end
if count > 0 then
getObjectFromGUID(Deck_counter).TextTool.setValue(tostring(count))
end
for ply, val in pairs(Hands) do
local zone = getObjectFromGUID(val['1'])
local count2 = 0
for k, v in pairs(zone.getObjects()) do
if IsCard(v) then
count2 = count2 + GetCardValve(v)
end
end
if val['5'] > 0 then
count2 = count2 + val['5']
end
if count2 > 0 then
getObjectFromGUID(val['4']).TextTool.setValue(tostring(count2))
end
end
return
end
function DoDeal(obj, ply)
if not Player[ply].admin then
broadcastToColor("Your not an admin.", ply, {0.25, 1.0, 0.5} )
return
end
if Deck_guid == "" then
broadcastToAll("Missing deck or Deck not compatible.", {0.25, 1.0, 0.5} )
return
end
for ply, val in pairs(Hands) do
Hands[ply]['5'] = 0
end
for _, ply in pairs(getSeatedPlayers()) do
if #getObjectFromGUID(Hands[ply]['3']).getObjects() >= 2 then
local pos = getObjectFromGUID(Hands[ply]['1']).getPosition()
pos.x = pos.x + 1
local pos2 = { pos.x - 1, pos.y, pos.z }
local params = {}
params.position = pos
params.rotation = {0, 0, Deck.getRotation().z - 180}
params.flip = true
params.top = true
Deck.takeObject(params)
params.position = pos2
params.rotation = {0, 0, Deck.getRotation().z - 180}
Deck.takeObject(params)
else
broadcastToColor("Skipping cards this round.\nTry betting before cards are delt.", ply, {0.25, 1.0, 0.5})
end
end
local params = {}
params.position = getObjectFromGUID('3ebf0f').getPosition()
params.rotation = {0, 0, 0}
params.top = true
Deck.takeObject(params)
local params2 = {}
params2.position = getObjectFromGUID('aa904f').getPosition()
params2.rotation = {0, 0, Deck.getRotation().z}
params2.top = true
Deck.takeObject(params2)
end
function DoClean(obj, ply)
if not Player[ply].admin then
broadcastToColor("Your not an admin.", ply, {0.25, 1.0, 0.5} )
return
end
Dealer_bust = false
Dealer_pu = 0
for ply, val in pairs(Hands) do
local zone = getObjectFromGUID(val['1'])
for k, v in pairs(zone.getObjects()) do
if IsCard(v) then
destroyObject(v)
end
end
local zone2 = getObjectFromGUID(val['2'])
for k, v in pairs(zone2.getObjects()) do
if IsPowerUp(v) then
destroyObject(v)
end
end
Hands[ply]['5'] = 0
end
for k, v in pairs(getObjectFromGUID('3ebf0f').getObjects()) do
if IsCard(v) then
destroyObject(v)
end
end
for k, v in pairs(getObjectFromGUID('aa904f').getObjects()) do
if IsCard(v) then
destroyObject(v)
end
end
for k, v in pairs(getObjectFromGUID('ca1f69').getObjects()) do
if IsCard(v) then
destroyObject(v)
end
end
getObjectFromGUID(Deck_counter).TextTool.setFontColor({1.0, 1.0, 1.0})
getObjectFromGUID(Deck_counter).TextTool.setValue("0")
for color, val in pairs(Hands) do
getObjectFromGUID(val['4']).TextTool.setFontColor({1.0, 1.0, 1.0})
getObjectFromGUID(val['4']).TextTool.setValue("0")
end
end
function DoBJC(obj, ply)
if not Player[ply].admin then
broadcastToColor("Your not an admin.", ply, {0.25, 1.0, 0.5} )
return
end
local card1, card2 = 0, 0
for k, v in pairs(getObjectFromGUID('3ebf0f').getObjects()) do
if IsCard(v) then
card1 = GetCardValve(v)
end
end
for k, v in pairs(getObjectFromGUID('aa904f').getObjects()) do
if IsCard(v) then
card2 = GetCardValve(v)
end
end
if card1 > 9 then
if card1 + card2 == 21 then
broadcastToAll("The dealer has blackjack.", {0.25, 1.0, 0.5} )
for k, v in pairs(getObjectFromGUID('aa904f').getObjects()) do
if IsCard(v) then
v.flip()
end
end
else
broadcastToAll("The dealer doesn't blackjack.", {0.25, 1.0, 0.5} )
end
end
end
function DoSpawnChips( num, guid )
local pos = getObjectFromGUID('7b3ae8').getPosition()
for i = 1, num do
getObjectFromGUID(guid).takeObject({position = { pos.x, pos.y + (i * 0.5), pos.z}})
end
end
function DoSpawnChips2( num, guid )
local pos = getObjectFromGUID('6e1631').getPosition()
for i = 1, num do
getObjectFromGUID(guid).takeObject({position = { pos.x, pos.y + (i * 0.5), pos.z}})
end
end
function DoChipsDown()
for k, v in pairs(getObjectFromGUID('7b3ae8').getObjects()) do
if IsChips(v) then
local amount = 0
local num, val, req = math.abs(v.getQuantity()), Chips[v.getName()]['1'] or 0, Chips[v.getName()]['3'] or 0
if Chips[v.getName()]['3'] > 0 then
amount = num * req
num = val / req
DoSpawnChips(amount, Chips[tostring('$' .. num)]['4'])
destroyObject(v)
end
end
end
end
function DoChipsDown2()
for k, v in pairs(getObjectFromGUID('6e1631').getObjects()) do
if IsChips(v) then
local amount = 0
local num, val, req = math.abs(v.getQuantity()), Chips[v.getName()]['1'] or 0, Chips[v.getName()]['3'] or 0
if Chips[v.getName()]['3'] > 0 then
amount = num * req
num = val / req
DoSpawnChips2(amount, Chips[tostring('$' .. num)]['4'])
destroyObject(v)
end
end
end
end
function DoChipsUp()
local tbl = {}
for k, v in pairs(getObjectFromGUID('7b3ae8').getObjects()) do
if IsChips(v) then
local num, val = math.abs(v.getQuantity()), Chips[v.getName()]['1']
if not tbl[val] then tbl[val] = 0 end
tbl[val] = tbl[val] + num
destroyObject(v)
end
end
for k, v in pairs(tbl) do
local str = tostring('$' .. k)
local req = Chips[str]['2']
local nex = k * req
local num = 0
if v > 0 then
if req > 0 then
if v >= req then
for i =1, v do
num = num + 1
if num == req then
v = v - num
DoSpawnChips(1, Chips[tostring('$' .. nex)]['4'])
num = 0
end
end
end
if v < req then
DoSpawnChips(v, Chips[str]['4'])
v = 0
end
else
DoSpawnChips(v, Chips[str]['4'])
v = 0
end
end
end
end
function DoChipsUp2()
local tbl = {}
for k, v in pairs(getObjectFromGUID('6e1631').getObjects()) do
if IsChips(v) then
local num, val = math.abs(v.getQuantity()), Chips[v.getName()]['1']
if not tbl[val] then tbl[val] = 0 end
tbl[val] = tbl[val] + num
destroyObject(v)
end
end
for k, v in pairs(tbl) do
local str = tostring('$' .. k)
local req = Chips[str]['2']
local nex = k * req
local num = 0
if v > 0 then
if req > 0 then
if v >= req then
for i =1, v do
num = num + 1
if num == req then
v = v - num
DoSpawnChips2(1, Chips[tostring('$' .. nex)]['4'])
num = 0
end
end
end
if v < req then
DoSpawnChips2(v, Chips[str]['4'])
v = 0
end
else
DoSpawnChips2(v, Chips[str]['4'])
v = 0
end
end
end
end
function onLoad()
local tbl = getObjectFromGUID("c6af75")
tbl.createButton({
click_function='DoDeal', label='Deal',
position={14, 0.5, -8}, rotation={0,-0,0}, width=600, height=420, font_size=140
})
tbl.createButton({
click_function='DoClean', label='Clean',
position={16, 0.5, -8}, rotation={0,-0,0}, width=600, height=420, font_size=140
})
tbl.createButton({
click_function='DoBJC', label='Check',
position={12, 0.5, -8}, rotation={0,-0,0}, width=600, height=420, font_size=140
})
tbl.createButton({
click_function='DoChipsDown', label='Down',
position={10, 0.5, -5}, rotation={0,-0,0}, width=600, height=420, font_size=140
})
tbl.createButton({
click_function='DoChipsUp', label='Up',
position={10, 0.5, -6}, rotation={0,-0,0}, width=600, height=420, font_size=140
})
tbl.createButton({
click_function='DoChipsDown2', label='Down',
position={-10, 0.5, -5}, rotation={0,-0,0}, width=600, height=420, font_size=140
})
tbl.createButton({
click_function='DoChipsUp2', label='Up',
position={-10, 0.5, -6}, rotation={0,-0,0}, width=600, height=420, font_size=140
})
for k, v in pairs(getObjectFromGUID('750159').getObjects()) do
if v.name == 'Deck' and v.guid != "" and v.getQuantity() > 51 then
Deck = getObjectFromGUID(v.guid)
Deck_guid = v.guid
return
end
end
end
function update()
local count = 0 + Dealer_pu
for k, v in pairs(getObjectFromGUID('ca1f69').getObjects()) do
if IsCard(v) then
if v.getRotation().z > 180 then
local card = GetCardValve(v)
if card == 11 then
if count > 21 or #GetCards('ca1f69') > 2 then
count = count + 1
else
count = count + card
end
else
count = count + card
end
end
end
end
getObjectFromGUID(Deck_counter).TextTool.setFontColor({1.0, 1.0, 1.0})
if count > 0 then
if count == 21 then
if #GetCards('ca1f69') > 2 then
getObjectFromGUID(Deck_counter).TextTool.setFontColor({0.0, 0.5, 0.0})
else
getObjectFromGUID(Deck_counter).TextTool.setFontColor({0.0, 1.0, 0.0})
end
end
if count > 21 then
getObjectFromGUID(Deck_counter).TextTool.setFontColor({1.0, 1.0, 0.0})
end
getObjectFromGUID(Deck_counter).TextTool.setValue(tostring(count))
else
if not tostring(count) == getObjectFromGUID(Deck_counter).TextTool.getValue() then
getObjectFromGUID(Deck_counter).TextTool.setValue(tostring(count))
end
end
if Dealer_bust then
getObjectFromGUID(Deck_counter).TextTool.setFontColor({1.0, 1.0, 0.0})
getObjectFromGUID(Deck_counter).TextTool.setValue('Busted')
end
for ply, val in pairs(Hands) do
local zone = getObjectFromGUID(val['1'])
local zone2 = getObjectFromGUID(val['2'])
local count2 = 0
for k, v in pairs(zone.getObjects()) do
if IsCard(v) then
local card = GetCardValve(v)
if card == 11 then
if count2 + card >= 21 or count2 >= 21 then
count2 = count2 + 1
else
count2 = count2 + card
end
else
count2 = count2 + card
end
end
end
if val['5'] > 0 then
count2 = count2 + val['5']
end
getObjectFromGUID(val['4']).TextTool.setFontColor({1.0, 1.0, 1.0})
if count2 > 0 then
if count2 == 21 then
if #GetCards(val['1']) > 2 then
getObjectFromGUID(val['4']).TextTool.setFontColor({0.0, 0.5, 0.0})
else
getObjectFromGUID(val['4']).TextTool.setFontColor({0.0, 1.0, 0.0})
end
end
if count2 > 21 then
getObjectFromGUID(val['4']).TextTool.setFontColor({1.0, 1.0, 0.0})
end
end
for k, v in pairs(zone2.getObjects()) do
if IsPowerUp(v) then
DoPowerUp(v, ply)
end
end
getObjectFromGUID(val['4']).TextTool.setValue(tostring(count2))
end
local powerup = getObjectFromGUID('ad574f')
local time = getObjectFromGUID("680ff8")
local objects = { "9ae67d", "bcd805", "f53646", "c6814d", "f0e12f", "4b1747", "1b440d", "4ac4b1", "031b4c", "32b566", "bb2c45", "3191aa", "1f186a" }
if time.getValue() < 1 then
for _, ply in pairs(getSeatedPlayers()) do
local obj = getObjectFromGUID(objects[math.random(1,13)])
local pos = getObjectFromGUID(Hands[ply]['1']).getPosition()
local params = {}
params.position = {pos.x, pos.y, pos.z + 5}
params.rotation = {0, 0, 0}
params.lock = false
obj.unlock()
obj.clone(params)
obj.lock()
end
time.setValue(900)
time.Clock.pauseStart()
end
end
function onObjectDestroyed()
for _, ply in pairs(getSeatedPlayers()) do
getObjectFromGUID(Hands[ply]['4']).TextTool.setValue('0')
end
getObjectFromGUID(Deck_counter).TextTool.setValue('0')
if Dealer_bust then
getObjectFromGUID(Deck_counter).TextTool.setValue('Busted')
end
end
function onObjectExitScriptingZone(zone, obj)
local count = 0 + Dealer_pu
for k, v in pairs(getObjectFromGUID('ca1f69').getObjects()) do
if IsCard(v) then
if v.getRotation().z > 180 then
local card = GetCardValve(v)
if card == 11 then
if count > 21 or #GetCards('ca1f69') > 2 then
count = count + 1
else
count = count + card
end
else
count = count + card
end
end
end
end
if count > 0 then
getObjectFromGUID(Deck_counter).TextTool.setValue(tostring(count))
end
if Dealer_bust then
getObjectFromGUID(Deck_counter).TextTool.setValue('Busted')
end
for ply, val in pairs(Hands) do
local zone = getObjectFromGUID(val['1'])
local count2 = 0
for k, v in pairs(zone.getObjects()) do
if IsCard(v) then
local card = GetCardValve(v)
if card == 11 then
if count2 + card >= 21 or count2 >= 21 then
count2 = count2 + 1
else
count2 = count2 + card
end
else
count2 = count2 + card
end
end
end
if val['5'] > 0 then
count2 = count2 + val['5']
end
if count2 > 0 then
getObjectFromGUID(val['4']).TextTool.setValue(tostring(count2))
end
end
end
function onObjectEnterScriptingZone(zone, obj)
if zone.guid == '750159' then
if obj.name == 'Deck' and obj.guid != "" and obj.getQuantity() > 51 then
Deck = getObjectFromGUID(obj.guid)
Deck_guid = obj.guid
obj.shuffle()
broadcastToAll("Deck was shuffled!", {0.25, 1.0, 0.5} )
return
end
end
end
You can find it on the workshop [url=http://steamcommunity.com/sharedfiles/filedetails/?id=774292858]here[/url].