Advertisement
Alakazard12

PlayerSearch

Dec 24th, 2013
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. os.loadAPI("/ocs/apis/sensor")
  2. local Sens = sensor.wrap("right")
  3. local SensorPos = {-2721, 68, 2516}
  4. local TimeServer = "http://www.timeapi.org/utc/now"
  5.  
  6. local TimeR = http.get(TimeServer).readAll()
  7.  
  8. local function TimeThread()
  9.   Year, Month, Day, Hour, Minute, Second = TimeR:match("(.-)%-(.-)%-(.-)T(.-):(.-):(.-)%+")
  10.   print(Year .. ", " .. Month .. ", " .. Day .. ", " .. Hour .. ", " .. Minute .. ", " .. Second)
  11. end
  12.  
  13. TimeThread()
  14.  
  15. while true do
  16.   sleep(2)
  17.   local Players = Sens.getTargets()
  18.   for i,v in pairs(Players) do
  19.     --print(textutils.serialize(v) .. "\n")
  20.     print(i .. ": " .. SensorPos[1] + v.Position["X"] .. ", " .. SensorPos[2] + v.Position["Y"] .. ", " .. SensorPos[3] + v.Position["Z"])
  21.   end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement