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,
- }
- glassesController="darkbobo00"
- local distances={}
- sensor=peripheral.wrap("right")
- glasses=peripheral.wrap("left")
- local pcX=-908
- local pcZ=-1835
- local pcY=84
- while true do
- data=sensor.getPlayerData(glassesController)
- if data~=nil then
- playerX=data['position']['x']+pcX
- playerZ=data['position']['z']+pcZ
- playerY=data['position']['y']+pcY
- print(glassesController.." : "..playerX..","..playerZ..","..playerY)
- 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']
- local y=pos['y']
- x=math.floor(pcX+x+0.5)
- z=math.floor(pcZ+z+0.5)
- y=math.floor(pcY+y+0.5)
- distance=math.floor(math.sqrt((x-playerX)^2+(z-playerZ)^2)+0.5)
- distances[name]={['x']=x,['z']=z,['y']=y,['d']=distance}
- print(name.." : "..x..","..z..","..y..","..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']
- local y=pos['y']
- x=math.floor(pcX+x+0.5)
- z=math.floor(pcZ+z+0.5)
- y=math.floor(pcY+y+0.5)
- distance=math.floor(math.sqrt((x-playerX)^2+(z-playerZ)^2)+0.5)
- distances[name]={['x']=x,['z']=z,['y']=y,['d']=distance}
- print(name.." : "..x..","..z..","..y..","..distance)
- end
- end
- local nameIndex=1
- glasses.clear()
- for name,information in pairs(distances) do
- local x=information['x']
- local z=information['z']
- local height=information['y']
- local distance=information['d']
- if whiteList[name] then
- glasses.addText(5,nameIndex*10,name..": "..x..","..z.." Height :"..height.." Distance :"..distance,50000)
- elseif blackList[name] then
- glasses.addText(5,nameIndex*10,name..": "..x..","..z.." Height :"..height.." Distance :"..distance,8000000)
- end
- stringLength=glasses.getStringWidth(name..": "..x..","..z.." Distance :"..distance)
- glasses.addBox(0,nameIndex*10,stringLength+10,10,10000000,0.2)
- name=string.sub(name,1,6)
- nameIndex=nameIndex+1
- end
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement