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 Set inventory slot for specific item only?

Discussion in 'Skript' started by Zyxed, Aug 2, 2021.

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

    Supporter

    Joined:
    May 17, 2021
    Messages:
    23
    Likes Received:
    1
    Hello!
    Is it possible to set slot in player's inventory to only one item? For an example:
    Slot 9 of player's inventory is locked, and you can't put any items in it, except stone. So the slot would be locked for every other item than stone. I've been trying to figure this out for hours. Can anyone help me with this?

     
  2. Best Answer:
    Post #5 by Zyxed, Aug 2, 2021
  3. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    Inventory click event, there is a way to get the cursor item but not sure how the syntax was
     
  4. alexistb2904

    alexistb2904 New Member

    Joined:
    Jul 27, 2021
    Messages:
    8
    Likes Received:
    1
    Code (Text):
    1. on inventory click:
    2.     if name of event-inventory is "test":
    3.         if index of event-slot = 0:
     
  5. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    not what he wanted^^
     
  6. Zyxed

    Supporter

    Joined:
    May 17, 2021
    Messages:
    23
    Likes Received:
    1
    Thanks for the answers! I got it working like this (I think it could be better, but it's fine for me)


    Code (Text):
    1. on inventory click:
    2.     if event-inventory = Player's inventory:
    3.         if event-slot = 9:
    4.             #Nopeuden sormus
    5.             if player's cursor slot is not saddle or air: #Antaa asettaa slot 9 vain satulalle, ja ottaa sen pois.
    6.                 cancel event
    7.             if event-slot is saddle named "&aNopeuden sormus" with lore "&7Nostaa pelaajan nopeutta 20%%": #Poistaa efektin
    8.                 remove speed from the player
    9.             if player's cursor slot is saddle named "&aNopeuden sormus" with lore "&7Nostaa pelaajan nopeutta 20%%":
    10.                 apply potion of Swiftness to player for 10000000 seconds #antaa efektin
     
Thread Status:
Not open for further replies.

Share This Page

Loading...