Solved How do I make an assist system?

  • 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 our Wiki for downloads and any other information about Skript!

Status
Not open for further replies.

Nightomatic

New Member
May 24, 2021
5
0
1
23
Does anyone know how to detect if a player assisted in killing someone? Like for example, if a player is on fire, and one of the other players decides to hit him, but then after that, he dies a few seconds later, is there a way to detect that the player hit him a few seconds ago?
 
you could try somehting like this:
add the attacker to a list per player, and clear the list when they are at full health.
this will however remember an assist even if it happened minutes ago but the player never went back to full health.
of you could ad an actual timer and remove it after a specified amount of time.

no idea if this code works as it is, might need some tweaking*
Code:
On damage of a player:
    if attacker is a player:
        add attacker's name to {assist::%attacked%::*}
            
on heal:
    if event-entity is a player:
        if event-entity's health is max health of event-entity:
            clear {assist::%event-entity%::*}
        
on death of a player:
    message "%event-player% was killed by %event-player's last attacker%. assisted by: %{assist::%event-entity%::*}%"
    clear {assist::%event-entity%::*}
also note that the killer might be mentioned twice with this specific code. so do a rewrite.
 
Okay, ill try. Thanks in advance!
[doublepost=1621886341,1621885750][/doublepost]
you could try somehting like this:
add the attacker to a list per player, and clear the list when they are at full health.
this will however remember an assist even if it happened minutes ago but the player never went back to full health.
of you could ad an actual timer and remove it after a specified amount of time.

no idea if this code works as it is, might need some tweaking*
Code:
On damage of a player:
    if attacker is a player:
        add attacker's name to {assist::%attacked%::*}
           
on heal:
    if event-entity is a player:
        if event-entity's health is max health of event-entity:
            clear {assist::%event-entity%::*}
       
on death of a player:
    message "%event-player% was killed by %event-player's last attacker%. assisted by: %{assist::%event-entity%::*}%"
    clear {assist::%event-entity%::*}
also note that the killer might be mentioned twice with this specific code. so do a rewrite.



It didn't work, even with the tweaking.
[doublepost=1621887408][/doublepost]
Okay, ill try. Thanks in advance!
[doublepost=1621886341,1621885750][/doublepost]



It didn't work, even with the tweaking.
NVM it works now! Thank you!
 
Status
Not open for further replies.