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("Введите шанс выигрыша без '%'(20 норм (не больше 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(0x0000ff)
- gpu.setForeground(0xffff00)
- term.clear()
- end
- component.chat_box.setName("§6Казино!")
- function random()
- component.chat_box.say("§1Крутим рулетку!!!")
- r = 100/b
- a = math.random(r)
- if a == 1 then
- component.chat_box.say("§3Вы выйграли, ЧИСЛО: " .. a)
- redstone.setOutput(sides.back, 15)
- os.sleep(3)
- redstone.setOutput(sides.back, 0)
- screen()
- info()
- elseif a >= 2 then
- component.chat_box.say("§4Вы проиграли, ЧИСЛО: " .. a)
- screen()
- info()
- else
- print("Что-то пошло не так")
- end
- end
- function info()
- term.setCursor(1, 1)
- print ("=====================================================")
- print("Кидайте в трубу только " .. c )
- print("Призы: " .. p )
- print ("=====================================================")
- print("Если выпадает число 1 вы выиграли")
- print("Но если выпадает другое число, ")
- print("тогда вы проиграли!!!")
- print ("=====================================================")
- print("Шанс выигрыша " .. b .."%")
- print(" by DanilValiev1 для /warp des")
- print ("=====================================================")
- while true do
- event.pull("redstone")
- if redstone.getInput(sides.front) >= 1 then
- print("Поступил приз")
- term.clear()
- random()
- end
- end
- end
- greeting()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement