PlayerDeath: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 4: Line 4:
* '''player'''  - player, which died.
* '''player'''  - player, which died.
* '''reason ''' - cause of death player:
* '''reason ''' - cause of death player:
* '''killer'''  - he who killed the player.
* '''killer'''  - who killed the player.


==Example==
==Example==
Line 14: Line 14:
   const deathName = player.name
   const deathName = player.name
   const killerName = killer.name
   const killerName = killer.name
   const srt = killerName + " killed: " + deathName + " Reason: " + reason
   const str = killerName + " killed: " + deathName + " Reason: " + reason
   mp.players.broadcast(str)
   mp.players.broadcast(str)
}
}

Revision as of 19:46, 15 October 2017

This event is triggered when a player dies.

Parameters

  • player - player, which died.
  • reason - cause of death player:
  • killer - who killed the player.

Example

This example outputs chat message, when player dies.

Server-Side
function playerDeathHandler(player, reason, killer) {
   const deathName = player.name
   const killerName = killer.name
   const str = killerName + " killed: " + deathName + " Reason: " + reason
   mp.players.broadcast(str)
}

mp.events.add("playerDeath", playerDeathHandler);

See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint