ravneravn

fusionBetter2

May 2nd, 2013
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mSide = "left"
  2. sorter = 86
  3. display = 0
  4. cashIn = 85
  5. x = 0
  6. tableName = {}
  7. tableAmount = {}
  8. tableBetName = {}
  9.  
  10. function waitSorter()
  11. rednet.open(mSide)
  12. print("Processing...")
  13. event, sid, betAmount, dis = os.pullEvent("rednet_message")
  14. end
  15.  
  16. function sendDisplay()
  17. tableName = textutils.serialize(tableName)
  18. tableAmount = textutils.serialize(tableAmount)
  19. tableBetName = textutils.serialize(tableBetName)
  20. rednet.open(mSide)
  21. rednet.send(display, tableName)
  22. rednet.send(display, tableAmount)
  23. rednet.send(display, tableBetName)
  24. end
  25.  
  26. function sendCash()
  27. tableName = textutils.serialize(tableName)
  28. tableAmount = textutils.serialize(tableAmount)
  29. tableBetName = textutils.serialize(tableBetName)
  30. rednet.open(mSide)
  31. rednet.send(cashIn, tableName)
  32. rednet.send(cashIn, tableAmount)
  33. rednet.send(cashIn, tableBetName)
  34. print("Bets transmitted")
  35. end
  36.  
  37. function addTable()
  38. table.insert(tableName, name)
  39. table.insert(tableAmount, amount)
  40. table.insert(tableBetName, betName)
  41. end
  42.  
  43.  
  44.  
  45. function logIn()
  46. event, name = os.pullEvent()
  47. if event == "player" then
  48. print("Hello "..name.." Welcome to FusionBetter")
  49. print("Please enter the exact name of the player you want to bet on")
  50. print("Note that i am case sensitive")
  51. betName = io.read()
  52. print("Please insert the amount you want to bet on "..betName.." in the chest")
  53. print("You will get odds of 2:1")
  54. waitSorter()
  55. print("You have bet "..betAmount.." on "..betName)
  56. print("Use the FusionCasher to cash in after the competetion")
  57. print("Thank you for using FusionBetter, good luck")
  58. addTable()
  59. elseif event == "redstone" then
  60. print("No betting while a race is in progress")
  61. --sendDisplay()
  62. sendCash()
  63. end
  64. end
  65.  
  66. while true do
  67. logIn()
  68. end
RAW Paste Data