1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WorldTPA [Sk, SkQuery] (Snippet)

Discussion in 'Snippets' started by KingAlterIV, Jan 27, 2017.

  1. KingAlterIV

    KingAlterIV Active Member

    Jan 26, 2017
    Likes Received:
    Here's a skript that @BrettPlayMC requested.

    Will probably be updated later on (Feel free to update it if you wish! :emoji_slight_smile:)

    Code (Text):
    1. options:
    2.     tpaprefix: &8[&4WorldTPA&8]
    3.     command_tpa_permission: teleporter.world.survival
    4.     command_tpaccept_permission: teleporter.world.survival.accept
    7. on join:
    8.     if {timeout.%player%} is not set:
    9.         set {timeout.%player%} to "120"
    10.     if {requested.%player%} is not set:
    11.         set {requested.%player%} to false
    14. command /tpa [<player>]:
    15.     permission: {@command_tpa_permission}
    16.     usage: /tpa [<player>]
    17.     trigger:
    18.         if player's world is "Survival":
    19.             if arg 1 is set:
    20.                 if arg 1's world is "Survival":
    21.                     set {requested.%player%} to true
    22.                     message "{@tpaprefix} &7Requesting to &c%arg 1% &7for tpa." to player
    23.                     message "{@tpaprefix} &c%player% &7has requested to teleport to you" to arg 1
    24.                     message "{@tpaprefix} &7The request will time out in &c%{timeout.%player%}% seconds" to arg 1
    25.                     wait 120 seconds
    26.                     if {accepted.%player%} is true:
    27.                         set {accepted.%player%} to false
    28.                         set {requested.%player%} to false
    29.             else:
    30.                 message "{@tpaprefix} &7Correct Usage: &c/tpa [<player>]"
    32. command /tpaccept [<player>]:
    33.     permission: {@command_tpaccept_permission}
    34.     usage: /tpaccept [<player>]
    35.     trigger:
    36.         if player's world is "Survival":
    37.             if arg 1 is set:
    38.                 if arg 1's world is "Survival":
    39.                     if {requested.%arg 1%} is true:
    40.                         set {requested.%arg 1%} to false
    41.                         message "{@tpaprefix} &7TPA Request accepted! &c(Wait 5 seconds, moving will disable it. Any movement. Stay still for 5 seconds.)" to arg 1
    42.                         wait 5 seconds
    43.                         if {moved.%arg 1%} is true:
    44.                             message "{@tpaprefix} &7TPA canceled due to &cmovements" to arg 1
    45.                             stop
    46.                         else:
    47.                             teleport arg 1 to player
    48.                             set {accepted.%player%} to true
    49.             else:
    50.                 message "{@tpaprefix} &7Correct Usage: &c/tpaccept [<player>]"
    52. on walking on dirt, or stone, or cobblestone, or grass, or sand, or obsidian:
    53.     set {moved.%player%} to true
    54.     wait 5 seconds
    55.     set {moved.%player%} to false
    FistoF likes this.
  2. ShaneBee

    Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
    Hey, your script is good but there are a bunch of things that could be optmized, for example use list variables instead of single variables, use player's uuid instead of the player object as index and other kind of things.

    P.S: Did you test it? I see there things that may not work.
  3. ShaneBee

    Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
    Yes, I have tested it. Feel free to make it better though as I'm not the best with skript itself! :emoji_slight_smile:

Share This Page