PlayerEnterColshape: Difference between revisions
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}} | |||
{{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}} | |||
{{ | |||
<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}} | |||
{{ | {{JSContainer| | ||
<pre> | <pre> | ||
mp.events.add('playerEnterColshape', (shape) => { | mp.events.add('playerEnterColshape', (shape) => { | ||
| Line 31: | Line 32: | ||
}} | }} | ||
=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
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
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
- playerChat
- playerCommand
- playerDamage
- playerDeath
- playerJoin
- playerQuit
- playerReady
- playerSpawn
- playerWeaponChange
Streaming
Vehicle
- playerStartEnterVehicle
- playerEnterVehicle
- playerStartExitVehicle
- playerExitVehicle
- trailerAttached
- vehicleDamage
- vehicleDeath
- vehicleHornToggle
- vehicleSirenToggle