Solved Keycard skript

  • 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!

TheMangoCrew

Member
Nov 15, 2020
11
0
1
27
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?
 
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
[doublepost=1605543069,1605541494][/doublepost]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:
on rightclick on oak button:
  if player's tool is glass pane with name "&aLevel &e1 &aAccess Card" with lore "&eAccess to level &61 &edoors":
    #Do something here, it could be placing a redstone block, then removing it, or doing something else, whatever you choose
  if player's tool is glass pane with name "&aLevel &e2 &aAccess Card" with lore "&eAccess to level &62 &edoors":
    #Do whatever you want
  if player's tool is glass pane with name "&aLevel &e3 &aAccess Card" with lore "&eAccess to level &63 &edoors":
    #Do whatever you want
  if player's tool is glass pane with name "&aLevel &e4 &aAccess Card" with lore "&eAccess to level &64 &edoors":
    #Do whatever you want
  if player's tool is glass pane with name "&aLevel &e5 &aAccess Card" with lore "&eAccess to level &65 &edoors":
    #Do whatever you want

command /givekeycard <number>:
  permission: {keycards.admin}  #I have no fricking clue how to use permissions, if i did this wrong, please remove it
  Usage: /givekeycard <keycard number>
  trigger:
    if arg-1 is 1 or 2 or 3 or 4 or 5:
      give player glass pane with name "&aLevel &e%arg-1% &aAccess Card" with lore "&eAccess to level &6%arg-1% &edoors"
    else:
      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
 
Sure, I can do that
[doublepost=1605586870,1605576703][/doublepost]

Code:
variables:
    {p} = "<&6LoKS&f>"

on right click on stone button:
    set {tempLock} to (location of event-block)
    player is holding stick named "Wand":
        send "%{p}% &bUse &6/lock &b<&61&b-&65&b> to create a lock."
        lokCheck({tempLock})
        {loks::%{sec}%::%{tempLock}%} is set:
            set {n} to name of player's tool parsed as integer
            if player's tool is white stained glass pane:
                if name of player's tool is set:
                    if {loks::%{sec}%::%{tempLock}%} > {n}:
                        cancel event
                else:
                    cancel event
            else:
                cancel event

function lokCheck(tempLock: location):
    loop 5 times:
        if {loks::%loop-number%::%{tempLock}%} is set:
            set {sec} to loop-number

on break of stone button:
    set {tempLock} to (location of event-block)
    lokCheck({tempLock})
    if {loks::%{sec}%::%{tempLock}%} is set:
        delete {loks::%{sec}%::%{tempLock}%}
        send "%{p}% &bLock deleted."



command /key [<string=1>] [<player=%player%>]:
    # permission: loks.use.%arg-1%
    trigger:
        if arg-1 = "Wand":
            give player a stick named "Wand"
        else:
            give arg-2 white stained glass pane named arg-1


command /lock [<integer>]:
    trigger:
        if arg-1 is not set:
            send "%{p}% &bPlease specify a number between &61 &band &65."
        else if arg-1 > 6:
            send "%{p}% &bPlease use a number between &61 &band &65&b."
        else:
            if {tempLock} is set:
            set {loks::%arg-1%::%{tempLock}%} to arg-1
            send "%{p}% &bLevel &6%arg-1% &bLock created!"
        else:
            send "%{p}% &bYou need to select a button first!"

Editted like 5 times because it wouldn't put my indents in for some reason
[doublepost=1605591731][/doublepost]I'll post a how-to tomorrow