Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sensor = peripheral.wrap("top")
- local bsensor = peripheral.wrap("openperipheral_sensor_1")
- local monitor = peripheral.wrap("monitor_3")
- monitor.clear()
- monitor.setCursorPos(1,1)
- local pIn =
- {
- ["Wazyr"] = false,
- ["jonassvensson4"] = false,
- ["Fragwad"] = false,
- ["Pure_Salt"] = false,
- ["Powerfarmer"] = false,
- ["Naxix"] = false,
- ["AndersWithTheCat"] = false,
- ["CannaJR"] = false,
- ["Blazing_sword27"] = false,
- ["Kenny608uk"] = false,
- ["Sorms"] = false,
- ["jjceel"] = false,
- ["Understalker"] = false,
- ["Pangolin"] = false,
- ["Sunconure11"] = false,
- ["Isoceth"] = false,
- ["CatManTad"] = false,
- ["it_is_me"] = false,
- ["BossSnake"] = false,
- ["DarkKnight53642"] = false,
- ["pyro1212"] = false,
- ["UsamiUsagi"] = false,
- ["Rihawk"] = false,
- ["bonkeywonkey"] = false,
- ["shaquiqui"] = false,
- ["antnuts"] = false,
- ["Coffe_x"] = false,
- ["thygamerr"] = false,
- ["TheRealElonMusk"] = false
- }
- -- Get users outside the shop
- function getUserOut()
- playersb = bsensor.getPlayers()
- if playersb[1] == nil then
- -- No one is outside
- else
- usernameOut = playersb[1].name
- for name, status in pairs(pIn) do
- if pIn[usernameOut] == true then
- monitor.setTextColor(colors.red)
- monitor.setCursorPos(1,1)
- monitor.write("Please come again!")
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(1,2)
- monitor.write(" " .. usernameOut)
- sleep(1)
- monitor.clear()
- pIn[usernameOut] = false
- end
- end
- end
- end
- -- Get user who enters the shop
- function getUser()
- players = sensor.getPlayers()
- -- Checks if there's a player inside the shop
- if players[1] == nil then
- username = "null"
- else
- -- Player found
- username = players[1].name
- for name, status in pairs(pIn) do
- if pIn[username] == true then
- -- Player has already been in the shop
- playersb = bsensor.getPlayers()
- if playersb[1] == nil then
- -- No one is outside
- else
- usernameOut = playersb[1].name
- if pIn[usernameOut] == true then
- pIn[usernameOut] = false
- break
- end
- end
- elseif pIn[username] == false then
- pIn[username] = true
- -- Welcome message:
- monitor.setTextColor(colors.green)
- monitor.setCursorPos(1,1)
- monitor.write(" Welcome!")
- monitor.setCursorPos(1,2)
- monitor.setTextColor(colors.white)
- monitor.write(" " .. username)
- sleep(2)
- monitor.clear()
- end
- end
- end
- end
- while true do
- monitor.setCursorPos(1,1)
- getUser()
- sleep(0.75)
- end
Add Comment
Please, Sign In to add comment