Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- blackList={
- ["Doc_Jason"]=true,
- }
- whiteList={
- ['darkbobo00']=true,
- ['dark_sjoerd']=true,
- ['Lekkerdie']=true,
- ['mastersnake20']=true,
- ['skye333']=true,
- }
- local pcX=-910
- local pcZ=-1833
- sensor=peripheral.wrap("left")
- monitor=peripheral.wrap("back")
- while true do
- local distances={}
- for name,__ in pairs(blackList) do
- data=sensor.getPlayerData(name)
- if data~=nil then
- local pos=data['position']
- local x=pos['x']
- local z=pos['z']
- x=math.floor(pcX+x+0.5)
- z=math.floor(pcZ+z+0.5)
- distance=math.floor(math.sqrt((x-pcX)^2+(z-pcZ)^2)+0.5)
- distances[name]={['x']=x,['z']=z,['d']=distance}
- print(name.." : "..x..","..z..","..distance)
- end
- end
- for name,__ in pairs(whiteList) do
- data=sensor.getPlayerData(name)
- if data~=nil then
- local pos=data['position']
- local x=pos['x']
- local z=pos['z']
- x=math.floor(pcX+x+0.5)
- z=math.floor(pcZ+z+0.5)
- distance=math.floor(math.sqrt((x-pcX)^2+(z-pcZ)^2)+0.5)
- distances[name]={['x']=x,['z']=z,['d']=distance}
- print(name.." : "..x..","..z..","..distance)
- end
- end
- local nameIndex=1
- local monitorX,monitorY=monitor.getSize()
- monitor.clear()
- for name,information in pairs(distances) do
- monitor.setCursorPos(1,nameIndex)
- local x=information['x']
- local z=information['z']
- local distance=information['d']
- if whiteList[name] then
- monitor.setTextColor(8192)
- elseif blackList[name] then
- monitor.setTextColor(16384)
- end
- name=string.sub(name,1,6)
- monitor.write(name..": "..x..","..z.." Distance :"..distance)
- nameIndex=nameIndex+1
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement