Solved Problem trying to lock inventory item

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

JustAChillDude

New Member
Apr 5, 2019
6
0
0
20
Hi I would like to lock my first slot in my inventory so people can't move the item in there. I have tried this:
Code:
on inventory click:
    if item is iron axe:
        message "&4You can't change position of this item!"
        cancel event

I didn't work out. Thanks for your time.
 
Mmm, is same:?
code_language.skript:
event-item
and
item
Try "event-click" or "clicked slot"
 
I don't now about this will work:
sorry for bad english
Code:
options:
    slot: 0 #slot number where the axe is
    name: &cAxe #Name of the axe

on inventory click:
    wait 1 tick
    if slot {@slot} of player isn't iron axe:
        message "&4You can't change position of this item!"
        clear player's inventory
        set slot {@slot} of player to iron axe named {@name}
 
Last edited:
I don't now about this will work:
sorry for bad english
Code:
options:
    slot: 0 #slot number where the axe is
    name: &cAxe #Name of the axe

on inventory click:
    wait 1 tick
    if slot {slot} of player isn't iron axe:
        message "&4You can't change position of this item!"
        clear player's inventory
        set slot {slot} of player to iron axe named {name}
You missed adding the "@" in the "{}", second. And there you just added options.
 
Mmm, is same:?
code_language.skript:
event-item
and
item
Try "event-click" or "clicked slot"

It would accept it if I said event-item however it didn't work. And it would give me an error when i said clicked slot.
[doublepost=1554552257,1554552197][/doublepost]
You missed adding the "@" in the "{}", second. And there you just added options.

Sorry it didn't work. it would compile put i could still move my axe.
 
There you go.
Code:
on inventory click:
    if clicked inventory is player's inventory:
        if clicked slot is 0:
            cancel event
            send "&cYou can't change the item in this slot!" to player
 
There you go.
Code:
on inventory click:
    if clicked inventory is player's inventory:
        if clicked slot is 0:
            cancel event
            send "&cYou can't change the item in this slot!" to player
Hi, This gives me an error saying "Inventory is not an item type" Thanks for your help.
 
You need SkStuff for this.
I have tried to install the SkStuff plugin but it dosen't seem to work.
[doublepost=1554656701,1554585457][/doublepost]To everyone I found this solution:
Code:
on inventory click:
    name of clicked item is "&6Name Of item"
    message "Cannot change item position"
    cancel event
 
Status
Not open for further replies.