OnPlayerDamage: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "{{Warning|This feature is currently doesn't work in the current branch of Rage Multiplayer.}} This event is triggered when a player's health or armor changes. {{CSharpContai...")
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Warning|This feature is currently doesn't work in the current branch of Rage Multiplayer.}}
{{Warning|This feature is currently doesn't work in the current branch of RAGE:Multiplayer.}}


This event is triggered when a player's health or armor changes.
This event is triggered when a player's health or armor changes.
Line 10: Line 10:


{{Parameters}}
{{Parameters}}
*'''player:''' parameter input should be in '''Client''' type
*'''player:''' parameter input should be in '''Player''' type
*'''health:''' parameter input should be in '''float''' type
*'''health:''' parameter input should be in '''float''' type
*'''armor:''' parameter input should be in '''float''' type
*'''armor:''' parameter input should be in '''float''' type
Line 17: Line 17:
{{#tag:syntaxhighlight|
{{#tag:syntaxhighlight|
[ServerEvent(Event.PlayerDamage)]
[ServerEvent(Event.PlayerDamage)]
public void OnPlayerDamage(Client player, float healthLoss, float armorLoss)
public void OnPlayerDamage(Player player, float healthLoss, float armorLoss)
{
{
player.SendChatMessage($"You have lost {healthLoss} health and {armorLoss} armor.");
player.SendChatMessage($"You have lost {healthLoss} health and {armorLoss} armor.");

Latest revision as of 05:47, 9 May 2023

This feature is currently doesn't work in the current branch of RAGE:Multiplayer.

This event is triggered when a player's health or armor changes.


C# Syntax

[ServerEvent(Event.PlayerDamage)]

Parameters

  • player: parameter input should be in Player type
  • health: parameter input should be in float type
  • armor: parameter input should be in float type

Example

[ServerEvent(Event.PlayerDamage)]
public void OnPlayerDamage(Player player, float healthLoss, float armorLoss)
{
	player.SendChatMessage($"You have lost {healthLoss} health and {armorLoss} armor.");
}