Jump to content

Spawn Skript (efficient)


itsKimo

Recommended Posts

command spawn [<player>]:
	trigger:
		arg-1 is not set:
			{combatlog.%player%} is set:
				send "&cYou cannot go to spawn now!" to player
			else:
				teleport player to spawn
				send "&aYou have been sent to spawn." to player
		else:
			player does not have permission "spawn.other":
				send "&cYou cannot teleport others to spawn!" to player
			else:
				teleport arg-1 to spawn
				send "&aYou have been sent to spawn." to arg-1
				send "&aYou have sent %arg-1% &ato spawn." to player
command setspawn:
	permission: spawn.set
	permission message: &cInsufficient permissions!
	trigger:
		set spawn to player's location
		send "&aSpawn has been set!" to player

this is super easy to use. works in ANY world, if a spawn is not set  it just teleports them to the worlds' default spawn.

dont hate please and ask me if you need any help

there is a combat log thing if you want it. u can always just not use it, it doesn't matter much, if u dont wanna use it u dont have to delete anything as the variable wont ever be set

 

Enjoy 😄

Link to comment
Share on other sites

On 10/7/2021 at 11:56 AM, Legendary_Edwin said:

can u add a countdown too? and if u move it get's cancelled? just question

sure! 

command spawn [<player>]:
	trigger:
		arg-1 is not set:
			{combatlog.%player%} is set:
				send "&cYou cannot go to spawn now!" to player
			else:
  				set {spawns.%player%} to true
  				wait 5 seconds
  				if {move.%player%} is set:
  					delete {move.%player%}
  					stop
  				else:
  					delete {spawns.%player%}
					teleport player to spawn
					send "&aYou have been sent to spawn." to player
		else:
			player does not have permission "spawn.other":
				send "&cYou cannot teleport others to spawn!" to player
			else:
				teleport arg-1 to spawn
				send "&aYou have been sent to spawn." to arg-1
				send "&aYou have sent %arg-1% &ato spawn." to player
command setspawn:
	permission: spawn.set
	permission message: &cInsufficient permissions!
	trigger:
		set spawn to player's location
		send "&aSpawn has been set!" to player
on any movement:
  	if {spawns.%player%} is set:
  		send "&cYou moved! Teleportation cancelled!"
  		set {move.%player%} to true
  		delete {spawns.%player%}

 

Link to comment
Share on other sites

7 minutes ago, itsKimo said:

sure! 

command spawn [<player>]:
	trigger:
		arg-1 is not set:
			{combatlog.%player%} is set:
				send "&cYou cannot go to spawn now!" to player
			else:
  				set {spawns.%player%} to true
  				wait 5 seconds
  				if {move.%player%} is set:
  					delete {move.%player%}
  					stop
  				else:
  					delete {spawns.%player%}
					teleport player to spawn
					send "&aYou have been sent to spawn." to player
		else:
			player does not have permission "spawn.other":
				send "&cYou cannot teleport others to spawn!" to player
			else:
				teleport arg-1 to spawn
				send "&aYou have been sent to spawn." to arg-1
				send "&aYou have sent %arg-1% &ato spawn." to player
command setspawn:
	permission: spawn.set
	permission message: &cInsufficient permissions!
	trigger:
		set spawn to player's location
		send "&aSpawn has been set!" to player
on any movement:
  	if {spawns.%player%} is set:
  		send "&cYou moved! Teleportation cancelled!"
  		set {move.%player%} to true
  		delete {spawns.%player%}

 

Instead of using on any move to track movement, which requires skquery, just use a loop in the command and check if the player's location changed.

set {_l} to player's location
loop 5 times:
	wait 1 second
	if player's location is not {_l}:
		# player has moved. stop teleport here

# teleport player here

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

12 minutes ago, _Tarna_ said:

Instead of using on any move to track movement, which requires skquery, just use a loop in the command and check if the player's location changed.

set {_l} to player's location
loop 5 times:
	wait 1 second
	if player's location is not {_l}:
		# player has moved. stop teleport here

# teleport player here

ty lol i never knew an equivelent to it

Link to comment
Share on other sites

  • 7 months later...

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...