Sell skript

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

    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.
Jun 30, 2022
17
1
3
Republic of Korea
code_language.skript:
command /sell:
    trigger:
        if player have diamond:
            set {_i} to 0
            set {_e} to 0
            loop all items in the inventory of player:
                if loop-item is diamond:
                    if loop-item's name is not set:
                        set {_c} to item amount of loop-item
                        add {_c} to {_i}
                        remove loop-item from player's inventory
                        add 30 to {_e}
            if {_i} is 0:
                send "you have no diamonds with no custom name."
                stop
            send "you have %{_i}% diamonds with no custom name."
            send "you earned &6%{_e}% &fcoins."
            add {_e} to {coins.%uuid of player%}
        else:
            send "you have no diamonds with no custom name."
In this skript, it checks diamonds with no custom name, delete it, and give me coins.
if i execute /sell with only having diamonds with custom name, it says "you have no diamonds with no custom name." and do nothing.(working fine)
and if i execute /sell with only having diamonds without custom name, it says works fine.
but, if i run /sell with diamonds with custom name AND diamonds without custom name, it delete only 1 stack of any diamonds in faster slot.
ex) if i have diamond with custom name at slot 2, 4, and i have diamond without custom name at slot 12, it deletes only diamond at slot 2.

I want to make to delete only diamonds without custom name.
Thank you for reading long article..
 
Double-check that name of loop-item isn't actually an empty string. Try holding a diamond and doing something like this:
Code:
command /test:
  trigger:
    if name of tool of player is "":
      message "name is empty"
    if name of tool of player is not set:
      message "name is not set"
 
Status
Not open for further replies.