Advertisement
Specter_

TeleportToRegion

Jul 28th, 2019
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. MATCH(%@&chatcontent%,"^/%@&currentcmd% (.+)$",{&cmdcontent});
  2. @#getregionboubds=1;
  3. @&bounds=;
  4. #i=0;
  5. ECHO(/rg i %&cmdcontent%);
  6. DO;
  7. INC(#i);
  8. IF(#i=50);
  9. BREAK;
  10. ENDIF;
  11. UNTIL(%@&bounds%!=);
  12. @#getregionboubds=0;
  13. IF(#i<50);
  14. MATCH(%@&bounds%,"Bounds: \((.+)\) -> \((.+)\)",{&bound1,&bound2});
  15. IF(%&bound1%!=);
  16. SPLIT(",",%&bound1%,#bound1);
  17. SPLIT(",",%&bound2%,#bound2);
  18. FOR(#i,0,3);
  19. #tpcoords[%#i%]=#bound2[%#i%]+#bound1[%#i%];
  20. #tpcoords[%#i%]=#tpcoords[%#i%]/2;
  21. NEXT;
  22. ECHO(/tppos %#tpcoords[0]% %#tpcoords[1]% %#tpcoords[2]%);
  23. #h=0;
  24. #y=#tpcoords[1];
  25. WAIT(300ms);
  26. GETIDREL(0,%#i%,0,&hat);
  27. IF(%&hat%="air");
  28. LOG(&9Teleported you to the region &e"%&cmdcontent%");
  29. ELSE;
  30. FOR(#i,2,255);
  31. GETIDREL(0,%#i%,0,&hat);
  32. IF(%&hat%="air");
  33. ECHO(/tppos %#tpcoords[0]% %#y% %#tpcoords[2]%);
  34. LOG("&9Teleported you to the region &e"%&cmdcontent%"");
  35. #i=#h;
  36. BREAK;
  37. ENDIF;
  38. #y=%YPOS%+#i;
  39. NEXT;
  40. ENDIF;
  41. #border=#bound2[1]-#tpcoords[1];
  42. IF(#h>#border);
  43. LOG(&9It is &e%#h% &9blocks below!);
  44. ENDIF;
  45. UNSET(&bound1);
  46. UNSET(&bound2);
  47. ENDIF;
  48. ELSE;
  49. LOG(&cError.);
  50. ENDIF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement