PlayerEnterColshape: Difference between revisions

From RAGE Multiplayer Wiki
m (Replaced HTML with template)
No edit summary
Line 2: Line 2:


Default dimension for Colshapes is 0, and the player must be in the same dimension than the Colshape for them to collide.
Default dimension for Colshapes is 0, and the player must be in the same dimension than the Colshape for them to collide.
{{ServersideCsJsEvent}}


==Parameters==
{{JSContainer|
{{Parameters}}
* '''player''' - player which entered the colshape
* '''player''' - player which entered the colshape
* '''shape''' - the colshape the player entered
* '''shape''' - the colshape the player entered


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


 
{{ClientsideCsJsEvent}}
{{ClientsideCode|
{{JSContainer|
<pre>
<pre>
mp.events.add('playerEnterColshape', (shape) => {
mp.events.add('playerEnterColshape', (shape) => {
Line 31: Line 32:
}}
}}


==See also==
=See also=
{{Player_events}}
{{Player_events}}

Revision as of 16:18, 27 November 2018

This event is triggered when a player enters a colshape.

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

Server-Side
Event

 C#  JavaScript



JavaScript Syntax

Parameters

  • player - player which entered the colshape
  • shape - the colshape the player entered

Example

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

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

mp.events.add("playerEnterColshape", playerEnterColshapeHandler);


Client-Side Event

 C#  JavaScript


JavaScript Syntax

mp.events.add('playerEnterColshape', (shape) => {
    mp.game.graphics.notify(`You entered a colshape with id "${shape.id}".`);
});


See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint