1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check if item has name

Discussion in 'Skript' started by Nikox, Jan 8, 2020.

Tags:
Thread Status:
Not open for further replies.
  1. Nikox

    Nikox Member

    Joined:
    Jul 14, 2017
    Messages:
    4
    Likes Received:
    1
    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 (Text):
    1. command /gold:
    2.     trigger:
    3.         if player has 9 gold ingot:
    4.             remove 9 gold ingot from player's inventory
    5.             give player 1 gold block named "&6&lGold"
    If someone would have 9 gold ingot with custom name, it would not remove it.
     
  2. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    Just put a 'named "some name here"' after the item
    Code (Text):
    1. command /gold:
    2.     trigger:
    3.         if player has 9 gold ingot named "&6Gold Ingot":
    4.             remove 9 gold ingot named "&6Gold Ingot" from player's inventory
    5.             give player 1 gold block named "&6&lGold"
     
  3. Nikox

    Nikox Member

    Joined:
    Jul 14, 2017
    Messages:
    4
    Likes Received:
    1
    That's not the case. Gold is currency on my server. You can also put it to the bank, that's the code:
    Code (Text):
    1.             set {_wplata} to arg 1 parsed as integer
    2.             if {_wplata} is integer:
    3.                 if {_wplata} is greater than 0:
    4.                     if player has {_wplata} of gold ingot:
    5.                         remove {_wplata} of gold ingot from player
    6.                         add {_wplata} to player's balance
    7.                         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.
     
  4. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    You can try doing:
    Code (Text):
    1. if player has 9 gold ingot named "Gold Ingot"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...