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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Solved Make player sit on stairs

Discussion in 'Skript' started by Kampfwombat, Apr 21, 2017.

Thread Status:
Not open for further replies.
  1. Kampfwombat

    Kampfwombat Member

    Joined:
    Apr 21, 2017
    Messages:
    14
    Likes Received:
    0
    Hey, so I just want a skript to make players sit on stairs - right click on a stair to sit on it.
    It's probably easy, but I just cant figure out how... (I'm new to skript)

     
  2. Best Answer:
    Post #3 by ShaneBee, Apr 22, 2017
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    spawn a armorstand at stairs
    make player ride at armorstand.
    finish. you got it.
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    He is correct, with armor stands it works

    Code (Skript):
    1. on rightclick on any stairs:
    2.     spawn armor stand at location below event-block
    3.     set {_entity} to last spawned entity
    4.     set is visible of {_entity} to false
    5.     make player ride {_entity}
    6.     while {_entity} exists:
    7.         if player is sneaking:
    8.             eject any passenger of {_entity}
    9.             wait 2 ticks
    10.             delete {_entity}
    11.         wait 5 tick
     
    • Useful Useful x 1
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    Thank you! It works :emoji_slight_smile:
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    How to let only sit if it's a stair pointing up?
    I think as it is, if the player try to sit on a upside down stair, he could do it.
    Thanks.
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    Here's what I came up with when I was helping someone with this the other day. It's rather complete and even stops players from using chairs to glitch through things. The only thing it doesn't do as of now is stop you from using a chair that has a block above it.
    Code (Skript):
    1. on right click on stair:
    2.   if player is not sneaking:
    3.     if player's vehicle is not set:
    4.       if data value of clicked block is between 0 and 3:
    5.         cancel the event
    6.         set {_o} to type of clicked block
    7.         spawn 1 armor stand at location 1.7 below and 0.2 in front of event-block
    8.         set {_s} to last spawned entity
    9.         add "{NoGravity:1}" to nbt of {_s}
    10.         add "{Invisible:1}" to nbt of {_s}
    11.         set {_l} to location of player
    12.         make player ride {_s}
    13.         wait 1 tick
    14.         set metadata value "chair" of {_s} to true
    15.         while check [player's vehicle is {_s}]->[{_o} is type of clicked block]:
    16.           wait 1 tick
    17.         set {_k} to method "remove" from {_s}
    18.         set pitch of {_l} to player's pitch
    19.         set yaw of {_l} to player's yaw
    20.         teleport player to {_l}
    21.  
    22. on packet:
    23.   if event-string is "PacketPlayInSteerVehicle":
    24.     if metadata value "chair" of player's vehicle is true:
    25.       if packet field "d" is true:
    26.         cancel the event
    27.         delete player's vehicle
     
    • Friendly Friendly x 1
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    Which addons do I need for it?
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,179
    Likes Received:
    218
    Skellett, skStuff and skQuery
     
    #8 ShaneBee, Apr 23, 2017
    Last edited by a moderator: Apr 29, 2017
Thread Status:
Not open for further replies.

Share This Page

Loading...