Using an item only not working!

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

Kakaze

Member
Aug 17, 2018
4
1
0
34
So I am making an Harvester Hoe Skript and I would like to know why players can use their bare hand to get the sugar cane to their inventory directly even if I made specific on the skript that they could only do that with the Hoe!

Code:
on break of sugar cane:
    if player has permission "enchadasnit.vip":
        if player is holding a diamond hoe named "&3&lEnchada do Ceifeiro" with lore "&f&lCANA DE AÇUCAR ... MUITA CANA DE AÇUCAR":
            set {_nitenchadasvip} to a random integer between 3 and 6
            add {_nitenchadasvip} of sugar cane to player's inventory
            set block to air
        if block above event-block is sugar cane:
        if player is holding a diamond hoe named "&3&lEnchada do Ceifeiro" with lore "&f&lCANA DE AÇUCAR ... MUITA CANA DE AÇUCAR":
            set block above to air
            cancel event
        
    else:     
        if player is holding a diamond hoe named "&3&lEnchada do Ceifeiro" with lore "&f&lCANA DE AÇUCAR ... MUITA CANA DE AÇUCAR":
            set {_nitenchadasnormais} to a random integer between 2 and 5
            add {_nitenchadasnormais} of sugar cane to player's inventory
            set block to air
        if block above event-block is sugar cane:
        if player is holding a diamond hoe named "&3&lEnchada do Ceifeiro" with lore "&f&lCANA DE AÇUCAR ... MUITA CANA DE AÇUCAR":
            set block above to air
            cancel event

command /edcad <text> [<player>]:
    permission: enchadasnit.admin
    permission message: &cNop!
    trigger:
        if arg 1 is not set:
            if arg 2 is not set:
                send "&cErrrrrroouuuuuuu"
        if arg 1 is "dar":
            if arg 2 is not online:
                send "Não está online caralho!."
            if arg 2 is online:
                add 1 diamond hoe named "&3&lEnchada do Ceifeiro" with lore "&f&lCANA DE AÇUCAR ... MUITA CANA DE AÇUCAR" to player's inventory
                send "&fDeste uma enchada ao jogador &3%arg-2%&f."
 
Last edited:
code_language.skript:
on break of sugar cane holding diamond hoe:
   event-player's tool's name = "&3&lEnchada do Ceifeiro"
 
   # rest of your code

the second line is a condition that will cancel the rest of the code if the player does not hold your custom item
 
Status
Not open for further replies.