#how detect player kill another player?
1 messages · Page 1 of 1 (latest)
Weird i messaged here questions but their gone💀
Hey, could you help me make a bounty system?
I'm not much of a scripter, so I'm asking for help
what questions
idk how that will work
let me explain
I just want when the player kills a player/mob the "/say Hi" command would be executed.
Obviously, I would replace the "/say Hi" with a command to make it work
It's possible?
Very possible but you will need many events to pull this off to make sure you test for projectiles owned by a player or other stuff to test if the death of a player or mob is by a certain player and then do your code
Ohh alr
In my mind it seemed simpler lol
I mean you could just test if a player kills an entity by hitting them using an event
Basically [this](#1204086363733889085 message)
I'll try to write some code now
@nova oasis
import {world,Player} from "@minecraft/server";
world.afterEvents.entityDie.subscribe((event) => {
const {damageSource,deadEntity} = event
const damagingEntity = damageSource.damagingEntity
if((damagingEntity instanceof Player) && (deadEntity instanceof Player)){
damagingEntity.runCommandAsync('give @s apple')
}
});
Ty!! I'll try it 🙂