PlayerLeaveVehicle: Difference between revisions

From RAGE Multiplayer Wiki
m (Fixed typo)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Triggers when the player exits the vehicle
Triggers when the player exits the vehicle.
{{ServersideCsJsEvent}}
 
{{JSContainer|
{{Example}}
To do
}}
{{ClientsideCsJsEvent}}
{{ClientsideCsJsEvent}}
{{CSharpContainer|
{{CSharpContainer|
<syntaxhighlight lang="c#">
<syntaxhighlight lang="csharp">
public delegate void OnPlayerLeaveVehicleDelegate();
public delegate void OnPlayerLeaveVehicleDelegate();
</syntaxhighlight>
</syntaxhighlight>
{{Parameters}}
{{Parameters}}
* This event has no parameters
''This event has no parameters''


{{Example}}
{{Example}}
The example below send a chat message to the player when they exit a vehicle.
The example below send a chat message to the player when they exit a vehicle.


<syntaxhighlight lang="c#">
<syntaxhighlight lang="csharp">
Events.OnPlayerLeaveVehicle += OnPlayerLeaveVehicle();
Events.OnPlayerLeaveVehicle += OnPlayerLeaveVehicle;
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang="c#">
<syntaxhighlight lang="csharp">
public void OnPlayerLeaveVehicle()
public void OnPlayerLeaveVehicle(RAGE.Elements.Vehicle vehicle, int seat)
{
{
     RAGE.Chat.Output("You exited a vehicle");
     RAGE.Chat.Output("You exited a vehicle");
Line 28: Line 25:


{{JSContainer|
{{JSContainer|
=== Parameters ===
*'''vehicle''': {{RageType|Object}}
*'''seat''': {{RageType|Int}}
{{Example}}
{{Example}}
This example outputs chat message, when player start leave from the car.
This example outputs a chat message when the player start's to leave from the car and their seat ID.
{{ClientsideCode|
<pre>
<pre>
mp.events.add("playerLeaveVehicle", () => {
mp.events.add("playerLeaveVehicle", (vehicle, seat) => {
     mp.gui.chat.push("Player start leave the vehicle");
     mp.gui.chat.push(`You are now leaving the vehicle from seat ${seat}`);
})
})
</pre>
</pre>
}}
}}
}}
==See Also==
==See Also==
{{Player_events}}
{{Player_events}}
[[Category:Player]]
[[Category:Vehicle]]
[[Category:Client-side Event]]

Latest revision as of 12:25, 27 July 2020

Triggers when the player exits the vehicle.

Client-Side Event

 C#  JavaScript



C# Syntax

public delegate void OnPlayerLeaveVehicleDelegate();

Parameters

This event has no parameters

Example

The example below send a chat message to the player when they exit a vehicle.

Events.OnPlayerLeaveVehicle += OnPlayerLeaveVehicle;
public void OnPlayerLeaveVehicle(RAGE.Elements.Vehicle vehicle, int seat)
{
    RAGE.Chat.Output("You exited a vehicle");
}


JavaScript Syntax

Parameters

  • vehicle: Object
  • seat: Int

Example

This example outputs a chat message when the player start's to leave from the car and their seat ID.

Client-Side
mp.events.add("playerLeaveVehicle", (vehicle, seat) => {
    mp.gui.chat.push(`You are now leaving the vehicle from seat ${seat}`);
})


See Also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint