PlayerExitColshape: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
(10 intermediate revisions by 5 users not shown)
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==
Default dimension for ColShapes is 0, and the player must be in the same dimension as the Colshape for them to collide.
* '''player''' - player which exited the colshape
* '''shape''' - the colshape the player left


==Example==
{{ServersideCsJsEvent}}
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<syntaxhighlight lang="javascript">
  let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);


  function playerExitColshapeHandler(player, shape) {
{{CSharpContainer|1=
    if(shape == someColShape) {
See [[OnPlayerExitColShape]].
      console.log(player.name + " left the colshape!");
}}
    }
 
{{JSContainer|
{{Parameters}}
* '''player''': {{RageType|Player}} - The [[:Category:Player API|player]] which exited the colshape
* '''shape''': {{RageType|ColShape}} - The [[:Category:ColShape API|colshape]] the player left
 
{{Example}}
<pre>
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);
</pre>
}}
{{ClientsideCsJsEvent}}
{{CSharpContainer|
<syntaxhighlight lang="csharp">
public delegate void OnPlayerExitColshapeDelegate(Colshape colshape, CancelEventArgs cancel);
</syntaxhighlight>
{{Parameters}}
* '''colshape''': colshape, expects '''RAGE.Elements.Colshape''' type.
* '''cancel''': cancel, expects '''RAGE.Events.CancelEventArgs''' type.


  mp.events.add("playerExitColshape", playerExitColshapeHandler);
{{Example}}
<syntaxhighlight lang="csharp">
Events.OnPlayerExitColshape += OnPlayerExitColshape;
</syntaxhighlight>
<syntaxhighlight lang="csharp">
public void OnPlayerExitColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel)
{
    RAGE.Chat.Output($"You exited colshape id:{colshape.Id}");
}
</syntaxhighlight>
</syntaxhighlight>
</div>
}}
 
{{JSContainer|
{{Parameters}}
* '''shape''': {{RageType|ColShape}}
 
{{Example}}
<pre>
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);
</pre>
}}


==See also==
==See also==
{{Player_events}}
{{Player_events}}
[[Category:Player]]
[[Category:ColShape]]
[[Category:Server-side Event]]
[[Category:Client-side Event]]

Latest revision as of 12:04, 1 May 2024

This event is triggered when a player exits a colshape.

Default dimension for ColShapes is 0, and the player must be in the same dimension as the Colshape for them to collide.

Server-Side
Event

 C#  JavaScript




C# Syntax


JavaScript Syntax

Parameters

  • player: Player - The player which exited the colshape
  • shape: ColShape - 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

Parameters

  • shape: ColShape

Example

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