NoRng_ Posted May 2, 2022 Posted May 2, 2022 So im looking for a spawn command that teleports a player to spawn after 5 seconds and says "5... 4... 3... 2... 1..." but if they get hit or move it cancels the tp. i already made the setspawn command command /setspawn: permission: spawn.set permission message: &cYou do not have access to this command. trigger: set {spawn} to player's location send "&aSpawn has been set to: &2%{spawn}%" to player But cant figure out the spawn command. Can anyone help?
BanditEagle Posted May 5, 2022 Posted May 5, 2022 (edited) Maybe try something like this: command /spawn: trigger: set {_cooldown} to 100 set {_loc} to location of player while {_cooldown} is not 0: remove 1 from {_cooldown} if distance between {_loc} and player is not 0: send "Canceling teleport to spawn." stop wait a tick teleport player to {spawn} Im not entirely sure how to cancel the tp if they take damage, but I think this should work for canceling if the player moves. I haven't tested it out, so if there are any errors/issues, let me know. EDIT: I figured out how to integrate the taking damage part as well, so here is the new skript: options: combatTagTime: 5 #The time needed until combat tag is removed (in seconds) spawnCountdown: 100 #The time needed until you can teleport to spawn (in ticks, 100 ticks = 5 seconds) spawnCountdownMsg: "&6You will be teleported to spawn in <number> seconds." #Message players receive when using /spawn tagMsg: "&6You are now in combat. You cannot teleport to spawn now." #Message players receive when they get in combat noTagMsg: "&6You are no longer in combat. You may teleport to spawn now." #Message players receive when they aren't in combat on leave: clear {combatTag::%player%} on damage of player: attacker is a player if {combatTag::%victim%} is not set: set {combatTag::%victim%} to true send {@tagMsg} to victim if {combatTag::%attacker%} is not set: set {combatTag::%attacker%} to true send {@tagMsg} to attacker wait {@combatTagTime} seconds clear {combatTag::%victim%} clear {combatTag::%attacker%} send {@noTagMsg} to victim send {@noTagMsg} to attacker on death of player: if {combatTag::%victim%} is set: clear {combatTag::%victim%} command /setspawn: permission: spawn.set permission message: &cYou do not have access to this command" trigger: set {spawn} to player's location send "&aSpawn has been set to: &2%{spawn}%" to player command /spawn: trigger: if {combatTag::%player%} is set: send "Canceling teleport to spawn: Cannot teleport when in combat." stop set {_countdown} to {@spawnCountdown} set {_loc} to location of player set {_msg} to {@spawnCountdownMsg} set {_seconds} to floor(({_countdown})/5) loop {_seconds} times: add {_int} to {_list::*} remove 1 from {_int} while {_countdown} is not 0: if distance between {_loc} and player is not 0: send "Canceling teleport to spawn: Cannot teleport when moving." stop if {combatTag::%player%} is set: send "Canceling teleport to spawn: Cannot teleport when in combat." stop set {_int} to floor(({_countdown})/5) if {_list::%{_int}%} is not set: set {_list::%{_int}%} to true replace "<number>" in {_msg} with "%{_int}%" send "%{_msg}%" to player remove 1 from {_countdown} wait a tick teleport player to {spawn} Edited May 5, 2022 by BanditEagle If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot! Some Minehut Links: Server Rules • Staff Applications • News & Updates • Reports • Appeals Minehut: VIP (07/04/2021 --> Current)Elestra/Versa Realms: Manager (12/04/2021 --> Current) If you have any questions contact me!My Discord: BanditEagle#2481My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/My IGN: BanditEagle
BanditEagle Posted May 25, 2022 Posted May 25, 2022 You can use this, i created a combat tag skript. Just please make sure to leave the credits in the file and not to distribute it to other players as if you created it. If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot! Some Minehut Links: Server Rules • Staff Applications • News & Updates • Reports • Appeals Minehut: VIP (07/04/2021 --> Current)Elestra/Versa Realms: Manager (12/04/2021 --> Current) If you have any questions contact me!My Discord: BanditEagle#2481My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/My IGN: BanditEagle
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now