Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. local turn = 1
  2. local spaceP = {1, 1, 1, 1, 1, 1}
  3. local jailP = {[1] = false, [2] = false, [3] = false, [4] = false, [5] = false, [6] = false}
  4. local function player(num)
  5.   while true do
  6.     if turn == num then
  7.       local d1 = math.random(1, 6)
  8.       local d2 = math.random(1, 6)
  9.       local moveCount = d1 + d2
  10.       print("Player "..num.." rolled a "..d1.." and a "..d2.."...")
  11.       if d1 == d2 then
  12.         print("Doubles! Rolling again.")
  13.         local d1 = math.random(1, 6)
  14.         local d2 = math.random(1, 6)
  15.         local moveCount = moveCount + d1 + d2
  16.         if d1 == d2 then
  17.           print("Doubles! Rolling again for a second time.")
  18.           local d1 = math.random(1, 6)
  19.           local d2 = math.random(1, 6)
  20.           local moveCount = moveCount + d1 + d2
  21.           if d1 == d2 then
  22.             print("Uh-oh, three doubles! Player "..num.." is going to Jail!")
  23.             jailP[num] = true
  24.           end
  25.         end
  26.         spaceP[1] = spaceP[1] + moveCount
  27.         if board[spaceP[1]].owner == 0 then
  28.           if (type == 1 or type == 2 or type == 7) and (bank >= price + 200) then
  29.             local isBuying = math.random(1, 4)
  30.             if isBuying == 1 then
  31.               isBuying = true
  32.             end
  33.             if isBuying == true then
  34.               players[1].properties[#players[1].properties+1] = board[spaceP[1]].spaceNum
  35.               players[1].bank = players[1].bank - board[spaceP[1]].price
  36.               board[spaceP[1]].owner = 1
  37.             end
  38.           end
  39.         end
  40.       end
  41.       if turn < 6 then
  42.         turn = turn + 1
  43.       elseif turn == 6 then
  44.         turn = 1
  45.       end
  46.     end
  47.   end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement