Advertisement
NanoBob

NanoTrace

Sep 23rd, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. blackList={
  2. ["Doc_Jason"]=true,
  3. ["iTzBruin"]=true,
  4. }
  5. whiteList={
  6. ['darkbobo00']=true,
  7. ['dark_sjoerd']=true,
  8. ['Lekkerdie']=true,
  9. ['mastersnake20']=true,
  10. ['skye333']=true,
  11. }
  12.  
  13. glassesController="darkbobo00"
  14. local distances={}
  15. sensor=peripheral.wrap("right")
  16. glasses=peripheral.wrap("left")
  17. local pcX=-908
  18. local pcZ=-1835
  19. local pcY=84
  20.  
  21.  
  22. while true do
  23.     data=sensor.getPlayerData(glassesController)
  24.     if data~=nil then
  25.     playerX=data['position']['x']+pcX
  26.     playerZ=data['position']['z']+pcZ
  27.     playerY=data['position']['y']+pcY
  28.     print(glassesController.." : "..playerX..","..playerZ..","..playerY)
  29.   for name,__ in pairs(blackList) do
  30.     data=sensor.getPlayerData(name)
  31.     if data~=nil then
  32.       local pos=data['position']
  33.       local x=pos['x']
  34.       local z=pos['z']
  35.       local y=pos['y']
  36.       x=math.floor(pcX+x+0.5)
  37.       z=math.floor(pcZ+z+0.5)
  38.       y=math.floor(pcY+y+0.5)
  39.       distance=math.floor(math.sqrt((x-playerX)^2+(z-playerZ)^2)+0.5)
  40.       distances[name]={['x']=x,['z']=z,['y']=y,['d']=distance}
  41.       print(name.." : "..x..","..z..","..y..","..distance)
  42.     end
  43.   end
  44.   for name,__ in pairs(whiteList) do
  45.     data=sensor.getPlayerData(name)
  46.     if data~=nil then
  47.       local pos=data['position']
  48.       local x=pos['x']
  49.       local z=pos['z']
  50.       local y=pos['y']
  51.       x=math.floor(pcX+x+0.5)
  52.       z=math.floor(pcZ+z+0.5)
  53.       y=math.floor(pcY+y+0.5)
  54.       distance=math.floor(math.sqrt((x-playerX)^2+(z-playerZ)^2)+0.5)
  55.       distances[name]={['x']=x,['z']=z,['y']=y,['d']=distance}
  56.       print(name.." : "..x..","..z..","..y..","..distance)
  57.     end
  58.   end
  59.  
  60.   local nameIndex=1
  61.   glasses.clear()
  62.   for name,information in pairs(distances) do
  63.     local x=information['x']
  64.     local z=information['z']
  65.     local height=information['y']
  66.     local distance=information['d']
  67.     if whiteList[name] then
  68.         glasses.addText(5,nameIndex*10,name..": "..x..","..z.." Height :"..height.."  Distance :"..distance,50000)
  69.     elseif blackList[name] then
  70.         glasses.addText(5,nameIndex*10,name..": "..x..","..z.." Height :"..height.."  Distance :"..distance,8000000)
  71.     end
  72.     stringLength=glasses.getStringWidth(name..": "..x..","..z.."  Distance :"..distance)
  73.     glasses.addBox(0,nameIndex*10,stringLength+10,10,10000000,0.2)
  74.     name=string.sub(name,1,6)
  75.     nameIndex=nameIndex+1
  76.   end
  77.   end
  78.   sleep(2)
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement