teleport_signs.sk

Created by Zeldaboy111

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

#©
#- Reselling/Reuploading while claiming that it is yours or made by you is disallowed
#- Do not edit it and upload it as your own
#- While using it in a video, please feature everything under "Video"
#©
#
#Video:
#Skript made by Zeldaboy111
#More content of the creator: https://forums.skunity.com/search/26443679/
options:
	logo: &d&lT&5&lS&8:&7

command /teleportsign [<text>] [<text>] [<text>] [<text>] [<text>] [<text>] [<text>]:
	aliases: tpsign
	trigger:
		if player has permission "teleportsign.*":
			if arg-1 is "create":
				if target block of player is any sign:
					if distance between location of player and location of target block of player <= 5:
						if {teleportsign.%location of target block of player%.teleportTo} is not set:
							if (arg-2 parsed as a number) and (arg-3 parsed as a number) and (arg-4 parsed as a number) is set:
								set {_yaw} to 180
								set {_pitch} to 0
								set {_world} to world of player
								if arg-5 is set:
									if arg-5 parsed as an integer is set:
										set {_yaw} to arg-5 parsed as an integer
										if arg-6 and arg-6 parsed as an integer is set:
											set {_pitch} to arg-6 parsed as an integer
											if arg-7 is set:
												if arg-7 parsed as a world is set:
													set {_world} to arg-7 parsed as a world
												else:
													send "{@logo} The world %arg-7% &7does not exist."
													stop
										else:
											send "{@logo} Invalid Usage!%nl% &8- &7/tpsign delete%nl% &8- &7/tpsign create <x> <y> <z> [yaw] [pitch] [world]"
											stop
									else:
										send "{@logo} Invalid Usage!%nl% &8- &7/tpsign delete%nl% &8- &7/tpsign create <x> <y> <z> [yaw] [pitch] [world]"
										stop

								# Set to variables = inefficient but I have done this to make sure the reloading does not take very long.
								set {_x} to x-coordinate of player
								set {_y} to y-coordinate of player
								set {_z} to z-coordinate of player
								set {_location} to location at {_x}, {_y}, {_z} in world {_world}
								set yaw of {_location} to {_yaw}
								set pitch of {_location} to {_pitch}


								set {teleportsign.%location of target block of player%.teleportTo} to {_location}
								send "{@logo} You have created the telport sign."
							else:
								send "{@logo} Invalid Usage!%nl% &8- &7/tpsign delete%nl% &8- &7/tpsign create <x> <y> <z> [yaw] [pitch] [world]"
						else:
							send "{@logo} A teleport sign already exists at this location."
					else:
						send "{@logo} You must be looking at a sign."
				else:
					send "{@logo} You must be looking at a sign."
			else if arg-1 is "delete":
				if target block of player is any sign:
					if distance between location of player and location of target block of player <= 5:
						if {teleportsign.%location of target block of player%.teleportTo} is set:
							delete {teleportsign.%location of target block of player%.teleportTo}
							loop 4 times:
								set line loop-value of target block of player to ""
							send "{@logo} You have deleted the teleport sign at the location you were looking at."
						else:
							send "{@logo} There is no teleport sign found at the location you are looking at."
					else:
						send "{@logo} You must be looking at a sign."
				else:
					send "{@logo} You must be looking at a sign."
			else:
				send "{@logo} Invalid Usage!%nl% &8- &7/tpsign delete%nl% &8- &7/tpsign create <x> <y> <z> [yaw] [pitch] [world]"
		else:
			send "{@logo} You do not have enough permissions to use this command."

on break of any sign:
	if {teleportsign.%location of target block of player%.teleportTo} is set:
		cancel event
		send "{@logo} You cannot break a teleport sign."

on right click on sign:
	if {teleportsign.%location of event-block%.teleportTo} is set:
		teleport player to {teleportsign.%location of event-block%.teleportTo}