Solved If amount of named 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.

Xceislor

Member
Aug 4, 2021
18
0
1
24
Code:
on inventory click:
    if event-inventory = (metadata tag "minermerchant" of player):
        cancel event
        if amount of cobblestone with name "&7Cobblestone" in player's inventory >= 10:
            broadcast "hi"


This doesnt work as any cobblestone with a normal name adds to it.
 
Last edited:
Code:
if amount of cobblestone named "Test" in player's inventory is greater than or equal to 10:
        broadcast "hi"

This works fine for me
 
Code:
on inventory click:
    if event-inventory = (metadata tag "minermerchant" of player):
        cancel event
        if amount of cobblestone with name "&7Cobblestone" in player's inventory >= 10:
            broadcast "hi"


This doesnt work as any cobblestone with a normal name adds to it.
You can use
Code:
if amount of all cobblestone in player's inventory where [name of input is ""] >= 10:
 
if amount of all cobblestone in player's inventory where [name of input is ""] >= 10:
Didn't work for me
[doublepost=1636509055,1636508509][/doublepost]Fixed it!

Code:
on inventory click:
    if event-inventory = (metadata tag "minermerchant" of player):
        cancel event
        if index of event-slot is 9:
            loop all items in player's inventory:
                if loop-item's name is "&7Cobblestone":
                    set {_c} to amount of loop-item in player's inventory
                    if {_c} >= 10:
 
Status
Not open for further replies.