PlayerResurrect: Difference between revisions

From RAGE Multiplayer Wiki
m (Fixed a capitalization error in the Javascript example.)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{ClientSide}}
This event is called everytime a player resurrects.


This event is called everytime a player resurrects.
{{ClientsideCsJsEvent}}
 
{{CSharpContainer|
<syntaxhighlight lang="csharp">
public delegate void OnPlayerResurrectDelegate();
</syntaxhighlight>
{{Parameters}}
''This event has no parameters''
 
{{Example}}
The example below shows a chat message to the client when they respawn.


== Syntax ==
<syntaxhighlight lang="csharp">
Events.OnPlayerResurrect += OnPlayerResurrect;
</syntaxhighlight>
<syntaxhighlight lang="csharp">
public void OnPlayerResurrect()
{
    RAGE.Chat.Output($"YOU'RE ALIVE!?");
}
</syntaxhighlight>
}}


{{JSContainer|
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.events.add('playerResurrect', () => {});
mp.events.add('playerResurrect', () => {});
</syntaxhighlight>
</syntaxhighlight>


=== Parameters ===
{{Parameters}}
* '''None''', this event has no params.
''This event has no parameters''
 
== Examples ==


{{Example}}
The example below shows up a message for a player when he resurrects.
The example below shows up a message for a player when he resurrects.


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.events.add('playerResurrect', () => {
mp.events.add('playerResurrect', () => {
     mp.gui.chat.push('Like a fenix raised from the ashes, you came back to us!');
     mp.gui.chat.push('Like a phoenix raised from the ashes, you came back to us!');
});
});
</syntaxhighlight>
</syntaxhighlight>
}}
== See also ==
* [[playerSpawn]]
[[Category:Player]]
[[Category:Client-side Event]]

Latest revision as of 05:54, 22 August 2024

This event is called everytime a player resurrects.

Client-Side Event

 C#  JavaScript



C# Syntax

public delegate void OnPlayerResurrectDelegate();

Parameters

This event has no parameters

Example

The example below shows a chat message to the client when they respawn.

Events.OnPlayerResurrect += OnPlayerResurrect;
public void OnPlayerResurrect()
{
    RAGE.Chat.Output($"YOU'RE ALIVE!?");
}


JavaScript Syntax

mp.events.add('playerResurrect', () => {});

Parameters

This event has no parameters

Example

The example below shows up a message for a player when he resurrects.

mp.events.add('playerResurrect', () => {
    mp.gui.chat.push('Like a phoenix raised from the ashes, you came back to us!');
});


See also