local pe = os.pullEvent;
os.pullEvent = os.pullEventRaw;
local owners = {"XYZPatrice", "Reverse_summon", "BEG_FOR_MERCY", "greenstar12345"};
local leaveproc = false;
function auth()
local detector = peripheral.find("playerDetector");
--term.setPaletteColor(colors.lightGray ,0x999999)
--term.setBackgroundColor(colours.lightGrey);
local fail = 0
while true do
if fail >= 5 then os.shutdown() end
local ps = "";
term.clear();
term.setCursorPos(1,1);
while true do
local event, char = os.pullEventRaw();
if event == "key" and keys.getName(char) == "enter" then
if ps ~= "" then
fail = fail + 1;
break;
end
end
if event == "char" then
ps = ps..char;
if ps == string.reverse("2b94x0") then
for _,name in ipairs(owners) do
if detector.isPlayerInRange(1, name) then
goto ok;
end
end
break;
::ok::;
return;
end
end
end
end
end
function searchl()
local detector = peripheral.find("playerDetector");
term.setBackgroundColor(colours.pink)
term.clear();
--term.setPaletteColor(colors.lightGray ,0xC9C9C9)
while true do
pcall(function()
for _,name in ipairs(owners) do
if detector.isPlayerInRange(1, name) then
goto ok;
end
end
os.shutdown();
::ok::;
--if (not detector.isPlayerInRange(1, owner)) then os.shutdown() return; end
local stext = {};
local players = detector.getOnlinePlayers()
for _,name in ipairs(players) do
local plr = detector.getPlayerPos(name)
local s = "";
if plr ~= nil then
if plr.x == nill or plr.y == nill or plr.z == nill then
--s=s.."name: "..name..":?"
else
s=s.."name: "..name.."\n"
s=s.."x: "..plr.x.." y: "..plr.y.." z: "..plr.z
table.insert(stext, s);
end
--s=s.."dim: "..plr.dimension.."\n"
end
end
term.clear()
term.setCursorPos(1,1)
for i,st in ipairs(stext) do
if i%2 == 1 then
term.setTextColor(colors.white);
else
term.setTextColor(colors.gray);
end
print(st)
end
end)
os.sleep(.75)
end
end
function keyi()
while true do
local event, key = os.pullEventRaw("key");
if key == 290 then -- f1
return;
end
if key == 294 then -- f5
term.setBackgroundColor(colors.red)
leaveproc = true;
return;
end
if key == 292 then -- f3
os.shutdown()
end
end
end
while true do
auth();
if leaveproc then
os.pullEvent = pe;
return;
end
pcall(function()
parallel.waitForAny(searchl, keyi);
end)
end