Check if item has name

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

Nikox

Member
Jul 14, 2017
4
1
0
Hi!
Can I check if item has name?
I have recently found out that Skript doesn't remove named items. It can be very abusable, for example:
Code:
command /gold:
    trigger:
        if player has 9 gold ingot:
            remove 9 gold ingot from player's inventory
            give player 1 gold block named "&6&lGold"
If someone would have 9 gold ingot with custom name, it would not remove it.
 
Just put a 'named "some name here"' after the item
Code:
command /gold:
    trigger:
        if player has 9 gold ingot named "&6Gold Ingot":
            remove 9 gold ingot named "&6Gold Ingot" from player's inventory
            give player 1 gold block named "&6&lGold"
 
That's not the case. Gold is currency on my server. You can also put it to the bank, that's the code:
Code:
            set {_wplata} to arg 1 parsed as integer
            if {_wplata} is integer:
                if {_wplata} is greater than 0:
                    if player has {_wplata} of gold ingot:
                        remove {_wplata} of gold ingot from player
                        add {_wplata} to player's balance
                        send "&eWpłacono %{_wplata}% &esztabek złota."
You can obtain gold from mining, from drops etc. Sure, I can do exchange to "special gold", but... Is it possible to do that in other way?
If not, well, exchange isn't that bad. Just want to use the best solution.
 
You can try doing:
Code:
if player has 9 gold ingot named "Gold Ingot"
 
Status
Not open for further replies.