Solved Set inventory slot for specific item only?

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Zyxed

Supporter
May 17, 2021
23
1
3
27
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?
 
Thanks for the answers! I got it working like this (I think it could be better, but it's fine for me)


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