SixL client API / game/object / GameObjectMp

Interface: GameObjectMp

The object functions: searches for objects, object damage and state, and door objects.

Remarks

Getters are asynchronous: they return a Promise. A model is its name or its hash (mp.joaat of the name), resolved by SixL as for mp.game.streaming. A pickup is given as an entity or its handle.

Example

const broken = await mp.game.object.hasBeenBroken(object, false);

Methods

doesObjectOfTypeExistAtCoords()

doesObjectOfTypeExistAtCoords(x, y, z, radius, hash, p5): Promise<boolean>

Whether an object of a model exists within a radius of a point.

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 search radius, in metres.

hash

string | number

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

p5

boolean

A flag of the game, the same as the search it wraps.

Returns

Promise<boolean>

A Promise of true when such an object exists.

Example

const found = await mp.game.object.doesObjectOfTypeExistAtCoords(0, 0, 70, 5, mp.joaat('<model name>'), false);

doesOfTypeExistAtCoords()

doesOfTypeExistAtCoords(x, y, z, radius, hash, p5): Promise<boolean>

The same search as doesObjectOfTypeExistAtCoords.

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 search radius, in metres.

hash

string | number

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

p5

boolean

A flag of the game, the same as the search it wraps.

Returns

Promise<boolean>

A Promise of true when such an object exists.

Example

const found = await mp.game.object.doesOfTypeExistAtCoords(0, 0, 70, 5, mp.joaat('<model name>'), false);

doesPickupExist()

doesPickupExist(pickup): Promise<boolean>

Whether a pickup exists (it is not collected and not removed).

Parameters

pickup

number | { handle: number; }

The pickup, or its handle.

Returns

Promise<boolean>

A Promise of true when the pickup exists.

Example

const exists = await mp.game.object.doesPickupExist(pickup);

doesPickupObjectExist()

doesPickupObjectExist(pickupObject): Promise<boolean>

Whether a pickup object exists (the object a portable pickup is made of).

Parameters

pickupObject

number | { handle: number; }

The object, or its handle.

Returns

Promise<boolean>

A Promise of true when the pickup object exists.

Example

const exists = await mp.game.object.doesPickupObjectExist(object);

doorSystemGetIsPhysicsLoaded()

doorSystemGetIsPhysicsLoaded(doorHash): Promise<boolean>

Whether the physics of a door object is loaded.

Parameters

doorHash

string | number

The door model's hash (a number) or its name.

Returns

Promise<boolean>

A Promise of true when the door's physics is loaded.

Example

const loaded = await mp.game.object.doorSystemGetIsPhysicsLoaded('<door name>');

getFragmentDamageHealth()

getFragmentDamageHealth(object, p1): Promise<number>

The same value as getObjectFragmentDamageHealth.

Parameters

object

number | { handle: number; }

The object, or its handle.

p1

boolean

A flag of the game, set to true for the default behaviour of this call.

Returns

Promise<number>

A Promise of the fragment damage health, as a number.

Example

const health = await mp.game.object.getFragmentDamageHealth(object, true);

getObjectFragmentDamageHealth()

getObjectFragmentDamageHealth(object, p1): Promise<number>

The health of an object's fragments (the parts a breakable object splits into).

Parameters

object

number | { handle: number; }

The object, or its handle.

p1

boolean

A flag of the game, set to true for the default behaviour of this call.

Returns

Promise<number>

A Promise of the fragment damage health, as a number.

Example

const health = await mp.game.object.getObjectFragmentDamageHealth(object, true);

hasBeenBroken()

hasBeenBroken(object, p1): Promise<boolean>

Whether an object has been broken (destroyed by damage).

Parameters

object

number | { handle: number; }

The object, or its handle.

p1

number | boolean

A flag of the game, set to true for the default behaviour of this call.

Returns

Promise<boolean>

A Promise of true when the object has been broken.

Example

const broken = await mp.game.object.hasBeenBroken(object, true);

isDoorClosed()

isDoorClosed(doorHash): Promise<boolean>

Whether a door is closed.

Parameters

doorHash

string | number

The door model's hash (a number) or its name.

Returns

Promise<boolean>

A Promise of true when the door is closed.

Example

const closed = await mp.game.object.isDoorClosed('<door name>');

placeOnGroundProperly()

placeOnGroundProperly(object): Promise<boolean>

Places an object on the ground, aligned to the surface under it.

Parameters

object

number | { handle: number; }

The object, or its handle.

Returns

Promise<boolean>

A Promise of true when the object was placed.

Example

const placed = await mp.game.object.placeOnGroundProperly(object);

preventCollectionOfPortablePickup()

preventCollectionOfPortablePickup(object, p1, p2): void

Stops a portable pickup from being collected by players.

Parameters

object

number | { handle: number; }

The pickup object, or its handle.

p1

boolean

A flag of the game, set to true for the default behaviour of this call.

p2

boolean

A flag of the game, set to true for the default behaviour of this call.

Returns

void

Example

mp.game.object.preventCollectionOfPortablePickup(object, true, true);

setAllowLowLodBuoyancy()

setAllowLowLodBuoyancy(object, toggle): void

Lets an object use the low level-of-detail buoyancy (the simpler water physics for it).

Parameters

object

number | { handle: number; }

The object, or its handle.

toggle

boolean

true to allow the low level-of-detail buoyancy, false to disallow it.

Returns

void

Example

mp.game.object.setAllowLowLodBuoyancy(object, true);

setForceObjectThisFrame()

setForceObjectThisFrame(x, y, z, p3): void

Forces the objects around a point to be loaded and updated on this frame.

Parameters

x

number

The X coordinate, in metres.

y

number

The Y coordinate, in metres.

z

number

The Z coordinate, in metres.

p3

number

A radius-like value of the game, as a number.

Returns

void

Example

mp.game.object.setForceObjectThisFrame(0, 0, 70, 5);

setTargettable()

setTargettable(object, targettable): void

Sets whether an object can be targeted by weapons (aimed at and shot).

Parameters

object

number | { handle: number; }

The object, or its handle.

targettable

boolean

true to make the object targettable, false to make it not.

Returns

void

Example

mp.game.object.setTargettable(object, false);