Advertisement
wambot

Untitled

May 5th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. local term = require("term")
  2. local event = require("event")
  3. local shell = require("shell")
  4. local component = require("component")
  5. local gpu = component.gpu
  6. local w, h = gpu.maxResolution()
  7. local colors = require("colors")
  8. local b = 0
  9. local redstone = component.redstone
  10. local sides = require("sides")
  11.  
  12. function greeting()
  13. print("Введите шанс выигрыша без '%'(20 норм (не больше 50) ):")
  14. b = io.read()
  15. print("Какие будут призы:")
  16. p = io.read()
  17. print("Что нужно кидать:")
  18. c = io.read()
  19. term.clear()
  20. screen()
  21. info()
  22. end
  23.  
  24. function screen()
  25. gpu.setBackground(0x000066)
  26. gpu.setForeground(0x00ff00)
  27. gpu.fill(1,1,1,40,"||")
  28. gpu.fill(80,1,1,30,"||")
  29. term.clear()
  30. end
  31. component.chat_box.setName("§6Казино!")
  32.  
  33. function random()
  34. component.chat_box.say("§1Крутим рулетку!!!")
  35. r = 100/b
  36. a = math.random(r)
  37. if a == 1 then
  38. component.chat_box.say("§3Вы выйграли, ЧИСЛО: " .. a)
  39. redstone.setOutput(sides.back, 15)
  40. os.sleep(3)
  41. redstone.setOutput(sides.back, 0)
  42. screen()
  43. info()
  44. elseif a >= 2 then
  45. component.chat_box.say("§4Вы проиграли, ЧИСЛО: " .. a)
  46. screen()
  47. info()
  48. else
  49. print("Что-то пошло не так")
  50. end
  51. end
  52.  
  53. function info()
  54. term.setCursor(1, 1)
  55. gpu.setForeground(0xFF00CC)
  56. print (" ===================================================")
  57. gpu.setForeground(0x00ff00)
  58. print(" Кидайте в трубу только " .. c )
  59. print(" Призы: " .. p )
  60. gpu.setForeground(0xFF00CC)
  61. print (" ===================================================")
  62. gpu.setForeground(0x00ff00)
  63. print(" Если выпадает число 1 вы выиграли")
  64. print(" Но если выпадает другое число, ")
  65. print(" тогда вы проиграли!!!")
  66. gpu.setForeground(0xFF00CC)
  67. print (" ===================================================")
  68. gpu.setForeground(0x00ff00)
  69. print(" Шанс выигрыша " .. b .."%")
  70. gpu.setForeground(0xFF00CC)
  71. print (" ===================================================")
  72. print ("")
  73. print ("")
  74. print ("")
  75. print ("")
  76. gpu.setForeground(0x00CCFF)
  77. print(" by DestapTM для /warp des")
  78. while true do
  79. event.pull("redstone")
  80. if redstone.getInput(sides.front) >= 1 then
  81. print("Поступил приз")
  82. term.clear()
  83. random()
  84. end
  85. end
  86. end
  87.  
  88. greeting()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement