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

***

[SixL server API](../../README.md) / [player](../README.md) / PlayerMp

# Interface: PlayerMp

A connected player. Players are created by the connection, never by a script; find them in `mp.players` or in
the arguments of events.

## Remarks

Many members are server-side state that SixL keeps and sends to the clients as entity data
(see `server/docs/state-to-clients.md`); where the game does not show a state yet, the member says so.
A member that SixL does not implement does not exist on the interface (calling it on a real player only logs a
warning).

## Example

```ts
mp.events.add('playerJoin', (player) => player.outputChatBox(`Hello, ${player.name}`));
```

## Extends

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

## Properties

### action

> `readonly` **action**: `string`

The player's current action.

#### Remarks

Partial: the client sends no action, so it is always an empty string.

#### Example

```ts
const action = player.action;
```

***

### aimTarget

> `readonly` **aimTarget**: `PlayerMp`

The entity the player is aiming at.

#### Remarks

Partial: the client sends no aim target, so it is always `null`.

#### Example

```ts
const target = player.aimTarget;
```

***

### allWeapons

> `readonly` **allWeapons**: `number`[]

The hashes of the weapons the server gave.

#### Remarks

Partial: same source as [PlayerMp.weapons](#weapons).

#### Example

```ts
if (player.allWeapons.includes(hash)) { }
```

***

### alpha

> **alpha**: `number`

Opacity, 0 (invisible) to 255 (opaque).

#### Remarks

Values are clamped to 0..255 and rounded down. Partial: the value reaches the clients as the entity
data `sixl:alpha` but the game does not show it yet.

#### Example

```ts
vehicle.alpha = 128;
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`alpha`](../../entity/interfaces/EntityMp.md#alpha)

***

### armour

> **armour**: `number`

The player's armour.

#### Remarks

A player starts with 0. Setting it sends the new value to the server and the player's client.

#### Example

```ts
player.armour = 50;
```

***

### 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

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`data`](../../entity/interfaces/EntityMp.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](#isstreamed) dimension 0 counts as
global; for vehicles, peds and objects (`isStreamed`) the dimensions must be equal.

#### Example

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

#### Inherited from

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

***

### disableOutgoingSync

> **disableOutgoingSync**: `boolean`

Whether the server's synchronisation of this player to the others is switched off.

#### Remarks

Partial: the flag is stored, but the server's relay does not read it yet, so it has no effect.

#### Example

```ts
player.disableOutgoingSync = true;
```

***

### eyeColor

> **eyeColor**: `number`

The player's eye colour index.

#### Remarks

Partial: sent to the clients as data (`sixl:eyeColor`); the game does not show it yet.

#### Example

```ts
player.eyeColor = 3;
```

***

### faceFeatures

> **faceFeatures**: `number`[]

The 20 face feature values, each -1..1.

#### Remarks

Partial: setting it sets each feature in turn. The values reach the owner's client one by one
([PlayerMp.setFaceFeature](#setfacefeature)), but the game does not apply them yet.

#### Example

```ts
player.faceFeatures = new Array(20).fill(0);
```

***

### gameType

> **gameType**: `string`

The game type the player runs.

#### Remarks

Partial: a constant, `'SixL'`.

#### Example

```ts
console.log(player.gameType);
```

***

### gender

> **gender**: `string`

The player's gender.

#### Remarks

Partial: `'male'` or `'female'`, from `setCustomization`, from the setter, or else from the model
(`mp_f_freemode_01` is female). Not sent to clients. Setting accepts `'female'` / `false` for female and
anything else for male.

#### Example

```ts
const g = player.gender;
```

***

### hairColor

> **hairColor**: `number`

The player's hair colour index.

#### Remarks

Partial: sent to the clients as data (`sixl:hair`); the game does not show it yet.

#### Example

```ts
player.hairColor = 5;
```

***

### hairHighlightColor

> **hairHighlightColor**: `number`

The player's hair highlight colour index.

#### Remarks

Partial: sent to the clients as data (`sixl:hair`); the game does not show it yet.

#### Example

```ts
player.hairHighlightColor = 2;
```

***

### heading

> **heading**: `number`

The player's heading, in degrees.

#### Remarks

Setting it turns the player on the spot; setting `position` does not change the heading.
The value is read from the player's own state report.

#### Example

```ts
player.heading = 90;
```

***

### health

> **health**: `number`

The player's health.

#### Remarks

The value is the game's own (VI's), not RAGE MP's 0..100: a player's full health is the game's maximum (170 today). The server learns the
player's real health and maximum from the player's client, and `player.spawn()` restores FULL health. Setting it sends the number as given to the player's
client (the game keeps it within its maximum). Before the client's first report the server only knows its starting value.

#### Example

```ts
player.health = 60;
```

***

### 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

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

***

### ip

> `readonly` **ip**: `string`

The player's IP address.

#### Remarks

Taken from the network connection when the player joins.

#### Example

```ts
console.log(player.ip);
```

***

### isAiming

> `readonly` **isAiming**: `boolean`

Whether the player is aiming.

#### Remarks

From the state flag the client sends.

#### Example

```ts
if (player.isAiming) { }
```

***

### isClimbing

> `readonly` **isClimbing**: `boolean`

Whether the player is climbing.

#### Remarks

Partial: the client sends no climbing state, so it is always false.

#### Example

```ts
const climbing = player.isClimbing;
```

***

### isEnteringVehicle

> `readonly` **isEnteringVehicle**: `boolean`

Whether the player is getting into a vehicle.

#### Remarks

Partial: the client sends no such state, so it is always false.

#### Example

```ts
const entering = player.isEnteringVehicle;
```

***

### isInCover

> `readonly` **isInCover**: `boolean`

Whether the player is in cover.

#### Remarks

Partial: the player state has no such flag, so it is always false.

#### Example

```ts
const covered = player.isInCover;
```

***

### isInMelee

> `readonly` **isInMelee**: `boolean`

Whether the player is in melee combat.

#### Remarks

Partial: the player state has no such flag, so it is always false.

#### Example

```ts
const fighting = player.isInMelee;
```

***

### isJumping

> `readonly` **isJumping**: `boolean`

Whether the player is jumping.

#### Remarks

Partial: from the character state id the client sends; the game sends 0 for now, so it is always
false at the moment.

#### Example

```ts
if (player.isJumping) { }
```

***

### isLeavingVehicle

> `readonly` **isLeavingVehicle**: `boolean`

Whether the player is getting out of a vehicle.

#### Remarks

Partial: the client sends no such state, so it is always false.

#### Example

```ts
const leaving = player.isLeavingVehicle;
```

***

### isOnLadder

> `readonly` **isOnLadder**: `boolean`

Whether the player is on a ladder.

#### Remarks

Partial: the player state has no such flag, so it is always false.

#### Example

```ts
const onLadder = player.isOnLadder;
```

***

### isReloading

> `readonly` **isReloading**: `boolean`

Whether the player is reloading.

#### Remarks

From the state flag the client sends.

#### Example

```ts
if (player.isReloading) { }
```

***

### language

> `readonly` **language**: `string`

The player's language as a BCP 47 tag (`"en"`, `"pt-BR"`, `"zh-Hans"` …), for translating server messages.

#### Remarks

A SixL addition. It is known after `playerReady`; `"en"` before. Read-only.

#### Example

```ts
const text = (translations[player.language] || translations.en).welcome;
```

***

### lobbyId

> `readonly` **lobbyId**: `string`

The stable id of the player's SixL lobby account (a decimal string), or an empty string for a guest.

#### Remarks

Verified like [PlayerMp.login](#login); unlike the login it never changes for an account.

#### Example

```ts
const account = player.lobbyId;
```

***

### login

> `readonly` **login**: `string`

The SixL lobby account the player proved when joining: the same string `incomingConnection` gave as `login`.

#### Remarks

Empty for a guest (no lobby account, or the proof failed). Verified, unlike `serial`: the lobby's signed
token is checked offline and the player signs this server's one-time challenge with their own key. The name may
change; use [PlayerMp.lobbyId](#lobbyid) to recognise the account.

#### Example

```ts
if (player.login) player.outputChatBox(`Welcome back, ${player.login}`);
```

***

### look

> **look**: `string`[]

The player's look: VI's outfit as three 16-digit hex strings `[c0, c1, c2]`; `null` until the client sent one.

#### Remarks

A SixL addition. VI has no component and prop slots like GTA V: this value carries the whole outfit.
Copy it to another player or to a ped of the same model to dress it alike. Setting it needs exactly three
strings (otherwise it throws a `TypeError`) and also puts the look on the player's own client.

#### Example

```ts
npc.look = player.look;
```

***

### model

> **model**: `string` \| `number`

The entity's model.

#### Remarks

VI's model keys are 64-bit values and GTA V model names do not resolve in VI. Vehicles, peds and
objects report the model as it was given at creation, a name string (a hash that `mp.joaat` computed in this
run is turned back into its name; an unknown hash becomes its decimal string). Players report what the script set
(a VI key as a `"0x..."` string, a name or a hash; 0 until set). Setting it on a player reaches the clients: the
player's own game loads the model and puts it on the player, and every client reads it as that player's model (not
yet checked in the game); on a vehicle, ped or object it changes the server's copy and raises `entityModelChange`
but is not sent to clients.

#### Example

```ts
const model = vehicle.model;
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`model`](../../entity/interfaces/EntityMp.md#model)

***

### name

> **name**: `string`

The player's name.

#### Remarks

Setting it sends the name to the server; the clients get it when the player streams in.

#### Example

```ts
player.name = 'Alex';
```

***

### packetLoss

> `readonly` **packetLoss**: `number`

The share of packets lost on the way to the player, in percent.

#### Example

```ts
const loss = player.packetLoss;
```

***

### ping

> `readonly` **ping**: `number`

The player's round-trip time to the server, in milliseconds.

#### Remarks

Refreshed with the state broadcast (about 20 times a second).

#### Example

```ts
if (player.ping > 300) player.kick('Lag');
```

***

### position

> **position**: [`Vector3`](../../common/interfaces/Vector3.md)

The entity's position in metres.

#### Remarks

Reading returns the script host's copy. Setting moves the entity: for players, vehicles, peds and
objects the new position is sent to the server (for peds the new position does not reach the clients yet).
A blip, marker, label or checkpoint streams the new position to the players.

#### Example

```ts
player.position = new mp.Vector3(0, 0, 70);
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`position`](../../entity/interfaces/EntityMp.md#position)

***

### seat

> `readonly` **seat**: `number`

The seat the player sits in, 0 = driver; `null` on foot.

#### Example

```ts
const isDriver = player.seat === 0;
```

***

### serial

> `readonly` **serial**: `string`

The player's hardware serial: the same string `incomingConnection` gave.

#### Remarks

A SixL addition in effect: RAGE MP's serial is a different value, and VI has no Social Club (no
`rgscId`, no `socialClub`). The client derives it from the machine's hardware as HMAC-SHA256 with a fixed SixL
key, 64 hex characters, so it is the same on every SixL server. It is empty when the client sent none. The
client computes it: a modified client can forge it, so it helps bans and recognising a returning player but is
not a guarantee of identity.

#### Example

```ts
const serial = player.serial;
```

***

### shapeFirst

> `readonly` **shapeFirst**: `number`

The first face shape id of the head blend.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const shape = player.shapeFirst;
```

***

### shapeMix

> `readonly` **shapeMix**: `number`

The mix between the first two face shapes, 0..1.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const mix = player.shapeMix;
```

***

### shapeSecond

> `readonly` **shapeSecond**: `number`

The second face shape id of the head blend.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const shape = player.shapeSecond;
```

***

### shapeThird

> `readonly` **shapeThird**: `number`

The third face shape id of the head blend.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const shape = player.shapeThird;
```

***

### skinFirst

> `readonly` **skinFirst**: `number`

The first skin tone id of the head blend.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const skin = player.skinFirst;
```

***

### skinMix

> `readonly` **skinMix**: `number`

The mix between the first two skin tones, 0..1.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const mix = player.skinMix;
```

***

### skinSecond

> `readonly` **skinSecond**: `number`

The second skin tone id of the head blend.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const skin = player.skinSecond;
```

***

### skinThird

> `readonly` **skinThird**: `number`

The third skin tone id of the head blend.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const skin = player.skinThird;
```

***

### streamedPlayers

> `readonly` **streamedPlayers**: `PlayerMp`[]

The players this player has streamed in.

#### Remarks

As of the last state broadcast, from the streaming set the server keeps.

#### Example

```ts
for (const other of player.streamedPlayers) other.outputChatBox('hi');
```

***

### thirdMix

> `readonly` **thirdMix**: `number`

The weight of the third face shape and skin tone, 0..1.

#### Remarks

Partial: read from the server's head blend; the game does not show it yet.

#### Example

```ts
const mix = player.thirdMix;
```

***

### type

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

The kind of entity.

#### Remarks

`'player'`, `'vehicle'`, `'ped'` or `'object'`.

#### Example

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

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`type`](../../entity/interfaces/EntityMp.md#type)

***

### vehicle

> `readonly` **vehicle**: [`VehicleMp`](../../vehicle/interfaces/VehicleMp.md)

The vehicle the player is in.

#### Returns

The vehicle, or `null` on foot. Kept up to date by the enter and exit events of the server.

#### Example

```ts
if (player.vehicle) player.vehicle.repair();
```

***

### voiceListeners

> `readonly` **voiceListeners**: `PlayerMp`[]

The players who hear this player talk: proximity and radio channels, minus personal mutes.

#### Remarks

As of the last state broadcast, from the server's voice router.

#### Example

```ts
const hearing = player.voiceListeners.length;
```

***

### weapon

> **weapon**: `number`

The weapon in hand, as the game's hash.

#### Remarks

The client reports it in its state (0 from an old client: the previous value stays); unarmed is
2725352035. Setting it gives the weapon (see [PlayerMp.giveWeapon](#giveweapon)); it is in hand about a second later.

#### Example

```ts
const hash = player.weapon;
```

***

### weaponAmmo

> **weaponAmmo**: `number`

The ammo of the weapon in hand ([PlayerMp.weapon](#weapon)); setting it sets that weapon's.

#### Remarks

Partial: what the server gave ([PlayerMp.getWeaponAmmo](#getweaponammo) for the weapon in hand); it does not fall
as the player shoots.

#### Example

```ts
player.weaponAmmo = 120;
```

***

### weapons

> `readonly` **weapons**: [`PlayerWeapon`](PlayerWeapon.md)[]

The weapons the server gave, with their ammo.

#### Remarks

Partial: the list is kept by the script host from its own `giveWeapon` / `removeWeapon` calls; weapons
the player picks up on the client and their ammo spent are not seen. RAGE MP's `weapons` is a different
object (`{ current, reset() }`).

#### Example

```ts
const count = player.weapons.length;
```

## Methods

### ban()

> **ban**(`reason?`): `void`

Kicks the player and refuses their hardware id when they connect again.

#### Parameters

##### reason?

`string`

The reason shown to the player (default `'Banned'`).

#### Returns

`void`

#### Remarks

Partial: the ban is kept in memory only (there is no database), so a server restart forgets it.
The refusal is applied when the client reports ready.

#### Example

```ts
player.ban('cheating');
```

***

### call()

> **call**(`eventName`, ...`args`): `void`

Calls an event on this player's client.

#### Parameters

##### eventName

`string`

The client event name.

##### args

...`any`[]

The arguments, JSON-serialisable. A single array argument is spread, so `call('e', [a, b])`
and `call('e', a, b)` send the same.

#### Returns

`void`

#### Remarks

Fire and forget. The client handles it with `mp.events.add(eventName, (...args) => {})`.

#### Example

```ts
player.call('showMenu', ['main', 3]);
```

***

### callProc()

> **callProc**\<`T`\>(`procName`, ...`args`): `Promise`\<`T`\>

Calls a procedure registered on the client and waits for its answer.

#### Type Parameters

##### T

`T` = `any`

#### Parameters

##### procName

`string`

The name the client registered with `mp.events.addProc`.

##### args

...`any`[]

The arguments, JSON-serialisable.

#### Returns

`Promise`\<`T`\>

A promise of the client's return value. It rejects with an `Error` when the client's procedure threw
or when [PlayerMp.cancelPendingProc](#cancelpendingproc) cancelled the call.

#### Remarks

There is no timeout: a client that never answers leaves the promise pending until the player leaves
or the call is cancelled. Sent as the client event `sixl:proc`; answered by the server event `sixl:procResult`.

#### Example

```ts
const fps = await player.callProc<number>('getFps');
```

***

### callToStreamed()

> **callToStreamed**(`includeSelf`, `eventName`, ...`args`): `void`

Calls a client event on every player this player has streamed in, and optionally on this player too.

#### Parameters

##### includeSelf

`boolean`

Also call it on this player.

##### eventName

`string`

The client event name.

##### args

...`any`[]

The arguments, as in [PlayerMp.call](#call).

#### Returns

`void`

#### Example

```ts
player.callToStreamed(true, 'emote', ['wave']);
```

***

### callUnreliable()

> **callUnreliable**(`eventName`, ...`args`): `void`

Calls an event on the client without the reliability guarantee.

#### Parameters

##### eventName

`string`

The client event name.

##### args

...`any`[]

The arguments, as in [PlayerMp.call](#call).

#### Returns

`void`

#### Remarks

Partial: the server has no unreliable events, so the call is delivered reliably, like `call`.

#### Example

```ts
player.callUnreliable('hudTick', [score]);
```

***

### cancelPendingProc()

> **cancelPendingProc**(`procName`): `void`

Cancels the pending calls of a client procedure.

#### Parameters

##### procName

`string`

The procedure's name. The waiting promises reject with an `Error`.

#### Returns

`void`

#### Example

```ts
player.cancelPendingProc('getFps');
```

***

### clearDecorations()

> **clearDecorations**(): `void`

Removes every decoration.

#### Returns

`void`

#### Remarks

Partial: clears what the server keeps; the game does not apply it yet.

#### Example

```ts
player.clearDecorations();
```

***

### 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

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

***

### disableVoiceTo()

> **disableVoiceTo**(`target`): `void`

Stops a player from hearing this player (a personal mute in the voice router).

#### Parameters

##### target

`PlayerMp`

The listener who stops hearing this player.

#### Returns

`void`

#### Remarks

Partial: the mute is the personal mute of the voice router.

#### Example

```ts
player.disableVoiceTo(listener);
```

***

### dist()

> **dist**(`position`): `number`

The distance from the entity to a point or another entity.

#### Parameters

##### position

[`IVector3`](../../common/interfaces/IVector3.md) \| \{ `position`: [`IVector3`](../../common/interfaces/IVector3.md); \}

A point (anything with `x`, `y`, `z`, metres) or an entity (anything with `position`).

#### Returns

`number`

The 3D distance in metres.

#### Example

```ts
if (player.dist(shop.position) < 3) { }
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`dist`](../../entity/interfaces/EntityMp.md#dist)

***

### distSquared()

> **distSquared**(`position`): `number`

The squared distance (no square root: cheaper for comparisons).

#### Parameters

##### position

[`IVector3`](../../common/interfaces/IVector3.md) \| \{ `position`: [`IVector3`](../../common/interfaces/IVector3.md); \}

A point (anything with `x`, `y`, `z`, metres) or an entity (anything with `position`).

#### Returns

`number`

The squared 3D distance, metres squared.

#### Example

```ts
if (player.distSquared(point) < 25) { }
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`distSquared`](../../entity/interfaces/EntityMp.md#distsquared)

***

### enableVoiceTo()

> **enableVoiceTo**(`target`): `void`

Lets a player hear this player again (lifts a personal mute).

#### Parameters

##### target

`PlayerMp`

The listener.

#### Returns

`void`

#### Remarks

Partial: it only lifts the personal mute in the voice router; the RAGE MP manual mode (hear only
this target) is not supported.

#### Example

```ts
player.enableVoiceTo(listener);
```

***

### getClothes()

> **getClothes**(`component`): `object`

Reads a clothes component.

#### Parameters

##### component

`number`

The component slot.

#### Returns

`object`

What the server set; zeros if never set.

##### drawable

> **drawable**: `number`

##### palette

> **palette**: `number`

##### texture

> **texture**: `number`

#### Example

```ts
const { drawable, texture } = player.getClothes(11);
```

***

### getDecoration()

> **getDecoration**(`collection`): `number`

The overlay hash applied from a collection.

#### Parameters

##### collection

`number`

The collection's joaat hash.

#### Returns

`number`

The overlay hash; 0 if none.

#### Example

```ts
const overlay = player.getDecoration(collectionHash);
```

***

### getFaceFeature()

> **getFaceFeature**(`index`): `number`

Reads one face feature.

#### Parameters

##### index

`number`

The feature, 0..19.

#### Returns

`number`

The value, -1..1; 0 if never set.

#### Example

```ts
const nose = player.getFaceFeature(0);
```

***

### getHeadBlend()

> **getHeadBlend**(): [`HeadBlend`](HeadBlend.md)

The head blend the server holds.

#### Returns

[`HeadBlend`](HeadBlend.md)

The shapes, skins and mixes; all zeros if never set. A copy.

#### Example

```ts
const blend = player.getHeadBlend();
```

***

### getHeadOverlay()

> **getHeadOverlay**(`overlay`): `number`[]

Reads a head overlay.

#### Parameters

##### overlay

`number`

The overlay slot, 0..12.

#### Returns

`number`[]

`[overlayValue, opacity, colorType, color]`; `[255, 0, 0, 0]` when never set (255 = none).

#### Example

```ts
const [value, opacity] = player.getHeadOverlay(1);
```

***

### getOwnVariable()

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

Reads a variable only this player's client sees (set with [EntityMp.setOwnVariable](../../entity/interfaces/EntityMp.md#setownvariable)).

#### 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 copy.

#### Example

```ts
const token = player.getOwnVariable('token');
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`getOwnVariable`](../../entity/interfaces/EntityMp.md#getownvariable)

***

### getProp()

> **getProp**(`prop`): `object`

Reads a prop.

#### Parameters

##### prop

`number`

The prop slot.

#### Returns

`object`

What the server set; drawable -1 (no prop) if never set.

##### drawable

> **drawable**: `number`

##### texture

> **texture**: `number`

#### Example

```ts
const { drawable } = player.getProp(0);
```

***

### 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

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

***

### getWeaponAmmo()

> **getWeaponAmmo**(`weaponHash`): `number`

The ammo of a weapon, as the server gave it.

#### Parameters

##### weaponHash

`number`

The weapon's game hash (a number).

#### Returns

`number`

The ammo; 0 for a weapon the server did not give.

#### Remarks

Counts what `giveWeapon` / `setWeaponAmmo` set: it does not fall as the player shoots.

#### Example

```ts
const ammo = player.getWeaponAmmo(hash);
```

***

### giveWeapon()

> **giveWeapon**(`weapon`, `ammo?`): `void`

Gives a weapon.

#### Parameters

##### weapon

[`HashOrNumberOrString`](../../common/type-aliases/HashOrNumberOrString.md)\<`never`\> \| [`HashOrNumberOrString`](../../common/type-aliases/HashOrNumberOrString.md)\<`never`\>[]

The game's weapon hash, a numeric string, a weapon name (hashed with joaat), or an array of
those to give several.

##### ammo?

`number` \| `number`[]

The ammo, 100 by default. With an array of weapons, one number for all or an array in step.

#### Returns

`void`

#### Remarks

VI knows its own weapon names, not GTA V's: a GTA V name hashes to a weapon the game does not have
(nothing appears); take the hashes from VI. The server keeps the weapon and
the client puts it in the player's hand about a second later (the built-in client event `sixl:giveWeapon`).

#### Example

```ts
player.giveWeapon(weaponHash, 60);
```

***

### hasPendingProc()

> **hasPendingProc**(`procName`): `boolean`

Whether a call to a client procedure is still waiting for the answer.

#### Parameters

##### procName

`string`

The procedure's name.

#### Returns

`boolean`

True when a [PlayerMp.callProc](#callproc) of that name is pending.

#### Example

```ts
if (!player.hasPendingProc('getFps')) { }
```

***

### isStreamed()

> **isStreamed**(`player`): `boolean`

Whether another player is streamed in for this player.

#### Parameters

##### player

`PlayerMp`

The other player.

#### Returns

`boolean`

True when the other player is within the streaming range (the server's `streamingRange`, 200 m by
default, 3D distance) and in the same dimension (dimension 0 counts as global). False for the player itself.

#### Remarks

Partial: an estimate from the positions the script host knows, not the server's real stream list
(in a crowd the server streams fewer).

#### Example

```ts
if (player.isStreamed(other)) { }
```

***

### kick()

> **kick**(`reason?`): `void`

Disconnects the player with a reason.

#### Parameters

##### reason?

`string`

The reason shown to the player (default `'Kicked'`).

#### Returns

`void`

#### Example

```ts
player.kick('AFK');
```

***

### kickSilent()

> **kickSilent**(): `void`

Disconnects the player without a reason and without the `kicked` event.

#### Returns

`void`

#### Example

```ts
player.kickSilent();
```

***

### notify()

> **notify**(`message`): `void`

Shows a notification to the player.

#### Parameters

##### message

`string`

The text.

#### Returns

`void`

#### Remarks

Partial: VI has no notification feed, so the text is shown as a line in the player's built-in chat;
the client scripts also get the `notify` event with it, for a mode that draws its own.

#### Example

```ts
player.notify('Job done');
```

***

### outputChatBox()

> **outputChatBox**(`message`): `void`

Shows a line in the player's chat.

#### Parameters

##### message

`string`

The text.

#### Returns

`void`

#### Remarks

The line appears in the player's built-in chat (T opens it), like a line of `mp.players.broadcast`
sent to this player only.

#### Example

```ts
player.outputChatBox('Welcome!');
```

***

### playAnimation()

> **playAnimation**(`dict`, `name`, `speed?`, `flag?`): `void`

Plays an animation.

#### Parameters

##### dict

`string`

The animation dictionary.

##### name

`string`

The animation name.

##### speed?

`number`

The speed (default 8).

##### flag?

`number`

The animation flags (default 0).

#### Returns

`void`

#### Remarks

Partial: remembered by the server only; no packet reaches the clients, so nothing plays yet.

#### Example

```ts
player.playAnimation('amb@world_human_cheering', 'base', 8, 1);
```

***

### playScenario()

> **playScenario**(`scenario`): `void`

Plays a scenario.

#### Parameters

##### scenario

`string`

The scenario name.

#### Returns

`void`

#### Remarks

Partial: remembered by the server only; no packet reaches the clients, so nothing plays yet.

#### Example

```ts
player.playScenario('smoking');
```

***

### putIntoVehicle()

> **putIntoVehicle**(`vehicle`, `seat?`): `void`

Seats the player in a vehicle.

#### Parameters

##### vehicle

[`VehicleMp`](../../vehicle/interfaces/VehicleMp.md)

The vehicle.

##### seat?

`number`

The seat, 0 = driver (default 0).

#### Returns

`void`

#### Remarks

Partial: server-side seat state only. The client is not put in the vehicle and its next state report
overwrites this.

#### Example

```ts
player.putIntoVehicle(vehicle, 0);
```

***

### removeAllWeapons()

> **removeAllWeapons**(): `void`

Takes every weapon away.

#### Returns

`void`

#### Remarks

Partial: the server's list is cleared; the game does not take the weapons away yet.

#### Example

```ts
player.removeAllWeapons();
```

***

### removeFromVehicle()

> **removeFromVehicle**(): `void`

Takes the player out of the vehicle.

#### Returns

`void`

#### Remarks

Partial: server-side seat state only; the client is not taken out of the vehicle.

#### Example

```ts
player.removeFromVehicle();
```

***

### removeWeapon()

> **removeWeapon**(`weaponHash`): `void`

Takes one weapon away.

#### Parameters

##### weaponHash

`number`

The weapon's game hash (a number; names are not converted).

#### Returns

`void`

#### Remarks

Partial: the server's list changes; the game does not take the weapon away yet.

#### Example

```ts
player.removeWeapon(weaponHash);
```

***

### setClothes()

> **setClothes**(`component`, `drawable`, `texture`, `palette?`): `void`

Sets a clothes component.

#### Parameters

##### component

`number`

The component slot.

##### drawable

`number`

The drawable id.

##### texture

`number`

The texture id.

##### palette?

`number`

The palette (default 0).

#### Returns

`void`

#### Remarks

Partial: kept on the server and sent to the owner's client, but the game does not apply it. VI's
outfits do not map one to one onto GTA V's component slots; [PlayerMp.look](#look) sets the whole outfit.

#### Example

```ts
player.setClothes(11, 5, 0, 0);
```

***

### setCustomization()

> **setCustomization**(`gender`, `shapeFirst`, `shapeSecond`, `shapeThird`, `skinFirst`, `skinSecond`, `skinThird`, `shapeMix`, `skinMix`, `thirdMix`, `eyeColor`, `hairColor`, `faceFeatures`): `void`

Sets the whole character look at once.

#### Parameters

##### gender

`boolean`

True for male, false for female.

##### shapeFirst

`number`

First face shape id.

##### shapeSecond

`number`

Second face shape id.

##### shapeThird

`number`

Third face shape id.

##### skinFirst

`number`

First skin tone id.

##### skinSecond

`number`

Second skin tone id.

##### skinThird

`number`

Third skin tone id.

##### shapeMix

`number`

Mix of the first two shapes, 0..1.

##### skinMix

`number`

Mix of the first two skin tones, 0..1.

##### thirdMix

`number`

Weight of the third shape and skin, 0..1.

##### eyeColor

`number`

The eye colour index.

##### hairColor

`number`

The hair colour index.

##### faceFeatures

`number`[]

The face feature values, -1..1 each.

#### Returns

`void`

#### Remarks

Partial: kept on the server and sent to the client, but the game does not apply it yet. Unlike RAGE MP
there is no hair highlight colour
parameter: `faceFeatures` is the 13th argument, not the 14th.

#### Example

```ts
player.setCustomization(true, 0, 21, 0, 0, 21, 0, 0.5, 0.5, 0, 3, 5, new Array(20).fill(0));
```

***

### setDecoration()

> **setDecoration**(`collection`, `overlay`): `void`

Adds a decoration (tattoo, badge).

#### Parameters

##### collection

`number`

The collection's joaat hash.

##### overlay

`number`

The overlay's joaat hash.

#### Returns

`void`

#### Remarks

Partial: the owner gets a `setDecoration` event and the full list goes to the players who stream the
player in later, but the game does not apply it yet. Adding the same pair twice keeps one.

#### Example

```ts
player.setDecoration(mp.joaat('mpbusiness_overlays'), mp.joaat('MP_Buis_M_Neck_000'));
```

***

### setFaceFeature()

> **setFaceFeature**(`index`, `scale`): `void`

Sets one face feature.

#### Parameters

##### index

`number`

The feature, 0..19 (nose width, chin height …).

##### scale

`number`

The value, -1..1.

#### Returns

`void`

#### Remarks

Partial: kept on the server and sent to the owner's client one value at a time, but the game does not
apply it yet.

#### Example

```ts
player.setFaceFeature(0, 0.5);
```

***

### setHairColor()

> **setHairColor**(`color`, `highlightColor`): `void`

Sets the hair colours.

#### Parameters

##### color

`number`

The hair colour index.

##### highlightColor

`number`

The highlight colour index.

#### Returns

`void`

#### Remarks

Partial: sent to the clients as data (`sixl:hair`); the game does not show it yet.

#### Example

```ts
player.setHairColor(5, 2);
```

***

### setHeadBlend()

#### Call Signature

> **setHeadBlend**(`shapeFirst`, `shapeSecond`, `shapeThird`, `skinFirst`, `skinSecond`, `skinThird`, `shapeMix`, `skinMix`, `thirdMix`): `void`

Sets the head blend: the face shapes and skin tones of the player's parents.

##### Parameters

###### shapeFirst

`number`

First face shape id.

###### shapeSecond

`number`

Second face shape id.

###### shapeThird

`number`

Third face shape id.

###### skinFirst

`number`

First skin tone id.

###### skinSecond

`number`

Second skin tone id.

###### skinThird

`number`

Third skin tone id.

###### shapeMix

`number`

Mix of the first two shapes, 0..1.

###### skinMix

`number`

Mix of the first two skin tones, 0..1.

###### thirdMix

`number`

Weight of the third shape and skin, 0..1.

##### Returns

`void`

##### Remarks

Partial: kept on the server and sent to the clients as data (`sixl:headBlend`); the game does not
show it yet. A non-number counts as 0.

##### Example

```ts
player.setHeadBlend(0, 21, 0, 0, 21, 0, 0.5, 0.5, 0);
```

#### Call Signature

> **setHeadBlend**(`shapes`, `skins`, `shapeMix`, `skinMix`, `thirdMix`): `void`

Sets the head blend from two arrays.

##### Parameters

###### shapes

`number`[]

The three face shape ids.

###### skins

`number`[]

The three skin tone ids.

###### shapeMix

`number`

Mix of the first two shapes, 0..1.

###### skinMix

`number`

Mix of the first two skin tones, 0..1.

###### thirdMix

`number`

Weight of the third shape and skin, 0..1.

##### Returns

`void`

##### Remarks

Partial: as in the nine-number form.

##### Example

```ts
player.setHeadBlend([0, 21, 0], [0, 21, 0], 0.5, 0.5, 0);
```

#### Call Signature

> **setHeadBlend**(`blend`): `void`

Sets the head blend from an object.

##### Parameters

###### blend

[`HeadBlend`](HeadBlend.md)

The same as [PlayerMp.getHeadBlend](#getheadblend) returns.

##### Returns

`void`

##### Remarks

Partial: as in the nine-number form.

##### Example

```ts
player.setHeadBlend({ shapes: [0, 21, 0], skins: [0, 21, 0], shapeMix: 0.5, skinMix: 0.5, thirdMix: 0 });
```

***

### setHeadOverlay()

> **setHeadOverlay**(`overlay`, `value`): `void`

Sets a head overlay (blemishes, facial hair, eyebrows …).

#### Parameters

##### overlay

`number`

The overlay slot, 0..12.

##### value

`number`[]

`[overlayValue, opacity, colorType, color]`; the last two default to 0.

#### Returns

`void`

#### Remarks

Partial: kept on the server and sent to the owner's client, but the game does not apply it yet.

#### Example

```ts
player.setHeadOverlay(1, [2, 1, 1, 0]);
```

***

### setOwnVariable()

> **setOwnVariable**(`key`, `value`): `void`

Sets a variable that only this player's own client receives.

#### Parameters

##### key

`string`

The variable's key.

##### value

`any`

Any JSON-serialisable value.

#### Returns

`void`

#### Remarks

Only players send it: the client reads it with `mp.players.local.getOwnVariable(key)`. On vehicles,
peds and objects it is kept in the script host only.

#### Example

```ts
player.setOwnVariable('token', 'abc');
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`setOwnVariable`](../../entity/interfaces/EntityMp.md#setownvariable)

***

### setOwnVariables()

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

Sets several own variables; the same as [EntityMp.setOwnVariable](../../entity/interfaces/EntityMp.md#setownvariable) for each key.

#### Parameters

##### values

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

An object of key to value.

#### Returns

`void`

#### Example

```ts
player.setOwnVariables({ token: 'abc', slot: 2 });
```

#### Inherited from

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`setOwnVariables`](../../entity/interfaces/EntityMp.md#setownvariables)

***

### setProp()

> **setProp**(`prop`, `drawable`, `texture`): `void`

Sets a prop (hat, glasses …).

#### Parameters

##### prop

`number`

The prop slot.

##### drawable

`number`

The drawable id (-1 removes the prop).

##### texture

`number`

The texture id.

#### Returns

`void`

#### Remarks

Partial: kept on the server and sent to the owner's client, but the game does not apply it yet.

#### Example

```ts
player.setProp(0, 12, 0);
```

***

### 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

[`EntityMp`](../../entity/interfaces/EntityMp.md).[`setVariable`](../../entity/interfaces/EntityMp.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

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

***

### setWeaponAmmo()

> **setWeaponAmmo**(`weaponHash`, `ammo`): `void`

Sets the ammo of a weapon.

#### Parameters

##### weaponHash

`number`

The weapon's game hash (a number).

##### ammo

`number`

The ammo.

#### Returns

`void`

#### Remarks

Partial: kept on the server ([PlayerMp.getWeaponAmmo](#getweaponammo) answers it); the game's ammo does not change
yet.

#### Example

```ts
player.setWeaponAmmo(hash, 200);
```

***

### spawn()

> **spawn**(`position`, `heading?`): `void`

Spawns the player: teleports to a position and restores full health.

#### Parameters

##### position

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

Where to spawn (metres).

##### heading?

`number`

Optional. The heading to face, in degrees.

#### Returns

`void`

#### Example

```ts
player.spawn(new mp.Vector3(0, 0, 70), 90);
```

***

### stopAnimation()

> **stopAnimation**(): `void`

Stops the animation.

#### Returns

`void`

#### Remarks

Partial: clears what the server remembered; clients are not told.

#### Example

```ts
player.stopAnimation();
```

***

### updateHeadBlend()

> **updateHeadBlend**(`shapeMix`, `skinMix`, `thirdMix`): `void`

Changes the mixes of the head blend and keeps the ids.

#### Parameters

##### shapeMix

`number`

Mix of the first two shapes, 0..1.

##### skinMix

`number`

Mix of the first two skin tones, 0..1.

##### thirdMix

`number`

Weight of the third shape and skin, 0..1.

#### Returns

`void`

#### Remarks

Partial: kept on the server and sent as data; the game does not show it yet.

#### Example

```ts
player.updateHeadBlend(0.7, 0.3, 0);
```
