WorldTPA [Sk, SkQuery] (Snippet)

  • 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!

KingAlterIV

Active Member
Jan 26, 2017
98
16
8
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:
options:
    tpaprefix: &8[&4WorldTPA&8]
    command_tpa_permission: teleporter.world.survival
    command_tpaccept_permission: teleporter.world.survival.accept


on join:
    if {timeout.%player%} is not set:
        set {timeout.%player%} to "120"
    if {requested.%player%} is not set:
        set {requested.%player%} to false


command /tpa [<player>]:
    permission: {@command_tpa_permission}
    usage: /tpa [<player>]
    trigger:
        if player's world is "Survival":
            if arg 1 is set:
                if arg 1's world is "Survival":
                    set {requested.%player%} to true
                    message "{@tpaprefix} &7Requesting to &c%arg 1% &7for tpa." to player
                    message "{@tpaprefix} &c%player% &7has requested to teleport to you" to arg 1
                    message "{@tpaprefix} &7The request will time out in &c%{timeout.%player%}% seconds" to arg 1
                    wait 120 seconds
                    if {accepted.%player%} is true:
                        set {accepted.%player%} to false
                        set {requested.%player%} to false
            else:
                message "{@tpaprefix} &7Correct Usage: &c/tpa [<player>]"

command /tpaccept [<player>]:
    permission: {@command_tpaccept_permission}
    usage: /tpaccept [<player>]
    trigger:
        if player's world is "Survival":
            if arg 1 is set:
                if arg 1's world is "Survival":
                    if {requested.%arg 1%} is true:
                        set {requested.%arg 1%} to false
                        message "{@tpaprefix} &7TPA Request accepted! &c(Wait 5 seconds, moving will disable it. Any movement. Stay still for 5 seconds.)" to arg 1
                        wait 5 seconds
                        if {moved.%arg 1%} is true:
                            message "{@tpaprefix} &7TPA canceled due to &cmovements" to arg 1
                            stop
                        else:
                            teleport arg 1 to player
                            set {accepted.%player%} to true
            else:
                message "{@tpaprefix} &7Correct Usage: &c/tpaccept [<player>]"

on walking on dirt, or stone, or cobblestone, or grass, or sand, or obsidian:
    set {moved.%player%} to true
    wait 5 seconds
    set {moved.%player%} to false
 
  • Like
Reactions: FistoF
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.
 
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.
Yes, I have tested it. Feel free to make it better though as I'm not the best with skript itself! :emoji_slight_smile: