Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- blackList={
- ["Doc_Jason"]=true,
- ["iTzBruin"]=true,
- }
- whiteList={
- ['darkbobo00']=true,
- ['dark_sjoerd']=true,
- ['Lekkerdie']=true,
- ['mastersnake20']=true,
- ['skye333']=true,
- }
- local pcX=-910
- local pcZ=-1833
- local distances={}
- sensor=peripheral.wrap("left")
- monitor=peripheral.wrap("back")
- glasses=peripheral.wrap("right")
- while true do
- 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()
- glasses.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)
- glasses.addText(5,nameIndex*10,name..": "..x..","..z.." Distance :"..distance,8192)
- elseif blackList[name] then
- monitor.setTextColor(16384)
- glasses.addText(5,nameIndex*10,name..": "..x..","..z.." Distance :"..distance,16384)
- end
- stringLength=glasses.getStringWidth(name..": "..x..","..z.." Distance :"..distance)
- glasses.addBox(0,10,stringLength+10,nameIndex*10,0.1,0.2)
- 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