Solved Naming Click Items

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

Cooleeo

Member
Apr 18, 2018
17
1
0
24
Hello,
I'm trying to make an item in where it is right click from the player's hotbar, and will execute a command. The only problem I have is executing the command from a named item.

Here's my skript that doesn't seem to be working:
code_language.skript:
on right click:
           if player's tool is a bow:
           if name of tool of player is "&bMagic Bow":
                      make player execute command "/magicbowspell"

Basically, i'm trying to make a player execute the command "/magicbowspell" (already predefined, works without name parameter) upon right clicking with a bow named "&bMagic Bow", and no other bows.

Thanks!
 
I ran your code AS IS... and it works perfectly fine, so not sure what your problem is?
[doublepost=1524037869,1524037479][/doublepost]Are you getting any errors?
What exactly is not working?
 
I ran your code AS IS... and it works perfectly fine, so not sure what your problem is?

Thanks. Very strange. Here's the full Skript:
code_language.skript:
# Magic Bow
command /magicbowspell:
          permission: kit.spell.magicbow
          trigger:
                    set {mb} to difference between {mb.%player%} and now
                    if {mb} is less than 2 seconds:
                              message "&c[!] &bMagic Bow &7(%difference between {mb} and 2 seconds%)"
                              stop
                    execute console command "/castp %player% arrow_light cooldown_reduction 1"
                    set {mb.%player%} to now
on right click:
           if player's tool is a bow:
           if name of tool of player is "&bMagic Bow":
                      make player execute command "/magicbowspell"
I'm using the Magic plugin to create a projectile using a "Magic Bow". It works fine when I don't have the name parameter there at all. At the moment it does not input anything into console when I right click with the named Bow in hand, so the command isn't even activating. I feel it has something to do with the name part of it.
 
Are you sure the name of the bow matches EXACTLY?
I created a line where i could rename the bow "&bMagic Bow" and it worked perfectly fine, but make sure that the name you are using in this syntax matches EXACTLY to the bow being created from your magic plugin
[doublepost=1524038240,1524038151][/doublepost]Also your tabs seem to be wrong

you have this
code_language.skript:
on right click:
           if player's tool is a bow:
           if name of tool of player is "&bMagic Bow":
                      make player execute command "/magicbowspell"
do this
code_language.skript:
on right click:
    if player's tool is a bow:
        if name of tool of player is "&bMagic Bow":
            make player execute command "/magicbowspell"
 
Alright, I've solved it lmao. I was using some crappy item renaming plugin, it must of added some tag to the item. I gave myself the bow using the /give command and it works a treat. Thanks for your help anyway ShaneBee!
 
Status
Not open for further replies.