PlayerEnterColshape: Difference between revisions
No edit summary |
(Added client-side example) |
||
| Line 14: | Line 14: | ||
if(shape == someColShape) { | if(shape == someColShape) { | ||
console.log(player.name + " entered the colshape!"); | console.log(player.name + " entered the colshape!"); | ||
} | |||
} | |||
mp.events.add("playerEnterColshape", playerEnterColshapeHandler); | |||
</syntaxhighlight> | |||
</div> | |||
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;"> | |||
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div> | |||
<syntaxhighlight lang="javascript"> | |||
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100); | |||
function playerEnterColshapeHandler(shape) { | |||
if(shape == someColShape) { | |||
//Local player entered the colshape | |||
} | } | ||
} | } | ||
Revision as of 20:23, 18 September 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
let someColShape = mp.colshapes.newRectangle(0, 0, 100, 100);
function playerEnterColshapeHandler(shape) {
if(shape == someColShape) {
//Local player entered the colshape
}
}
mp.events.add("playerEnterColshape", playerEnterColshapeHandler);
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