PlayerEnterColshape: Difference between revisions

From RAGE Multiplayer Wiki
Line 32: Line 32:
     let local = mp.players.local;
     let local = mp.players.local;
      
      
     mp.game.graphics.notify(`${local.name} entered a colshape.`);
     mp.game.graphics.notify(`${local.name} entered a colshape with id "${shape.id}".`);
});
});
</syntaxhighlight>
</syntaxhighlight>

Revision as of 19:54, 19 November 2017

This event is triggered when a player enters a colshape.

Parameters

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

Example

Server-Side
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
// Create it serverside as follow
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);

// Use this clientside
mp.events.add('playerEnterColshape', (shape) => {
    let local = mp.players.local;
    
    mp.game.graphics.notify(`${local.name} entered a colshape with id "${shape.id}".`);
});

See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint