Jump to content

I need help with a skript :D (PLEASE HELP!)


RatOnMars

Recommended Posts

What I need help with is making it so you cannot put a certain item in a chest (if you can make it so you cannot put amethyst shards in a chest that would be great!) (I am only using skript no other addons) 

If anyone can help it will be really appreciated 

Link to comment
Share on other sites

To prevent players from placing a certain item (such as amethyst shards) into a chest using Skript, you can utilize the on inventory click event to intercept the click and cancel it if the item matches the specified criteria. Here's an example:

on inventory click:
    if event-clicked inventory type is chest:
        if event-clicked item is amethyst shard:
            cancel event
            send "You cannot place amethyst shards in this chest!"

In the above code, whenever a player clicks on an item within a chest inventory, the Skript checks if the clicked item is an amethyst shard. If it is, the event is canceled, preventing the item from being placed in the chest, and the player is notified with a message.

You can add this Skript snippet to your existing code or incorporate it into your Skript file as needed. Remember to adjust the item and message to suit your specific requirements.

Let me know if there's anything else I can assist you with!

If I helped you at all please consider boosting my account with the follow button!
Minehut ♥ [VIP] 12/19/2020 - Present

I am either extremely active or not lol.

 

Link to comment
Share on other sites

I've been messing around with the skript and i've got to here

on inventory click:
   set {_slot} to event-slot
   set {_item} to item {_slot} of player's inventory
   if {_item} is "amethyst shard":
      cancel event
      send "You cannot place amethyst shards in this chest!"
image.png.1343eb2134abcc26ac51b75fc612440f.png

 

 

Link to comment
Share on other sites

Hola. If you want to prevent a player from placing any amount of amethyst shards in a chest, you could use this code:

on inventory click:
    if type of player's current inventory is chest inventory:
        set {_item} to type of event-item
        if {_item} = ("amethyst shard" parsed as an item):
            cancel event
            send "&cYou cannot place amethyst shards in this chest!"

The event triggers when someone clicks an item inside their inventory. First it checks if the inventory is a chest. Then it sets the variable {_item} to the type of item. This is important, because if it is just event-item it will also return the amount the player is clicking (e.g.: 64 amethyst shards). Then, if {_item} is indeed an amethyst shard, it cancels the event and sends the player a notice.

Hope this helped!

Edited by Tistay
Grammar/Code Fix/Format

 

 

The one and only.

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...