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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting the last attacker

Discussion in 'Requests' started by dudle, Nov 19, 2017.

  1. dudle

    dudle Active Member

    Joined:
    Jan 31, 2017
    Messages:
    135
    Likes Received:
    0
    Category: PvP

    Suggested name: LastAttacker (or whatever you prefer, I don't mind any)

    What I want: I want a short script that when a player dies because of anything, it would send the last attacker of the player (if it's set) a message like "You killed %victim's display name%" and it will send a message to the victim saying that they have been killed by that last attacker's display name and their hearts remaining. If the last attacker isn't set, it will just act as victim committed suicide. I tried to do this but couldn't manage to, so if someone can make this for me I'll appreciate it!

    Ideas for commands: none

    Ideas for permissions: none

    When I'd like it by: Monday the 20th or Tuesday 21st, please.
     
  2. Snow-Pyon

    Snow-Pyon Well-Known Member

    Joined:
    Jan 25, 2017
    Messages:
    1,235
    Likes Received:
    176
    Medals:
    There you go:

    Code (Skript):
    1. on death of player:
    2.  
    3.   attacker is a player
    4.   send "<yellow>You have been killed by %attacker's display name% <light gray>(<light green>%attacker's health%<light red>❤<light gray>)<reset>." to victim
    5.   send "<yellow>You've killed %vitim's display name%<reset>." to attacker
    6.  
     
  3. dudle

    dudle Active Member

    Joined:
    Jan 31, 2017
    Messages:
    135
    Likes Received:
    0
    i also made this but it won’t work. look what i want is so that for example if i die because of burning in lava, and i’ve been hit by someone before this death event happened, it would get that player that hit me and just send them the msg saying that they have killed me (even tho there weren’t the ones that made me die) if they’re on. does this make sense kinda??
     
  4. Epicskymi

    Epicskymi Active Member

    Joined:
    Feb 14, 2017
    Messages:
    71
    Likes Received:
    11
    use a variable
     
  5. dudle

    dudle Active Member

    Joined:
    Jan 31, 2017
    Messages:
    135
    Likes Received:
    0
    Can someone make it for me please? I don't know how to properly use the variables in this case and that's why i posted this in the request section
     
  6. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,336
    Likes Received:
    177
    Medals:
    im pretty sure tuske has a %last attacker% expression
     
  7. Snow-Pyon

    Snow-Pyon Well-Known Member

    Joined:
    Jan 25, 2017
    Messages:
    1,235
    Likes Received:
    176
    Medals:
    Code (Skript):
    1. on death of player:
    2.  
    3.   if {last-attacker::%victim%} is set:
    4.     send "<yellow>You have been killed by %{last-attacker::%victim%}'s display name% <light gray>(<light green>%{last-attacker::%victim%}'s health%<light red>❤<light gray>)<reset>." to victim
    5.     send "<yellow>You've killed %vitim's display name%<reset>." to {last-attacker::%victim%}
    6.  
    7. on damage of player:
    8.  
    9.   if attacker is a player:
    10.  
    11.     set {last-attacker::%victim%} to attacker
    12.     wait 3 seconds
    13.     clear {last-attacker::%victim%}
    14.  
    15.  
     
    #7 Snow-Pyon, Nov 20, 2017
    Last edited: Nov 20, 2017
  8. dudle

    dudle Active Member

    Joined:
    Jan 31, 2017
    Messages:
    135
    Likes Received:
    0
    Well there's %last damage cause% and %last entity damage of player% from TuSKe, but it says that it can't understand that expression for some reason, even though i've got the plugin installed

    the display name of the attacker says <none>
     
  9. Snow-Pyon

    Snow-Pyon Well-Known Member

    Joined:
    Jan 25, 2017
    Messages:
    1,235
    Likes Received:
    176
    Medals:
    Whoops, missed that part. Fixed.
     
  10. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    244
    Likes Received:
    22
    I use metadata for setting the last attacker but if you log off the metadata gets deleted sooo
     

Share This Page

Loading...