PlayerEnterColshape: Difference between revisions
No edit summary |
No edit summary |
||
| (4 intermediate revisions by one other user not shown) | |||
| Line 3: | Line 3: | ||
Default dimension for Colshapes is 0, and the player must be in the same dimension as the Colshape for them to collide. | Default dimension for Colshapes is 0, and the player must be in the same dimension as the Colshape for them to collide. | ||
{{ServersideCsJsEvent}} | {{ServersideCsJsEvent}} | ||
{{CSharpContainer|1= | |||
See [[OnPlayerEnterColShape]]. | |||
}} | |||
{{JSContainer| | {{JSContainer| | ||
{{Parameters}} | {{Parameters}} | ||
* '''player''' - player which entered the colshape | * '''player''': {{RageType|Player}} - The [[:Category:Player API|player]] which entered the colshape | ||
* '''shape''' - | * '''shape''': {{RageType|ColShape}} - The [[:Category:ColShape API|colshape]] the player entered | ||
{{Example}} | {{Example}} | ||
| Line 34: | Line 38: | ||
{{Example}} | {{Example}} | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="csharp"> | ||
Events.OnPlayerEnterColshape += OnPlayerEnterColshape; | Events.OnPlayerEnterColshape += OnPlayerEnterColshape; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="csharp"> | ||
public void OnPlayerEnterColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel) | public void OnPlayerEnterColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel) | ||
{ | { | ||
| Line 46: | Line 50: | ||
{{JSContainer| | {{JSContainer| | ||
{{Parameters}} | |||
* '''shape''': {{RageType|ColShape}} | |||
{{Example}} | |||
<pre> | <pre> | ||
mp.events.add('playerEnterColshape', (shape) => { | mp.events.add('playerEnterColshape', (shape) => { | ||
| Line 55: | Line 63: | ||
=See also= | =See also= | ||
{{Player_events}} | {{Player_events}} | ||
[[Category:Player]] | |||
[[Category:ColShape]] | |||
[[Category:Server-side Event]] | |||
[[Category:Client-side Event]] | |||
Latest revision as of 12:04, 1 May 2024
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 as the Colshape for them to collide.
Server-Side Event
C# Syntax
JavaScript Syntax
Parameters
- player: Player - The player which entered the colshape
- shape: ColShape - 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# Syntax
public delegate void OnPlayerEnterColshapeDelegate(Colshape colshape, CancelEventArgs cancel);
Parameters
- colshape: colshape, expects RAGE.Elements.Colshape type.
- cancel: cancel, expects RAGE.Events.CancelEventArgs type.
Example
Events.OnPlayerEnterColshape += OnPlayerEnterColshape;
public void OnPlayerEnterColshape(RAGE.Elements.Colshape colshape, RAGE.Events.CancelEventArgs cancel)
{
RAGE.Chat.Output($"You entered colshape id:{colshape.Id}");
}
JavaScript Syntax
Parameters
- shape: ColShape
Example
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