PlayerExitColshape: Difference between revisions

From RAGE Multiplayer Wiki
m (mistyped category)
No edit summary
Line 4: Line 4:


{{ServersideCsJsEvent}}
{{ServersideCsJsEvent}}
{{CSharpContainer|1=
See [https://wiki.gtanet.work/index.php?title=OnPlayerExitColShape on GTA Network Wiki].
}}


{{JSContainer|
{{JSContainer|
{{Parameters}}
{{Parameters}}
* '''player''' - player which exited the colshape
* '''player''': {{RageType|Player}} - player which exited the colshape
* '''shape''' - the colshape the player left
* '''shape''': {{RageType|ColShape}} - the [[:Category:ColShape API|colshape]] the player left


{{Example}}
{{Example}}
Line 26: Line 30:
{{ClientsideCsJsEvent}}
{{ClientsideCsJsEvent}}
{{CSharpContainer|
{{CSharpContainer|
<syntaxhighlight lang="c#">
<syntaxhighlight lang="csharp">
public delegate void OnPlayerExitColshapeDelegate(Colshape colshape, CancelEventArgs cancel);
public delegate void OnPlayerExitColshapeDelegate(Colshape colshape, CancelEventArgs cancel);
</syntaxhighlight>
</syntaxhighlight>
Line 35: Line 39:


{{Example}}
{{Example}}
<syntaxhighlight lang="c#">
<syntaxhighlight lang="csharp">
Events.OnPlayerExitColshape += OnPlayerExitColshape;
Events.OnPlayerExitColshape += OnPlayerExitColshape;
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang="c#">
<syntaxhighlight lang="csharp">
public void OnPlayerExitColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel)
public void OnPlayerExitColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel)
{
{
Line 45: Line 49:
</syntaxhighlight>
</syntaxhighlight>
}}
}}
{{JSContainer|
{{JSContainer|
{{Parameters}}
* '''shape''': {{RageType|ColShape}}
{{Example}}
<pre>
<pre>
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);
Line 61: Line 70:
==See also==
==See also==
{{Player_events}}
{{Player_events}}


[[Category:ColShape]]
[[Category:ColShape]]
[[Category:Server-side Event]]
[[Category:Server-side Event]]
[[Category:Client-side Event]]
[[Category:Client-side Event]]

Revision as of 12:43, 23 May 2019

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 - 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