Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = fs.open("curPlayers","r")
- playerNames = {}
- i=0
- repeat
- i=i+1
- line = file.readLine()
- playerNames[i] = line
- until line == nil
- playerNames[i] = nil
- file.close()
- rednet.open("right")
- playerPos = {}
- for k,v in pairs(playerNames) do
- rednet.send(939,k-1)
- rednet.send(939,"start")
- sleep(0.4)
- playerPos[k] = {}
- rednet.send(936,"start")
- rednet.send(937,"start")
- rednet.send(938,"start")
- rednet.send(939,"stop")
- os.startTimer(0.05)
- repeat
- info1,info2,info3,info4 = os.pullEvent()
- if info1 == "rednet_message" and type(info3) == "table" then
- if info3["action"] == "sendingX" then
- playerPos[k]["x"] = info3["x"]
- end
- if info3["action"] == "sendingY" then
- playerPos[k]["y"] = info3["y"]
- end
- if info3["action"] == "sendingZ" then
- playerPos[k]["z"] = info3["z"]
- end
- end
- until info1 == "timer"
- rednet.send(939,"stop")
- sleep(0.2)
- end
- rednet.send(939,0)
- for k,v in pairs(playerNames) do
- print(playerNames[k])
- file = fs.open("playerPos/" .. os.day("local") .. "/" .. (math.floor(os.time("local")*1000)/1000) .. "/" .. playerNames[k],"w")
- file.writeLine(playerPos[k]["x"])
- file.writeLine(playerPos[k]["y"])
- file.writeLine(playerPos[k]["z"])
- file.flush()
- file.close()
- end
- rednet.send(941,"ping")
- os.startTimer(0.1)
- repeat
- info1,info2,info3,info4 = os.pullEvent()
- until info3 == "pong" or info1 == "timer"
- if info3 == "pong" then
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement