Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensor = peripheral.wrap("top")
- monitor = peripheral.wrap("right")
- local w,h = monitor.getSize()
- --rs.setBundledOutput("left",colors.white)
- --rs.setOutput("left",false)
- function usersCheck(name)
- --users
- local users = {["USERNAME"] = true,
- --If you want more usernames to allow, copy the line below and paste it right under it
- ["USERNAME"] = true,
- ["USERNAME"] = true}
- length = table.getn(users)
- for i=1,length do
- if name ~= users[i] then
- return 1
- end
- if name == users[i] then
- return 2
- end
- end
- end
- while true do
- monitor.clear()
- i = 2
- ww = w/2 - 7
- monitor.setCursorPos(ww,1)
- monitor.write("Near your base:")
- rs.setOutput("left",false)
- targets = sensor.getPlayerNames()
- for k, v in pairs(targets) do
- name = targets[k]
- tarLeng = table.getn(targets)
- sL = string.len(name)
- ww = w/2 - sL/2 + 1
- monitor.setCursorPos(ww,i)
- monitor.clearLine(i)
- if usersCheck(name) == 2 then
- monitor.setTextColor(8192)
- elseif usersCheck(name) == 1 then
- monitor.setTextColor(colors.red)
- end
- monitor.write(name)
- monitor.setTextColor(1)
- i = i + 1
- if usersCheck(name) == 1 then
- --rs.setBundledOutput("left",colors.white)
- print("Warning: Unathorized player in range!")
- rs.setOutput("left",true)
- end
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement