FoxWorn3365

ExampleAdventure

Nov 22nd, 2021
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. --Move the player to the specified coordinates
  2. local args = {...}
  3. if args[3] == nil then
  4. print('Requires 3 args.')
  5. else
  6. local p = peripheral.wrap('left')
  7. local username = p.getPlayers(1)
  8. local cX,cY,cZ = p.playerCoords(username)
  9. cX = math.floor(cX)
  10. cY = math.floor(cY)
  11. cZ = math.floor(cZ)
  12. local x = tonumber(args[1])
  13. local y = tonumber(args[2])
  14. local z = tonumber(args[3])
  15. local nX = cX + x
  16. local nY = cY + y
  17. local nZ = cZ + z
  18. print("Current player position: "..cX..", "..cY..", "..cZ)
  19. print("New player position: "..nX..", "..nY..", "..nZ)
  20. p.setPlayerPos(username, nX,nY,nZ)
  21. end
Advertisement
Add Comment
Please, Sign In to add comment