SixL client API / game/streaming / GameStreamingMp

Interface: GameStreamingMp

The streaming functions: request and release assets (models, animations, particle effects), collisions and focus.

Remarks

A model is a hash (mp.joaat of its name) or a name; SixL resolves it to the model of this build, and a model the build does not have is ignored. Names of animation dictionaries, clip sets and particle assets are hashed (joaat of the lower-cased name); a number is taken as the hash already. Requests take effect as the game loads the asset: check the has...Loaded functions before using it. Getters are asynchronous: they return a Promise.

Example

mp.game.streaming.requestAnimDict('amb@world_human_smoking@male@male_a@base');

Methods

clearFocus()

clearFocus(): void

Clears the focus set by setFocusArea or setFocusEntity.

Returns

void

Example

mp.game.streaming.clearFocus();

clearHdArea()

clearHdArea(): void

Clears the area set by setHdArea.

Returns

void

Example

mp.game.streaming.clearHdArea();

doesAnimDictExist()

doesAnimDictExist(animDict): Promise<boolean>

Whether an animation dictionary exists.

Parameters

animDict

string | number

The dictionary's name, or its hash.

Returns

Promise<boolean>

A Promise of true when the dictionary exists.

Example

const exists = await mp.game.streaming.doesAnimDictExist('amb@world_human_smoking@male@male_a@base');

hasAnimDictLoaded()

hasAnimDictLoaded(animDict): Promise<boolean>

Whether an animation dictionary is loaded.

Parameters

animDict

string | number

The dictionary's name, or its hash.

Returns

Promise<boolean>

A Promise of true when the dictionary is loaded.

Example

const loaded = await mp.game.streaming.hasAnimDictLoaded('amb@world_human_smoking@male@male_a@base');

hasAnimSetLoaded()

hasAnimSetLoaded(animSet): Promise<boolean>

Whether an animation set is loaded.

Parameters

animSet

string | number

The set's name, or its hash.

Returns

Promise<boolean>

A Promise of true when the set is loaded.

Example

const loaded = await mp.game.streaming.hasAnimSetLoaded('move_m@generic');

hasClipSetLoaded()

hasClipSetLoaded(clipSet): Promise<boolean>

Whether a clip set is loaded.

Parameters

clipSet

string | number

The clip set's name, or its hash.

Returns

Promise<boolean>

A Promise of true when the clip set is loaded.

Example

const loaded = await mp.game.streaming.hasClipSetLoaded('move_m@generic');

hasModelLoaded()

hasModelLoaded(model): Promise<boolean>

Whether a model is loaded into memory.

Parameters

model

string | number

The model: a name or a number.

Returns

Promise<boolean>

A Promise of true when the model is loaded.

Example

const loaded = await mp.game.streaming.hasModelLoaded(mp.joaat('<model name>'));

hasNamedPtfxAssetLoaded()

hasNamedPtfxAssetLoaded(fxName): Promise<boolean>

Whether a particle effect asset is loaded.

Parameters

fxName

string | number

The asset's name, or its hash.

Returns

Promise<boolean>

A Promise of true when the asset is loaded.

Example

const loaded = await mp.game.streaming.hasNamedPtfxAssetLoaded('core');

isModelAVehicle()

isModelAVehicle(model): Promise<boolean>

Whether a model is a vehicle.

Parameters

model

string | number

The model: a name or a number.

Returns

Promise<boolean>

A Promise of true for a vehicle model.

Example

const isVehicle = await mp.game.streaming.isModelAVehicle(mp.joaat('<model name>'));

isModelInCdimage()

isModelInCdimage(model): Promise<boolean>

Whether a model is stored in the game's data archive.

Parameters

model

string | number

The model: a name or a number.

Returns

Promise<boolean>

A Promise of true when the model is in the archive.

Example

const inArchive = await mp.game.streaming.isModelInCdimage(mp.joaat('<model name>'));

isModelValid()

isModelValid(model): Promise<boolean>

Whether a model is a valid model the game knows.

Parameters

model

string | number

The model: a name or a number.

Returns

Promise<boolean>

A Promise of true when the model is valid.

Example

const valid = await mp.game.streaming.isModelValid(mp.joaat('<model name>'));

isPlayerSwitchInProgress()

isPlayerSwitchInProgress(): Promise<boolean>

Whether a switch between player characters is in progress.

Returns

Promise<boolean>

A Promise of true while the switch runs.

Example

const switching = await mp.game.streaming.isPlayerSwitchInProgress();

newLoadSceneStartSphere()

newLoadSceneStartSphere(x, y, z, radius, p4): Promise<boolean>

Starts loading the world around a sphere; the game shows the load scene until it is loaded.

Parameters

x

number

The centre's X coordinate, in metres.

y

number

The centre's Y coordinate, in metres.

z

number

The centre's Z coordinate, in metres.

radius

number

The sphere's radius, in metres.

p4

number

A flag of the game, as an integer.

Returns

Promise<boolean>

A Promise of true when the load scene started.

Example

const started = await mp.game.streaming.newLoadSceneStartSphere(0, 0, 70, 50, 0);

newLoadSceneStop()

newLoadSceneStop(): void

Stops the load scene started by newLoadSceneStartSphere.

Returns

void

Example

mp.game.streaming.newLoadSceneStop();

removeAnimDict()

removeAnimDict(animDict): void

Marks an animation dictionary as no longer needed.

Parameters

animDict

string | number

The dictionary's name, or its hash.

Returns

void

Example

mp.game.streaming.removeAnimDict('amb@world_human_smoking@male@male_a@base');

removeAnimSet()

removeAnimSet(animSet): void

Marks an animation set as no longer needed.

Parameters

animSet

string | number

The set's name, or its hash.

Returns

void

Example

mp.game.streaming.removeAnimSet('move_m@generic');

removeClipSet()

removeClipSet(clipSet): void

Marks a clip set as no longer needed.

Parameters

clipSet

string | number

The clip set's name, or its hash.

Returns

void

Example

mp.game.streaming.removeClipSet('move_m@generic');

removeNamedPtfxAsset()

removeNamedPtfxAsset(fxName): void

Marks a particle effect asset as no longer needed.

Parameters

fxName

string | number

The asset's name, or its hash.

Returns

void

Example

mp.game.streaming.removeNamedPtfxAsset('core');

requestAdditionalCollisionAtCoord()

requestAdditionalCollisionAtCoord(x, y, z): void

Requests the additional collision around a point to be loaded.

Parameters

x

number

The X coordinate, in metres.

y

number

The Y coordinate, in metres.

z

number

The Z coordinate, in metres.

Returns

void

Example

mp.game.streaming.requestAdditionalCollisionAtCoord(0, 0, 70);

requestAnimDict()

requestAnimDict(animDict): void

Requests an animation dictionary to be loaded.

Parameters

animDict

string | number

The dictionary's name, or its hash.

Returns

void

Example

mp.game.streaming.requestAnimDict('amb@world_human_smoking@male@male_a@base');

requestClipSet()

requestClipSet(clipSet): void

Requests a clip set (a set of movement clips for peds) to be loaded.

Parameters

clipSet

string | number

The clip set's name, or its hash.

Returns

void

Example

mp.game.streaming.requestClipSet('move_m@generic');

requestCollisionAtCoord()

requestCollisionAtCoord(x, y, z): void

Requests the collision around a point to be loaded.

Parameters

x

number

The X coordinate, in metres.

y

number

The Y coordinate, in metres.

z

number

The Z coordinate, in metres.

Returns

void

Example

mp.game.streaming.requestCollisionAtCoord(0, 0, 70);

requestCollisionForModel()

requestCollisionForModel(model): void

Requests the collision of a model to be loaded.

Parameters

model

string | number

The model: a name or a number.

Returns

void

Example

mp.game.streaming.requestCollisionForModel(mp.joaat('<model name>'));

requestIpl()

requestIpl(iplName): void

Requests an IPL (a set of world or interior props) by its name, so that the game loads it.

Parameters

iplName

string

The IPL's name.

Returns

void

Example

mp.game.streaming.requestIpl('ch2_01');

requestModel()

requestModel(model): void

Requests a model to be loaded into memory.

Parameters

model

string | number

The model: its name, or its hash (mp.joaat of the name).

Returns

void

Example

mp.game.streaming.requestModel(mp.joaat('<model name>'));

requestNamedPtfxAsset()

requestNamedPtfxAsset(fxName): void

Requests a particle effect asset (a named set of particle effects) to be loaded.

Parameters

fxName

string | number

The asset's name, or its hash.

Returns

void

Example

mp.game.streaming.requestNamedPtfxAsset('core');

setFocusArea()

setFocusArea(x, y, z, offsetX, offsetY, offsetZ): void

Sets the streamer's focus area: the place whose surroundings are loaded first and in detail.

Parameters

x

number

The focus point's X coordinate, in metres.

y

number

The focus point's Y coordinate, in metres.

z

number

The focus point's Z coordinate, in metres.

offsetX

number

The X component of the focus offset, in the game's units.

offsetY

number

The Y component of the focus offset, in the game's units.

offsetZ

number

The Z component of the focus offset, in the game's units.

Returns

void

Example

mp.game.streaming.setFocusArea(0, 0, 70, 0, 0, 0);

setFocusEntity()

setFocusEntity(entity): void

Makes the streamer focus on an entity.

Parameters

entity

number | { handle: number; }

The entity, or its handle.

Returns

void

Example

mp.game.streaming.setFocusEntity(vehicle);

setFocusPosAndVel()

setFocusPosAndVel(x, y, z, offsetX, offsetY, offsetZ): void

The same as setFocusArea.

Parameters

x

number

The focus point's X coordinate, in metres.

y

number

The focus point's Y coordinate, in metres.

z

number

The focus point's Z coordinate, in metres.

offsetX

number

The X component of the focus offset, in the game's units.

offsetY

number

The Y component of the focus offset, in the game's units.

offsetZ

number

The Z component of the focus offset, in the game's units.

Returns

void

Example

mp.game.streaming.setFocusPosAndVel(0, 0, 70, 0, 0, 0);

setHdArea()

setHdArea(x, y, z, radius): void

Sets a sphere in which the game loads the highest level of detail.

Parameters

x

number

The centre's X coordinate, in metres.

y

number

The centre's Y coordinate, in metres.

z

number

The centre's Z coordinate, in metres.

radius

number

The sphere's radius, in metres.

Returns

void

Example

mp.game.streaming.setHdArea(0, 0, 70, 100);

setModelAsNoLongerNeeded()

setModelAsNoLongerNeeded(model): void

Marks a model as no longer needed, so the game may unload it.

Parameters

model

string | number

The model: a name or a number.

Returns

void

Example

mp.game.streaming.setModelAsNoLongerNeeded(mp.joaat('<model name>'));