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

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Spawn script

Discussion in 'Requests' started by Kristian Rahbek, Jun 12, 2018.

  1. Kristian Rahbek

    Kristian Rahbek New Member

    Joined:
    Jun 12, 2018
    Messages:
    9
    Likes Received:
    0
    Hello guys! :emoji_slight_smile:
    I really need a spawn script. Not just a simple one, but like when you move it cancels. I will be very happy if someone would like to make this for me. The teleportation, should take about 4 secounds. Thanks a lot!
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    i whipped this up quickly.... let me know if you need a little more customization added to it

    Code (Skript):
    1.  
    2. options:
    3.     prefix: &7[&3SPAWN&7]
    4.  
    5.  
    6.  
    7. command /setspawn:
    8.     permission: spawn.set
    9.     permission message: You do not have permission to use this command
    10.     usage: player
    11.     trigger:
    12.         set {spawn} to location of player
    13.         send "{@prefix} - &aSpawn successfully set at: &b%{spawn}%"
    14.  
    15. on first join:
    16.     teleport player to {spawn}
    17.  
    18. command /spawn [<player>]:
    19.     permission: spawn.use
    20.     permission message: You do not have permission to use this command
    21.     trigger:
    22.         if arg-1 is set:
    23.             if player has permission "spawn.admin":
    24.                 teleport arg-1 to {spawn}
    25.             else:
    26.                 send "{@prefix} - &cYou do not have permission to use this command"
    27.  
    28.         if arg-1 is not set:
    29.             if player does not have permission "spawn.bypass":
    30.                 set {_location.%player%.x} to rounded x coord of player
    31.                 set {_location.%player%.y} to rounded y coord of player
    32.                 set {_location.%player%.z} to rounded z coord of player
    33.                 send "{@prefix} - &aTeleporting to spawn, please stand still" to player
    34.                 wait 1 second
    35.                 if rounded x coord of player is {_location.%player%.x}:
    36.                     if rounded y coord of player is {_location.%player%.y}:
    37.                         if rounded z coord of player is {_location.%player%.z}:
    38.                             wait 1 second
    39.                         else:
    40.                             send "{@prefix} - &cTeleportation canceled... next time stand still"
    41.                             stop
    42.                     else:
    43.                         send "{@prefix} - &cTeleportation canceled... next time stand still"
    44.                         stop
    45.                 else:
    46.                     send "{@prefix} - &cTeleportation canceled... next time stand still"
    47.                     stop
    48.                 if rounded x coord of player is {_location.%player%.x}:
    49.                     if rounded y coord of player is {_location.%player%.y}:
    50.                         if rounded z coord of player is {_location.%player%.z}:
    51.                             wait 1 second
    52.                         else:
    53.                             send "{@prefix} - &cTeleportation canceled... next time stand still"
    54.                             stop
    55.                     else:
    56.                         send "{@prefix} - &cTeleportation canceled... next time stand still"
    57.                         stop
    58.                 else:
    59.                     send "{@prefix} - &cTeleportation canceled... next time stand still"
    60.                     stop
    61.                 if rounded x coord of player is {_location.%player%.x}:
    62.                     if rounded y coord of player is {_location.%player%.y}:
    63.                         if rounded z coord of player is {_location.%player%.z}:
    64.                             wait 1 second
    65.                         else:
    66.                             send "{@prefix} - &cTeleportation canceled... next time stand still"
    67.                             stop
    68.                     else:
    69.                         send "{@prefix} - &cTeleportation canceled... next time stand still"
    70.                         stop
    71.                 else:
    72.                     send "{@prefix} - &cTeleportation canceled... next time stand still"
    73.                     stop
    74.                 if rounded x coord of player is {_location.%player%.x}:
    75.                     if rounded y coord of player is {_location.%player%.y}:
    76.                         if rounded z coord of player is {_location.%player%.z}:
    77.                             teleport player to {spawn}
    78.                             send "{@prefix} - &aYou have been successfully teleported to spawn"
    79.                         else:
    80.                             send "{@prefix} - &cTeleportation canceled... next time stand still"
    81.                             stop
    82.                     else:
    83.                         send "{@prefix} - &cTeleportation canceled... next time stand still"
    84.                         stop
    85.                 else:
    86.                     send "{@prefix} - &cTeleportation canceled... next time stand still"
    87.                     stop
    88.             if player has permission "spawn.bypass":
    89.                 teleport player to {spawn}
    90.                 send "{@prefix} - &aYou have been successfully teleported to spawn"
    91.            
    --- Double Post Merged, Jun 12, 2018, Original Post Date: Jun 12, 2018 ---
    oh also the permissions i added are as follows:
    spawn.set - Allows admins to set the spawn
    spawn.admin - Allows admins to send other players to spawn
    spawn.use - Allows players to use the spawn command
    spawn.bypass - Allows players to bypass the teleport delay
     
  3. Kristian Rahbek

    Kristian Rahbek New Member

    Joined:
    Jun 12, 2018
    Messages:
    9
    Likes Received:
    0
    Thank you very much! Its perfect
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    You're welcome. I may make a few changes to clean it up a bit, but i will make sure to forward them to you so you have the most updated version
     

Share This Page

Loading...