onPlayerKilled

Name

baseevents:onPlayerKilled

Parameters

player killerID, array deathData
  • killerID: The Client ID of the player who killed the player or -1 if the player was run over by a vehicle (even if a player was driving it).
  • deathData: An array containing the following things:
    • (int) killerType: The pedType of the ped who killed the player. (see screenshot below for the possible pedType values.)
    • (hash) weaponHash: The hash of the weapon which was used to kill the player.
    • (bool) killerInVeh: A boolean indicating if the killer was in a vehicle.
    • (int) killerVehSeat: The seat number in which the killer is sitting.
    • (string) killerVehName: The display name of the vehicle the killer is in (eg: ‘Adder’).
    • (array) deathCoords: An array containing the x, y, z coordinates of where the player died.
Ped types

Examples

JavaScript Example:
on('baseevents:onPlayerKilled', (killerID, deathData) => {
   const [x, y, z] = deathData.killerpos;
   console.log('died at:', { x, y, z });
});
Last modified October 7, 2024: Fixed a few links and typos (4efa70d)