PlayerExitColshape: Difference between revisions

From RAGE Multiplayer Wiki
m (Replaced HTML with template)
No edit summary
Line 1: Line 1:
This event is triggered when a player exits a colshape.
This event is triggered when a player exits a colshape.


==Parameters==
{{ServersideCsJsEvent}}
 
{{JSContainer|
{{Parameters}}
* '''player''' - player which exited the colshape
* '''player''' - player which exited the colshape
* '''shape''' - the colshape the player left
* '''shape''' - the colshape the player left


==Example==
{{Example}}
{{ServersideCode|
<pre>
<pre>
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);
Line 20: Line 22:
}}
}}


{{ClientsideCsJsEvent}}
{{CSharpContainer|
<syntaxhighlight lang="c#">
public delegate void OnPlayerExitColshapeDelegate(Colshape colshape, CancelEventArgs cancel);
</syntaxhighlight>
{{Parameters}}
* '''colshape''': colshape, expects '''RAGE.Elements.Colshape''' type.
* '''cancel''': cancel, expects '''RAGE.Events.CancelEventArgs''' type.


{{ClientsideCode|
{{Example}}
<syntaxhighlight lang="c#">
Events.OnPlayerExitColshape += OnPlayerExitColshape;
</syntaxhighlight>
<syntaxhighlight lang="c#">
public void OnPlayerExitColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel)
{
    RAGE.Chat.Output($"You exited colshape id:{colshape.Id}");
}
</syntaxhighlight>
}}
{{JSContainer|
<pre>
<pre>
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);

Revision as of 14:46, 28 November 2018

This event is triggered when a player exits a colshape.

Server-Side
Event

 C#  JavaScript



JavaScript Syntax

Parameters

  • player - player which exited the colshape
  • shape - the colshape the player left

Example

let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);

function playerExitColshapeHandler(player, shape) {
  if(shape == someColShape) {
    console.log(`${player.name} left the colshape!`);
  }
}

mp.events.add("playerExitColshape", playerExitColshapeHandler);


Client-Side Event

 C#  JavaScript


C# Syntax

public delegate void OnPlayerExitColshapeDelegate(Colshape colshape, CancelEventArgs cancel);

Parameters

  • colshape: colshape, expects RAGE.Elements.Colshape type.
  • cancel: cancel, expects RAGE.Events.CancelEventArgs type.

Example

Events.OnPlayerExitColshape += OnPlayerExitColshape;
public void OnPlayerExitColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel)
{
    RAGE.Chat.Output($"You exited colshape id:{colshape.Id}");
}


JavaScript Syntax

let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);

function playerExitColshapeHandler(shape) {
  if(shape == someColShape) {
    //Local player left the colshape
  }
}

mp.events.add("playerExitColshape", playerExitColshapeHandler);


See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint