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.

Solved Keycard skript

Discussion in 'Requests' started by TheMangoCrew, Nov 15, 2020.

  1. TheMangoCrew

    TheMangoCrew Member

    Joined:
    Nov 15, 2020
    Messages:
    11
    Likes Received:
    0
    So... I don't know how to skript, so I thought this is the best place to ask. I want to make a thing where you press a specific type of button (material of button) with for example a glass pane named smt. You have multiple levels of keycards (lets say 1-5) if you use a level 3 keycard on a level 3 reader, the iron door opens. If you use a lower level, it doesn't. If you use a higher level, it still opens. How do you do that?
     
  2. Best Answer:
    Post #2 by Dogloverblue, Nov 16, 2020
  3. Dogloverblue

    Dogloverblue Member

    Joined:
    Sep 24, 2020
    Messages:
    14
    Likes Received:
    2
    if someone has a proper keycard level, you could make it so Redstone blocks would appear, then disappear, but it is totally up to you, hope this helps
    --- Double Post Merged, Nov 16, 2020, Original Post Date: Nov 16, 2020 ---
    Wait sorry, i forgot about colors, and how to give the keycard to a player Use this code instead, it has updated colors, and other stuff
    Code (Text):
    1. on rightclick on oak button:
    2.   if player's tool is glass pane with name "&aLevel &e1 &aAccess Card" with lore "&eAccess to level &61 &edoors":
    3.     #Do something here, it could be placing a redstone block, then removing it, or doing something else, whatever you choose
    4.   if player's tool is glass pane with name "&aLevel &e2 &aAccess Card" with lore "&eAccess to level &62 &edoors":
    5.     #Do whatever you want
    6.   if player's tool is glass pane with name "&aLevel &e3 &aAccess Card" with lore "&eAccess to level &63 &edoors":
    7.     #Do whatever you want
    8.   if player's tool is glass pane with name "&aLevel &e4 &aAccess Card" with lore "&eAccess to level &64 &edoors":
    9.     #Do whatever you want
    10.   if player's tool is glass pane with name "&aLevel &e5 &aAccess Card" with lore "&eAccess to level &65 &edoors":
    11.     #Do whatever you want
    12.  
    13. command /givekeycard <number>:
    14.   permission: {keycards.admin}  #I have no fricking clue how to use permissions, if i did this wrong, please remove it
    15.   Usage: /givekeycard <keycard number>
    16.   trigger:
    17.     if arg-1 is 1 or 2 or 3 or 4 or 5:
    18.       give player glass pane with name "&aLevel &e%arg-1% &aAccess Card" with lore "&eAccess to level &6%arg-1% &edoors"
    19.     else:
    20.       send "&cThats not a valid keycard number! The valid numbers are &41&c, &42,&c, &43&c, &44&c, &45&c!"
    And I'm in school rn, so I haven't had a chance to test in-game, but the parser yields no errors
     
    • Agree Agree x 2
    • Useful Useful x 1
  4. TheMangoCrew

    TheMangoCrew Member

    Joined:
    Nov 15, 2020
    Messages:
    11
    Likes Received:
    0
  5. BlackHawk185

    BlackHawk185 Member

    Joined:
    Nov 16, 2020
    Messages:
    3
    Likes Received:
    0
    Sure, I can do that
    --- Double Post Merged, Nov 17, 2020, Original Post Date: Nov 17, 2020 ---


    Code (Text):
    1.  
    2. variables:
    3.     {p} = "<&6LoKS&f>"
    4.  
    5. on right click on stone button:
    6.     set {tempLock} to (location of event-block)
    7.     player is holding stick named "Wand":
    8.         send "%{p}% &bUse &6/lock &b<&61&b-&65&b> to create a lock."
    9.         lokCheck({tempLock})
    10.         {loks::%{sec}%::%{tempLock}%} is set:
    11.             set {n} to name of player's tool parsed as integer
    12.             if player's tool is white stained glass pane:
    13.                 if name of player's tool is set:
    14.                     if {loks::%{sec}%::%{tempLock}%} > {n}:
    15.                         cancel event
    16.                 else:
    17.                     cancel event
    18.             else:
    19.                 cancel event
    20.  
    21. function lokCheck(tempLock: location):
    22.     loop 5 times:
    23.         if {loks::%loop-number%::%{tempLock}%} is set:
    24.             set {sec} to loop-number
    25.  
    26. on break of stone button:
    27.     set {tempLock} to (location of event-block)
    28.     lokCheck({tempLock})
    29.     if {loks::%{sec}%::%{tempLock}%} is set:
    30.         delete {loks::%{sec}%::%{tempLock}%}
    31.         send "%{p}% &bLock deleted."
    32.  
    33.  
    34.  
    35. command /key [<string=1>] [<player=%player%>]:
    36.     # permission: loks.use.%arg-1%
    37.     trigger:
    38.         if arg-1 = "Wand":
    39.             give player a stick named "Wand"
    40.         else:
    41.             give arg-2 white stained glass pane named arg-1
    42.  
    43.  
    44. command /lock [<integer>]:
    45.     trigger:
    46.         if arg-1 is not set:
    47.             send "%{p}% &bPlease specify a number between &61 &band &65."
    48.         else if arg-1 > 6:
    49.             send "%{p}% &bPlease use a number between &61 &band &65&b."
    50.         else:
    51.             if {tempLock} is set:
    52.             set {loks::%arg-1%::%{tempLock}%} to arg-1
    53.             send "%{p}% &bLevel &6%arg-1% &bLock created!"
    54.         else:
    55.             send "%{p}% &bYou need to select a button first!"
    56.  
    Editted like 5 times because it wouldn't put my indents in for some reason
    --- Double Post Merged, Nov 17, 2020 ---
    I'll post a how-to tomorrow
     
    • Winner Winner x 1
  6. Dogloverblue

    Dogloverblue Member

    Joined:
    Sep 24, 2020
    Messages:
    14
    Likes Received:
    2
    Wow Blackhawk, your code is probably ALOT better than mine lol
     
    • Friendly Friendly x 3
  7. BlackHawk185

    BlackHawk185 Member

    Joined:
    Nov 16, 2020
    Messages:
    3
    Likes Received:
    0

Share This Page

Loading...