playerDied
Tells your gamemode when a player dies.
Renamed in 0.28 from death; see renamed names.
Signature
Section titled “Signature”server.on("playerDied", ({ player, position, killer, weapon }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerSnapshot |
The player. |
position |
Vector3 |
Where they died. |
killer |
PlayerSnapshot | null |
The player whose game reported the last hit on this one within 5 seconds, or null without one. |
weapon |
number | null |
That hit’s weapon type, or null. |
Example
Section titled “Example”A kill feed.
import { chat, server } from "nativemp";
server.on("playerDied", ({ player, killer }) => { chat.sendServerMessage(killer ? `${killer.name} killed ${player.name}.` : `${player.name} is wasted.`);});Related
Section titled “Related”playerSpawnRequest: decide the respawnplayerHitEntity: each hit as it is reportedplayerHealthOrArmourDecreased: health going downplayers.setSurvivalPolicy: keep a player from dying