Jump to content

Combat TPA (fixed and improved): No more teleporting away from combat!


PixelTrainerYT

Recommended Posts

my last submission may have been broken, so sorry about that

anyways, here is the skript:

command /tpa [<offline player>]:
	trigger:
		if arg-1 is set:
			if arg-1 is online:
				if {%uuid of player%'s tttpa} is not set:
					set {%uuid of player%'s tttpa} to now
				if {%uuid of player%'s tttpa} is smaller than now:
					set {%uuid of arg-1%'s tpar} to player
					set {_time} to now
					add 1 minutes to {_time}
					set {%uuid of arg-1%'s tttpar} to {_time}
					send "&6&l[&e&lTPA&6&l]&r TPA request sent!" to player
					send "&6&l[&e&lTPA&6&l]&r %player% has sent you a teleport request! say /tpaccept to teleport them to you!" to arg-1
				else:
					send "&6&l[&e&lTPA&6&l]&r You need to wait a bit to teleport to others!"
			else:
				send "&6&l[&e&lTPA&6&l]&r Player not found, are they on the server?" to player
		else:
			send "&6&l[&e&lTPA&6&l]&r Usage: /tpa (player)" to player

command /sethome:
	trigger:
		if {%uuid of player%'s tttpa} is not set:
			set {%uuid of player%'s tttpa} to now
		if {%uuid of player%'s tttpa} is smaller than now:
			send "your home was created" to player
			set {%uuid of player%'s home} to player's location
		else:
			send "&6&l[&e&lTPA&6&l]&r You need to wait a bit to make a home!"
command /home:
	trigger:
		if {%uuid of player%'s home} is set:
			if {%uuid of player%'s tttpa} is smaller than now:
				teleport player to {%uuid of player%'s home}
				send "&6&l[&e&lTPA&6&l]&r Sending you home!" to player
			else:
				send "&6&l[&e&lTPA&6&l]&r You need to wait a bit to teleport home!"
		else:
			send "&6&l[&e&lTPA&6&l]&r You don't have a home!" to player

command /tpaccept:
	trigger:
		if {%uuid of player%'s tpar} is set:
			if {%uuid of player%'s tttpa} is not set:
				set {%uuid of player%'s tttpa} to now
			if {%uuid of player%'s tttpar} is not set:
				set {%uuid of player%'s tttpar} to now
			if {%uuid of player%'s tttpar} is bigger than now:
				if {%uuid of player%'s tpar} is online:
					if {%uuid of player%'s tttpa} is smaller than now:
						set {_uuidoftper} to uuid of {%uuid of player%'s tpar}
						if {%{_uuidoftper}%'s tttpa} is smaller than now:
							send "&6&l[&e&lTPA&6&l]&r Teleporting you to %{%uuid of player%'s tpar}%!" to {%uuid of player%'s tpar}
							teleport {%uuid of player%'s tpar} to player
						else:
							send "&6&l[&e&lTPA&6&l]&r Cannot teleport %{%uuid of player%'s tpar}%, as they have taken damage!" to player
					else:
						send "&6&l[&e&lTPA&6&l]&r You cannot teleport others right now!" to player
				else:
					send "&6&l[&e&lTPA&6&l]&r %{%uuid of player%'s tpar}% is no longer online!" to player
			else:
				send "&6&l[&e&lTPA&6&l]&r Your TPA has expired!"
			clear {%uuid of player%'s tpar}
		else:
			send "&6&l[&e&lTPA&6&l]&r You don't have any requests!" to player



on damage of a player:
	set {_time} to now
	add 2 minutes to {_time}
	set {%uuid of victim%'s tttpa} to {_time}
	if attacker is a player:
		set {%uuid of attacker%'s tttpa} to {_time}

on death of a player:
	wait a tick
	send "&6&l[&e&lTPA&6&l]&r&4 You Died! &cYour death coords are &6%position of player%"
	
on player join:
	set {_time} to now
	add 2 minutes to {_time}
	set {%uuid of player%'s tttpa} to {_time}

if this doesn't work, im sorry lol

also not nessesary but i would like credit for my skript

if you can see this, you have vision

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...