Advertisement
Dronax

Casino

Mar 12th, 2017
2,972
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 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("Введите шанс выиграша без '%'(вводить нужно не больше 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(0x454545)
  29.     gpu.setForeground(0xd6d6d6)
  30.     term.clear()
  31. end
  32.  
  33. function random()
  34.     r = 100/b
  35.     a = math.random(r)
  36.     if a == 1 then
  37.         print("УУУРРРААА ВЫ ВЫГРАЛИ. ЧИСЛО: " .. a)
  38.         redstone.setOutput(sides.back, 15)
  39.         os.sleep(3)
  40.         redstone.setOutput(sides.back, 0)
  41.         term.clear()
  42.         screen()
  43.         info()
  44.     elseif a >= 2 then
  45.         print("Вы проиграли  (((. ЧИСЛО: " .. a)
  46.         os.sleep(3)
  47.         term.clear()
  48.         screen()
  49.         info()
  50.     else
  51.         print("Что-то пошло не так")  
  52.     end
  53. end
  54.  
  55. function info()
  56.     term.setCursor(1, 1)
  57.     print("Кидайте в трубу только " .. c )
  58.     print("Призы: " .. p )
  59.     print("Если выпадает число 1 вы выиграли")
  60.     print("Но если выпадает другое число, ")
  61.     print("тогда вы проиграли!!!")
  62.     print("Шанс выигрыша "  .. b .."%")
  63.     print("by Dronax")
  64.     while true do
  65.         event.pull("redstone")
  66.         if redstone.getInput(sides.front) >= 1 then
  67.             print("Поступил приз")
  68.             term.clear()
  69.             random()
  70.         end
  71.     end
  72. end
  73.  
  74. greeting()
Advertisement
Comments
  • Weref
    1 year (edited)
    Comment was deleted
Add Comment
Please, Sign In to add comment
Advertisement