Перейти к содержанию

OnPlayerDeath

Материал из RAGE MP Wiki Archive
Версия от 13:19, 22 мая 2023; imported>Xabi
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

This event is triggered when a player dies.


<syntaxhighlight lang="csharp"> [ServerEvent(Event.PlayerDeath)] </syntaxhighlight>

Parameters

  • player: parameter input should be in Player type
  • killer: parameter input should be in Player type
  • reason: parameter input should be in uint type

Example

<syntaxhighlight lang="csharp"> [ServerEvent(Event.PlayerDeath)] public void OnPlayerDeath(Player player, Player killer, uint reason) { if (!killer.IsNull) { NAPI.Chat.SendChatMessageToAll($"{killer.Name} has killed {player.Name} with {reason}."); } else { NAPI.Chat.SendChatMessageToAll($"{player.Name} has died ({reason})."); } } </syntaxhighlight>