AutismAlex

Untitled

Dec 19th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. command getNearest(target){ // Declares the command 'getNearest' and its parameters 'target'
  2. permission = "getNearest"; // Makes the command require the 'getNearest' Permission
  3. execute(){ // This code will be ran if the player has permissions
  4. if(isSet(target)){
  5. target = toPlayer(target); // sets the target variable to the player specified
  6. if(isSet(target)){
  7. wait.seconds(120, waitLocation(player, target)); // waits 120 seconds(2 Minutes) then calls the function waitLocation with the parameters 'player' as the caller and 'target' as the target
  8. }
  9. else{
  10. player.message("Target player could not be found");
  11. }
  12. }
  13. else{
  14. player.message("You did not specify a player");
  15. }
  16. }
  17. }
  18. function waitLocation(caller, target){ // // Declares the function and its parameters to be called from elsewhere
  19. nearestLocation = target.getNearestLocation(); // sets the variable to the targets nearest location
  20. caller.message(target.name + "'s nearest location is " + nearestLocation); // Messages the player who called the command with the target location
  21. }
Advertisement
Add Comment
Please, Sign In to add comment