Solved Mob Heads into Tokens

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

Tropical

Member
Jan 29, 2017
19
0
1
29
code_language.skript:
command /transfer:
    trigger:
        if player is holding 20 mob heads:
            remove 20 mob head from player's inventory
            send "&c&lTRANSFER &7You transferred 20 heads into 2 tokens!"
            make console execute command "/te add %player% 2"
        else:
            send "&c&lTRANSFER &7You are not holding Mob Heads!"

Category: Misc.

Suggested name: Doesn't Matter

What I want:
So, my aim is to allow players to transfer Mob Heads into tokens. My code above works, but even if the player is holding one mob head, it still does all the statements. It's not actually checking the item amount, which it should.

All I need is /transfer to remove 20 mob heads from the player's inventory, and in return, add 2 tokens to the player via Console (TokenEnchant).

Now, if you are feeling nice, I really want a GUI, where player's drag and drop the heads, but don't know if that's possible with Skript, so if not, it's totally fine.


Ideas for commands:
/transfer

Ideas for permissions:
None

When I'd like it by: A reasonable time
 
Here is the working version. In your condition "if player is holding 20 mob heads" it totally ignores the amount. So I added a condition that checks if the player has 20 mob heads.

code_language.skript:
command /transfer:
    trigger:
        if player has 20 mob heads:
            if player is holding mob heads:
                remove 20 mob head from player's inventory
                send "&c&lTRANSFER &7You transferred 20 heads into 2 tokens!"
                make console execute command "/te add %player% 2"
            else:
                send "&c&lTRANSFER &7You are not holding Mob Heads!"
        else:
            message "&c&lTRANSFER &7You don't have 20 Mob Heads!"

Enjoy.