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

***

[SixL server API](../../README.md) / [world-entities](../README.md) / DummyMp

# Interface: DummyMp

A dummy entity: a server-side object that is only a type number and shared variables.
Clients are not told about dummies.

## Example

```ts
const quest = mp.dummies.new(7, { stage: 1 });
```

## Extends

- [`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md)

## Properties

### data

> **data**: `any`

The shared variables as properties: `entity.data.key` reads, `entity.data.key = value` sets.

#### Remarks

A view over [BaseEntityMp.getVariable](../../entity/interfaces/BaseEntityMp.md#getvariable) / [BaseEntityMp.setVariable](../../entity/interfaces/BaseEntityMp.md#setvariable): setting a key sends it
to clients exactly like `setVariable`.

#### Example

```ts
player.data.cash = 100;
```

#### Inherited from

[`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md).[`data`](../../entity/interfaces/BaseEntityMp.md#data)

***

### dimension

> **dimension**: `number`

The dimension the entity lives in: players see and stream only entities of their own dimension.

#### Remarks

Dimension 0 is the default world. For players it is applied at once and the streaming is recomputed;
for other entities it is picked up on the next tick. For [PlayerMp.isStreamed](../../player/interfaces/PlayerMp.md#isstreamed) dimension 0 counts as
global; for vehicles, peds and objects (`isStreamed`) the dimensions must be equal.

#### Example

```ts
player.dimension = 5;
```

#### Inherited from

[`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md).[`dimension`](../../entity/interfaces/BaseEntityMp.md#dimension)

***

### dummyType

> **dummyType**: `number`

The dummy type number given at creation.

#### Example

```ts
if (dummy.dummyType === 7) { }
```

***

### id

> `readonly` **id**: `number`

The entity's id, unique within its pool (`mp.players`, `mp.vehicles` …).

#### Remarks

Ids are server-side and start at 0 or 1 per pool, so two entities of different kinds can share one.
The client's `remoteId` is this same number.

#### Example

```ts
const vehicle = mp.vehicles.at(vehicleId);
```

#### Inherited from

[`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md).[`id`](../../entity/interfaces/BaseEntityMp.md#id)

***

### type

> `readonly` **type**: `string`

Always `'dummy'`.

#### Example

```ts
if (entity.type === 'dummy') { }
```

## Methods

### destroy()

> **destroy**(): `void`

Removes the entity.

#### Returns

`void`

#### Remarks

For vehicles, peds and objects the entity is gone from its pool the moment `destroy()` returns
(`exists` is false at once) and `entityDestroyed` follows. Players cannot be destroyed: use `kick()`.

#### Example

```ts
vehicle.destroy();
```

#### Inherited from

[`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md).[`destroy`](../../entity/interfaces/BaseEntityMp.md#destroy)

***

### getVariable()

> **getVariable**\<`T`\>(`name`): `T`

Reads a shared variable (set by [BaseEntityMp.setVariable](../../entity/interfaces/BaseEntityMp.md#setvariable)).

#### Type Parameters

##### T

`T` = `any`

#### Parameters

##### name

`string`

The variable's key.

#### Returns

`T`

The value, or `undefined` when it was never set. Read from the script host's own copy: no round trip.

#### Example

```ts
const job = player.getVariable('job');
```

#### Inherited from

[`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md).[`getVariable`](../../entity/interfaces/BaseEntityMp.md#getvariable)

***

### setVariable()

> **setVariable**(`name`, `value`): `void`

Sets a shared variable on the entity.

#### Parameters

##### name

`string`

The variable's key.

##### value

`any`

Any JSON-serialisable value.

#### Returns

`void`

#### Remarks

The script's own copy changes at once. Players, vehicles, peds and objects also send it to the
clients that have the entity streamed in (with the size and rate limits of the server; a refused change is
logged by the script host and the local copy stays). Colshapes and dummies keep it on the server only.
Blips, markers, labels and checkpoints send it with their other data.

#### Example

```ts
vehicle.setVariable('fuel', 42);
```

#### Inherited from

[`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md).[`setVariable`](../../entity/interfaces/BaseEntityMp.md#setvariable)

***

### setVariables()

> **setVariables**(`values`): `void`

Sets several shared variables at once; the same as calling [BaseEntityMp.setVariable](../../entity/interfaces/BaseEntityMp.md#setvariable) for each key.

#### Parameters

##### values

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

An object of key to value.

#### Returns

`void`

#### Example

```ts
player.setVariables({ job: 'taxi', level: 3 });
```

#### Inherited from

[`BaseEntityMp`](../../entity/interfaces/BaseEntityMp.md).[`setVariables`](../../entity/interfaces/BaseEntityMp.md#setvariables)
