Advertisement
SirBaconBitz

Stalk

Feb 14th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. players = {}
  2. monitor = peripheral.wrap("top")
  3. sens = peripheral.wrap("left")
  4. p = peripheral.wrap("bottom")
  5. function getlocation(username)
  6.   data = sens.getPlayerData(username)
  7.   x = data.position.x + 916
  8.   y = data.position.y + 71
  9.   z = data.position.z + 1071
  10.   return x,y,z
  11. end
  12. function getdirection(username)
  13.   data = sens.getPlayerData(username)
  14.   yaw = data.yaw
  15.   if yaw<225 and yaw>130 then
  16.     direction = "North"
  17.   elseif yaw>223 and yaw<331 then
  18.     direction = "East"
  19.   elseif yaw>309 then
  20.     direction = "South"
  21.   elseif yaw<46 then
  22.     direction = "South"
  23.   elseif yaw>44 and yaw<132 then
  24.     direction = "West"
  25.   else
  26.     direction = "N/A"
  27.   end
  28.   return direction
  29. end
  30. bacon = true
  31. while bacon == true do
  32.     input = read()
  33.     if input == "stop" then
  34.     bacon = false
  35.     else
  36.     table.insert(players, input)
  37.     end
  38. end
  39. while true do
  40. p.clear()
  41. mony = 1
  42.     for k,v in pairs(players) do
  43.     x, y, z = getlocation(v)
  44.     x = math.floor(x)
  45.     y = math.floor(y)
  46.     z = math.floor(z)
  47.     dir = getdirection(v)
  48.     text = p.addText(1,mony,v.." Is located at ".."X: "..tostring(x).." Y: "..tostring(y).." Z: "..tostring(z).." and is facing "..dir,0xFFFFFF)
  49.     text.setScale(0.5)
  50.     mony = mony + 4
  51.     end
  52. sleep(1)
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement