Advertisement
Guest User

Untitled

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