[**SixL client API**](../../README.md)

***

[SixL client API](../../README.md) / [world-entities](../README.md) / CheckpointMpPool

# Interface: CheckpointMpPool

The pool of checkpoints: `mp.checkpoints`. It holds the checkpoints the server has sent to this client, and the ones a
script made.

## Example

```ts
mp.checkpoints.forEach((cp) => mp.console.logInfo(String(cp.visible)));
```

## Constructors

### Constructor

> **new CheckpointMpPool**(`type`, `position`, `radius`, `options?`): [`CheckpointMp`](CheckpointMp.md)

Makes a checkpoint, drawn by the overlay until it is destroyed.

#### Parameters

##### type

`number`

The ring's shape, an integer.

##### position

[`Vector3`](../../common/interfaces/Vector3.md)

Where it stands, metres.

##### radius

`number`

Its radius, metres.

##### options?

`color` (`[r, g, b, a]`, white by default), `direction` (a vector, zero by default), `destination`
(the next point, which the ring points at when it has no direction), `visible` (true by default) and `dimension`.

###### color?

[`Array4d`](../../common/type-aliases/Array4d.md)

###### destination?

[`Vector3`](../../common/interfaces/Vector3.md)

###### dimension?

`number`

###### direction?

[`Vector3`](../../common/interfaces/Vector3.md)

###### visible?

`boolean`

#### Returns

[`CheckpointMp`](CheckpointMp.md)

The new checkpoint.

#### Remarks

It is not streamed: no stream-in event is raised for it.

#### Example

```ts
const cp = mp.checkpoints.new(1, new mp.Vector3(10, 20, 30), 3, { color: [0, 255, 0, 100] });
```

## Properties

### length

> `readonly` **length**: `number`

The number of checkpoints the client holds now.

#### Example

```ts
const count = mp.checkpoints.length;
```

## Methods

### at()

> **at**(`id`): [`CheckpointMp`](CheckpointMp.md)

The checkpoint with this client id, or `undefined`.

#### Parameters

##### id

`number`

The client's own number for the checkpoint (from 1, reused after one is removed). It is not the server's id.

#### Returns

[`CheckpointMp`](CheckpointMp.md)

The checkpoint, or `undefined` when there is none with that id.

#### Example

```ts
const cp = mp.checkpoints.at(1);
```

***

### exists()

> **exists**(`entity`): `boolean`

Whether a checkpoint is still held by this client.

#### Parameters

##### entity

`number` \| [`CheckpointMp`](CheckpointMp.md)

A checkpoint, or the client id of one (the id of [CheckpointMpPool.at](#at)).

#### Returns

`boolean`

True while the checkpoint is held; false once the server has removed it from this client, or a script has destroyed it.

#### Example

```ts
if (mp.checkpoints.exists(cp)) { }
```

***

### forEach()

> **forEach**(`callingFunction`): `void`

Calls a function for every checkpoint held by this client.

#### Parameters

##### callingFunction

(`entity`) => `void`

Called with each checkpoint.

#### Returns

`void`

#### Example

```ts
mp.checkpoints.forEach((cp) => mp.console.logInfo(String(cp.radius)));
```

***

### toArray()

> **toArray**(): [`CheckpointMp`](CheckpointMp.md)[]

The checkpoints held by this client, as an array.

#### Returns

[`CheckpointMp`](CheckpointMp.md)[]

A new array of the checkpoints at the time of the call.

#### Example

```ts
const all = mp.checkpoints.toArray();
```
