Getting last attacker if death wasn't caused by a player?

  • 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 community!

    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.

dudle

Active Member
Jan 31, 2017
135
0
16
Hello,

So what I want to make is like if, for example, I am pvping against a player, and they hit me, and then I die because of another cause (for example, I burned in lava), it would give +1 kill to the last attacker, because skript doesn't have this thing and I don't know how to set it, so that if I died because I burned in lava, and nobody before has hit me, then it wouldn't give a kill to anybody, but if someone did, it'd give them a +1 kill to their stats. And it should also "reset" the last hitter in case someone else hits me, or when I die and then respawn.
I'm not sure if I need to use additional addons for this or not. Could you help me with this, please?

Thanks
 
I'm not going to tell you how to do it but there is a way to do it if you use damage cause and an on death event. This is a request because you have no starting code.
 
You can't really check the first attacker. Skript will only say the attacker that killed you on death event. So in this case you have to make a custom skript checking who dealt the most damage, using variables and such. Not hard to make.
 
I have this exact thing on my server. I use metadata values to determine the last attacker (only sets if the damage source is from a player) as well as metadata to determine when the attack took place. If the attack took place under 15 seconds ago, it gives points to the attacker.
 
Status
Not open for further replies.