Advertisement
wambot

Untitled

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