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.

Solved Tracking kills

Discussion in 'Skript' started by Amaroa, Sep 30, 2021.

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

    Amaroa Member

    Joined:
    Sep 30, 2021
    Messages:
    2
    Likes Received:
    0
    variables:
    {playerskilled} = 0

    on kill
    add 1 to {playerskilled}

    command /stats:
    trigger:
    message "&7Kills: %{playerskilled}%"

    New to skript, familiar with other languages but i cant seem to get this to work? Im doing something wrong if someone could help.
    --- Double Post Merged, Sep 30, 2021, Original Post Date: Sep 30, 2021 ---
    I just realised on kill isnt a real event, does anybody know the event for kills?
    --- Double Post Merged, Sep 30, 2021 ---
    Fixed it.
     
  2. Best Answer:
    Post #2 by oToghty, Oct 1, 2021
  3. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    142
    Likes Received:
    5
    First, the event is called on death, 2nd, you need to make your variable player based such as {playerkills::%attacker's uuid%}
    In death or damage events, you only use attacker and victim, there is no player in that event. 3. You need to specify that the attacker is a player so that you won't create useless variables for random mobs and also specify that the victim is a player so it only counts player kills, if you don't want it to only count player kills, change the `on death of player` to `on death`. And lastly, you need a default value so that if the variable is not set, it'll still show 0 rather than <none>

    Code (Text):
    1. on death of player:
    2.     if attacker is a player:
    3.         add 1 to {playerkills::%attacker's uuid%}
    4.  
    5. command /kills:
    6.     trigger:
    7.         send "&aPlayer kills: &e%{playerkills::%player's uuid%} ? 0%"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...