TPA System

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

Cupex

Member
Feb 16, 2020
43
1
8
26
Category: TPA System

Suggested name: TPA.sk

Spigot/Skript Version: 1.8 / 2.2-dev25

What I want:
I would like to have a TPA system that works like this:
The command /tpa (player) sends the other player a tpa request. This player then has 30 seconds to accept them. If this is not the case, the request becomes invalid and the player can no longer accept it and you have to send a new request. If the player who sent the request leaves the server, the request is automatically deleted and the player who received the request receives a message that the player has left the server and the request has become invalid.
During the time the player is teleported if the request has been accepted, the player may not move (for 3 seconds). If he moves, the teleportation is canceled and you have to send a new request. The command /tpdeny rejects the request. The command /tpatoggle is used to deactivate or activate the function. If you deactivate it, nobody can send a request anymore.


Ideas for commands: /tpa (player), /tpaccept, /tpdeny, /tpatoggle, /tpahere

Ideas for permissions: none

When I'd like it by: If possible before October 20th
 
Sorry friend but I could not continue with the script due to time issues, if someone who sees this wants to help you feel free to take the code and fix/edit it


Code:
command /tpa [<player>]:
    trigger:
        if arg-1 is set:
            send "&a[!] Tp send correctly"
            send "&a[!] You have a tpa request from: &2%sender%" to arg-1
            send "&8- &7Use &f/tpaccept &7to accept the tp!"
            send "&8- &7Use &f/tpdeny &7tp deny the tp!"
            set {tpa.pending.%arg-1%} to arg-1
            set {tpa.sender.%sender%} to player
        if arg-1 is not set:
            send "&c[!] You must put some nick! &e/tpa (player)"
            stop
        
command /tpaccept:
    trigger:
        if {tpa.pending.%player%} is set:
            send "&a[!] Tp accepted"
            wait 5 ticks
            teleport {tpa.sending.%player%} to sender
            wait 1 tick
            delete {tpa.sending.%player%}
            delete {tpa.sender.%sender%}
            stop
        if {tpa.pending.%player%} is not set:
            send "&c[!] You dont have any request of tp :(."
            stop
            
command /tpdeny:
    trigger:
        if {tpa.pending.%player%} is set:
            send "&c[!] You denied the tp."
            wait 1 tick
            delete {tpa.sending.%player%}
            delete {tpa.sender.%sender%}
            stop
        if {tpa.pending.%player%} is not set:
            send "&c[!] You dont have any request of tp :(."
            stop