Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- margherita = "right"
- marinara = "bottom"
- allowed = "left"
- denied = "top"
- pizzaType = true
- local function searchUser(user)
- local userList = fs.open("users", "r")
- checkUser = string.find(userList.readAll(), user)
- userList.close()
- return checkUser
- end
- local function addUser(user)
- local userList = fs.open("users", "a")
- userList.writeLine(user)
- userList.close()
- end
- local function resetRedstone()
- rs.setOutput(margherita, false)
- rs.setOutput(marinara, false)
- rs.setOutput(allowed, false)
- rs.setOutput(denied, false)
- end
- local function resetList()
- if fs.exists("users") then
- fs.delete("users")
- end
- local userList = fs.open("users", "w")
- userList.writeLine("MegaAlbert4000")
- userList.close()
- end
- os.setAlarm(0)
- resetRedstone()
- resetList()
- while true do
- local event, user = os.pullEvent()
- if event == "player" then
- local checkUser = searchUser(user)
- if checkUser == nil or checkUser == "" then
- addUser(user)
- if pizzaType then
- rs.setOutput(margherita, true)
- else
- rs.setOutput(marinara, true)
- end
- pizzaType = not pizzaType
- rs.setOutput(allowed, true)
- sleep(1)
- resetRedstone()
- else
- rs.setOutput(denied, true)
- sleep(1)
- resetRedstone()
- end
- elseif event == "alarm" then
- resetList()
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment