CreateCylinderColShape

From GT-MP
Jump to: navigation, search
CreateCylinderColShape
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

Creates a cylinder shaped colshape object.


Dialog-warning.png

Note: If shared API was used when creating, then the created entities are not deleted on ResourceStop


The dimension of the collider can be set on the return type CylinderColShape.

Syntax

API.createCylinderColShape(Vector3 position, float range, float height);

Required Arguments

  • position: the position where the colshape should be placed in the world.
  • range: the range at which this colshape will trigger.
  • height: the height at which this colshape will trigger.

This function returns a CylinderColShape object.

Usage example(s)

m_colShape = API.createCylinderColShape(new Vector3(123, 123, 123), 2.0f, 3.0f);
m_colShape.onEntityEnterColShape += M_colShape_onEntityEnterColShape;

//...

private void M_colShape_onEntityEnterColShape(ColShape shape, NetHandle entity)
{
  var player = API.getPlayerFromHandle(entity);
  if (player == null) {
    return;
  }
  player.sendChatMessage("You stepped in the colshape!");
}
Dialog-warning.png

Note:

position: center of the cylinder

range: radius

height: position.Z + height & position.Z - height (this means, when the height parameter is 5 then is the cylinder 10 high)

Resource for Debug


Changelog

Version Description
1.0 Release.

References