PlayerEnterColshape: Difference between revisions
No edit summary |
No edit summary |
||
| Line 28: | Line 28: | ||
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div> | <div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div> | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
mp.events.add('playerEnterColshape', ( | mp.events.add('playerEnterColshape', (shape_id) => { | ||
mp.game.graphics.notify(`You entered a colshape with id "${ | mp.game.graphics.notify(`You entered a colshape with id "${shape_id}".`); | ||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 04:47, 20 November 2017
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. Use entity.dimension on the colshape to change the dimension.
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
mp.events.add('playerEnterColshape', (shape_id) => {
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