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

***

[SixL client API](../../../README.md) / [game/decorator](../README.md) / GameDecoratorMp

# Interface: GameDecoratorMp

Decorators: named values (a number, a flag or a time) that the game keeps on an entity. A property is registered
with a type before it is set.

## Remarks

Every getter returns a Promise. A property name given as a string is hashed (see [GameNameOrHash](../../common/type-aliases/GameNameOrHash.md)).

## Methods

### decorExistOn()

> **decorExistOn**(`entity`, `property`): `Promise`\<`boolean`\>

Tells whether an entity has a decorator with that property.

#### Parameters

##### entity

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

The entity.

##### property

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

The property's name, or its hash.

#### Returns

`Promise`\<`boolean`\>

A Promise of `true` when the decorator is set on the entity.

#### Example

```ts
const has = await mp.game.decorator.decorExistOn(vehicle.handle, 'locked');
```

***

### decorGetBool()

> **decorGetBool**(`entity`, `property`): `Promise`\<`boolean`\>

Reads a boolean decorator from an entity.

#### Parameters

##### entity

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

The entity.

##### property

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

The property's name, or its hash.

#### Returns

`Promise`\<`boolean`\>

A Promise of the stored flag.

#### Example

```ts
const locked = await mp.game.decorator.decorGetBool(vehicle.handle, 'locked');
```

***

### decorGetInt()

> **decorGetInt**(`entity`, `property`): `Promise`\<`number`\>

Reads an integer decorator from an entity.

#### Parameters

##### entity

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

The entity.

##### property

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

The property's name, or its hash.

#### Returns

`Promise`\<`number`\>

A Promise of the stored integer.

#### Example

```ts
const level = await mp.game.decorator.decorGetInt(ped.handle, 'level');
```

***

### decorIsRegisteredAsType()

> **decorIsRegisteredAsType**(`property`, `type`): `Promise`\<`boolean`\>

Tells whether a property name is registered with the given type.

#### Parameters

##### property

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

The property's name, or its hash.

##### type

`number`

The type, an integer in the game's numbering of decorator types.

#### Returns

`Promise`\<`boolean`\>

A Promise of `true` when the name is registered with that type.

#### Example

```ts
const ok = await mp.game.decorator.decorIsRegisteredAsType('level', 3);
```

***

### decorRegister()

> **decorRegister**(`property`, `type`): `void`

Registers a property name with a type, so that decorators of this name can be set.

#### Parameters

##### property

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

The property's name, or its hash.

##### type

`number`

The type, an integer in the game's numbering of decorator types.

#### Returns

`void`

#### Example

```ts
mp.game.decorator.decorRegister('level', 3);
```

***

### decorRegisterLock()

> **decorRegisterLock**(): `void`

Locks the decorator registry.

#### Returns

`void`

#### Remarks

The effect is inferred and not verified in the game.

#### Example

```ts
mp.game.decorator.decorRegisterLock();
```

***

### decorRemove()

> **decorRemove**(`entity`, `property`): `Promise`\<`boolean`\>

Removes a decorator from an entity.

#### Parameters

##### entity

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

The entity.

##### property

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

The property's name, or its hash.

#### Returns

`Promise`\<`boolean`\>

A Promise of `true` when the decorator was removed.

#### Example

```ts
const removed = await mp.game.decorator.decorRemove(vehicle.handle, 'locked');
```

***

### decorSetTime()

> **decorSetTime**(`entity`, `property`, `timestamp`): `Promise`\<`boolean`\>

Sets the time stamp of a decorator on an entity.

#### Parameters

##### entity

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

The entity.

##### property

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

The property's name, or its hash.

##### timestamp

`number`

The time stamp, an integer.

#### Returns

`Promise`\<`boolean`\>

A Promise of `true` when the value was set.

#### Remarks

The argument layout is inferred and not verified in the game.

#### Example

```ts
const ok = await mp.game.decorator.decorSetTime(vehicle.handle, 'job_started', 1700000000);
```
