Remove Item without NBT

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

ZuRiKan

Member
Mar 16, 2023
4
0
1
32
Hello, I have a problem. I would like to write a buyer for items. I am almost finished, but there is one problem I can't get a handle on. Both items with and without NBT should be purchased.

Unfortunately, the function, despite being noted, does not differentiate whether the item has NBT data or not. For example: Stone is supposed to be purchased. The item has no NBT data. Nevertheless, it also accepts stones with NBT data.


Information for function: stone block, {}, 64, 40 , ZuRiLein:
YAML:
function takeitem_l_n(i:item, n:text, m:number, c:number, p:player):
    set {_item} to {_i}
    set {_cost} to {_c}
    set {_maxstack} to {_m}
    if {_item} is not air:
        if {_cost} > 0:
            if {_p} has {_maxstack} of {_item} with custom nbt from "%{_n}%":
                message "%{_item}% | %{_n}%" to {_p}
                remove {_maxstack} of {_item} with custom nbt from "%{_n}%" from {_p}'s inventory
                set {_money} to {_cost}
                bungeemoneysend({ServerName},{_p},{_money})
                
            else:
                message formatted "<white><bold>[<orange><bold>INFO<white><bold>]<reset> <light red>Du hast nicht genügend Items" to {_p}

What options do I have to prevent it from considering items with NBT data when the sought item has no NBT data?

greetings ZuRiKan
 
I'm pretty sure this is because all items have an nbt compound of what items they are and their flags. so instead I would put all the nbt you're using into a compound list tag and check for that instead.