Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local computer = require("computer")
- local term = require("term")
- local event = require("event")
- local shell = require("shell")
- local component = require("component")
- local gpu = component.gpu
- local w, h = gpu.maxResolution()
- local colors = require("colors")
- local b = 0
- local redstone = component.redstone
- local sides = require("sides")
- function greeting()
- print("Введите шанс выиграша без '%'(вводить нужно не больше 50):")
- b = io.read()
- print("Введите какие будут призы:")
- p = io.read()
- print("Введите что нужно кидать:")
- c = io.read()
- term.clear()
- screen()
- info()
- end
- function screen()
- gpu.fill(1, 1, w, h, " ")
- gpu.setResolution(w/3, h/3)
- gpu.setBackground(0x454545)
- gpu.setForeground(0xd6d6d6)
- term.clear()
- end
- function random()
- r = 100/b
- a = math.random(r)
- if a == 1 then
- print("УУУРРРААА ВЫ ВЫГРАЛИ. ЧИСЛО: " .. a)
- redstone.setOutput(sides.back, 15)
- os.sleep(3)
- redstone.setOutput(sides.back, 0)
- term.clear()
- screen()
- info()
- elseif a >= 2 then
- print("Вы проиграли (((. ЧИСЛО: " .. a)
- os.sleep(3)
- term.clear()
- screen()
- info()
- else
- print("Что-то пошло не так")
- end
- end
- function info()
- term.setCursor(1, 1)
- print("Кидайте в трубу только " .. c )
- print("Призы: " .. p )
- print("Если выпадает число 1 вы выиграли")
- print("Но если выпадает другое число, ")
- print("тогда вы проиграли!!!")
- print("Шанс выигрыша " .. b .."%")
- print("by Dronax")
- while true do
- event.pull("redstone")
- if redstone.getInput(sides.front) >= 1 then
- print("Поступил приз")
- term.clear()
- random()
- end
- end
- end
- greeting()
Advertisement
Advertisement