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

Solved On kill with bow?

Discussion in 'Skript' started by Nexurant, Nov 13, 2019.

  1. Nexurant

    Nexurant Member

    Joined:
    Jun 12, 2019
    Messages:
    3
    Likes Received:
    0
    Hey, I've been looking for a while and I am unable to find an answer. I'm working on a missions skript, and one of the missions is to get a kill with a bow. How would I make it so that on death it checks if the player used a bow to kill them? I've given a code which doesn't work but roughly shows what I would like it to do. Also, players can kill themselves and it counts towards it. How can I fix that too?

    Code (Text):
    1. on death:
    2.     victim is a player
    3.     damager is a player
    4.     if the damager's weapon is a bow:
    5.         add 1 to {bowkills.%damager%}
    6.         message "&dMissions &8| &7+1 Archer Kill" to the damager
    7.     else:
    8.         message "&dMissions &8| &7You didn't use a bow!" to the damager
    Thank you :emoji_slight_smile:
     
  2. Best Answer:
    Post #2 by AsuDev, Nov 13, 2019
  3. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    Code (Skript):
    1. on death:
    2.     victim is a player
    3.     attacker is a player
    4.     attacker is not victim
    5.     if "%damage cause%" is "projectile":
    6.         add 1 to {bowkills.%attacker%}
    7.         message "&dMissions &8| &7+1 Archer Kill" to attacker
    8.     else:
    9.         message "&dMissions &8| &7You didn't use a bow!" to attacker
     
    #2 AsuDev, Nov 13, 2019
    Last edited: Nov 13, 2019
  4. Nexurant

    Nexurant Member

    Joined:
    Jun 12, 2019
    Messages:
    3
    Likes Received:
    0
    Reloads with no errors, but when I kill someone with a bow, it displays the "You didn't use a bow" message.
     
  5. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    change to:
    Code (Skript):
    1. if "%damage cause%" is "projectile"
     
  6. Nexurant

    Nexurant Member

    Joined:
    Jun 12, 2019
    Messages:
    3
    Likes Received:
    0
    Worked, thank you :emoji_slight_smile:
     
  7. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    You can add
    Code (Skript):
    1. attacker is not victim
    to prevent it from running when they kill themself.
     
    • Like Like x 1
Loading...