SixL client API / game/hud / GameHudMp

Interface: GameHudMp

The heads-up display: blips on the map and the minimap, the waypoint and the busy spinner.

Remarks

Every getter returns a Promise. Positions are metres (x east, y north, z up). A blip is an integer handle.

Methods

addTextComponentFloat()

addTextComponentFloat(value, decimalPlaces): void

Adds a number with decimals to the text being made.

Parameters

value

number

The number.

decimalPlaces

number

How many decimals to write, 0..20.

Returns

void

Example

mp.game.hud.addTextComponentFloat(3.14159, 2);

addTextComponentFormattedInteger()

addTextComponentFormattedInteger(value, commaSeparated): void

Adds a whole number to the text being made, with thousands separators when asked.

Parameters

value

number

The number; its fraction is dropped.

commaSeparated

boolean

True to write 1,234,567.

Returns

void

Example

mp.game.hud.addTextComponentFormattedInteger(1234567, true);

addTextComponentInteger()

addTextComponentInteger(value): void

Adds a whole number to the text being made.

Parameters

value

number

The number; its fraction is dropped.

Returns

void

Example

mp.game.hud.addTextComponentInteger(42);

addTextComponentSubstringPlayerName()

addTextComponentSubstringPlayerName(text): void

Adds words to the text being made.

Parameters

text

string

The words.

Returns

void

Example

mp.game.hud.addTextComponentSubstringPlayerName('Hello');

addTextComponentSubstringTextLabel()

addTextComponentSubstringTextLabel(labelName): void

Adds a name to the text being made, as it is.

Parameters

labelName

string

The name, drawn as it is.

Returns

void

Example

mp.game.hud.addTextComponentSubstringTextLabel('SHOP');

beginTextCommandDisplayText()

beginTextCommandDisplayText(text): void

Starts a text: the components added next make up its words, and GameHudMp.endTextCommandDisplayText draws it.

Parameters

text

string

The kind of text. 'STRING' takes its words from the components; any other name with no components is drawn as it is.

Returns

void

Example

mp.game.hud.beginTextCommandDisplayText('STRING');

busyspinnerIsOn()

busyspinnerIsOn(): Promise<boolean>

Tells whether the busy spinner is showing.

Returns

Promise<boolean>

A Promise of true while the spinner shows.

Example

const busy = await mp.game.hud.busyspinnerIsOn();

busyspinnerOff()

busyspinnerOff(): void

Hides the busy spinner.

Returns

void

Example

mp.game.hud.busyspinnerOff();

clearHelp()

clearHelp(toggle): void

Clears the help text that is on screen.

Parameters

toggle

boolean

true to clear the help text.

Returns

void

Example

mp.game.hud.clearHelp(true);

doesBlipExist()

doesBlipExist(blip): Promise<boolean>

Tells whether a blip handle refers to a blip that exists.

Parameters

blip

number

The blip's handle.

Returns

Promise<boolean>

A Promise of true when the blip exists.

Example

const exists = await mp.game.hud.doesBlipExist(blip);

endTextCommandDisplayText()

endTextCommandDisplayText(x, y, p2?): void

Draws the text made with GameHudMp.beginTextCommandDisplayText on the screen, for this frame.

Parameters

x

number

Where it is drawn, as a fraction of the screen's width (0 left, 1 right).

y

number

Where it is drawn, as a fraction of the screen's height (0 top, 1 bottom).

p2?

number

Ignored.

Returns

void

Remarks

Call it every frame in the render event, as in RAGE MP: a text that is not drawn again disappears. It is drawn by SixL's overlay, above the game and below the browsers.

Example

mp.events.add('render', () => {
      mp.game.hud.setTextFont(4);
      mp.game.hud.beginTextCommandDisplayText('STRING');
      mp.game.hud.addTextComponentSubstringPlayerName('SixL');
      mp.game.hud.endTextCommandDisplayText(0.5, 0.1, 0);
    });

getBlipCoords()

getBlipCoords(blip): Promise<IVector3>

The position of a blip.

Parameters

blip

number

The blip's handle.

Returns

Promise<IVector3>

A Promise of the position in metres.

Example

const pos = await mp.game.hud.getBlipCoords(blip);

getBlipFromEntity()

getBlipFromEntity(entity): Promise<number>

The blip that belongs to an entity.

Parameters

entity

GameEntity

The entity.

Returns

Promise<number>

A Promise of the blip's handle (an integer).

Remarks

RAGE MP takes only the entity; the game's extra argument is passed as 0.

Example

const blip = await mp.game.hud.getBlipFromEntity(vehicle.handle);

getBlipInfoIdType()

getBlipInfoIdType(blip): Promise<number>

Returns the type of a blip, as the game codes it.

Parameters

blip

number

The blip's handle.

Returns

Promise<number>

A Promise of the blip type as an integer.

Example

const type = await mp.game.hud.getBlipInfoIdType(blip);

getNextBlipInfoId()

getNextBlipInfoId(blipSprite): Promise<number>

Finds the next blip whose sprite is the given one.

Parameters

blipSprite

number

The blip sprite's index.

Returns

Promise<number>

A Promise of the blip's handle as an integer, or -1 when there is no such blip.

Example

const blip = await mp.game.hud.getNextBlipInfoId(1);

hideComponentThisFrame()

hideComponentThisFrame(id): void

Hides a HUD component for the current frame only. Call it every frame to keep the component hidden.

Parameters

id

number

The HUD component's index.

Returns

void

Example

mp.game.hud.hideComponentThisFrame(6);

hideHudComponentThisFrame()

hideHudComponentThisFrame(id): void

Hides a HUD component for the current frame only. The same as GameHudMp.hideComponentThisFrame.

Parameters

id

number

The HUD component's index.

Returns

void

Example

mp.game.hud.hideHudComponentThisFrame(7);

isWaypointActive()

isWaypointActive(): Promise<boolean>

Tells whether a waypoint is set on the map.

Returns

Promise<boolean>

A Promise of true while a waypoint is active.

Example

const active = await mp.game.hud.isWaypointActive();

openReportugcMenu()

openReportugcMenu(): void

Opens the in-game menu for reporting user content.

Returns

void

Example

mp.game.hud.openReportugcMenu();

replaceColourWithRgba()

replaceColourWithRgba(hudColorIndex, r, g, b, a): void

Replaces a HUD colour with an RGBA colour.

Parameters

hudColorIndex

number

The HUD colour's index.

r

number

Red, 0..255.

g

number

Green, 0..255.

b

number

Blue, 0..255.

a

number

Alpha (opacity), 0..255.

Returns

void

Example

mp.game.hud.replaceColourWithRgba(116, 255, 0, 0, 255);

setBlipCoords()

setBlipCoords(blip, x, y, z): void

Moves a blip.

Parameters

blip

number

The blip's handle.

x

number

x in metres.

y

number

y in metres.

z

number

z in metres.

Returns

void

Example

mp.game.hud.setBlipCoords(blip, 100, -50, 72);

setBlipNameToPlayerName()

setBlipNameToPlayerName(blip, player): void

Makes a blip show the name of a player.

Parameters

blip

number

The blip's handle.

player

number

The player's index in the game, an integer.

Returns

void

Example

mp.game.hud.setBlipNameToPlayerName(blip, 0);

setBlipScale()

setBlipScale(blip, scale): void

Sets the size of a blip.

Parameters

blip

number

The blip's handle.

scale

number

The scale factor, 1 is normal size.

Returns

void

Example

mp.game.hud.setBlipScale(blip, 0.8);

setBlipSprite()

setBlipSprite(blip, sprite): void

Sets the icon of a blip.

Parameters

blip

number

The blip's handle.

sprite

string | number

The icon's id as a number, or its name (hashed).

Returns

void

Remarks

A name is hashed as a 32-bit hash of the lower-cased name; GTA V's weapon and model names are not the same keys in VI, so take the id from the game's own list when a number is known.

Example

mp.game.hud.setBlipSprite(blip, 1);

setHudColour()

setHudColour(hudColorIndex, r, g, b, a): void

Sets a HUD colour to an RGBA colour. The same as GameHudMp.replaceColourWithRgba.

Parameters

hudColorIndex

number

The HUD colour's index.

r

number

Red, 0..255.

g

number

Green, 0..255.

b

number

Blue, 0..255.

a

number

Alpha (opacity), 0..255.

Returns

void

Example

mp.game.hud.setHudColour(116, 255, 0, 0, 255);

setMinimapFowRevealCoordinate()

setMinimapFowRevealCoordinate(x, y, z): void

Reveals the minimap around a point (fog of war).

Parameters

x

number

x in metres.

y

number

y in metres.

z

number

z in metres.

Returns

void

Example

mp.game.hud.setMinimapFowRevealCoordinate(0, 0, 72);

setRadarZoom()

setRadarZoom(zoomLevel): void

Sets the zoom level of the minimap.

Parameters

zoomLevel

number

The zoom level, an integer on the game's zoom scale.

Returns

void

Example

mp.game.hud.setRadarZoom(1);

setTextCentre()

setTextCentre(align): void

Centres the next text on the position it is drawn at.

Parameters

align

boolean

True to centre it.

Returns

void

Example

mp.game.hud.setTextCentre(true);

setTextColour()

setTextColour(red, green, blue, alpha): void

Sets the colour of the next text.

Parameters

red

number

0..255.

green

number

0..255.

blue

number

0..255.

alpha

number

0..255, 255 is opaque.

Returns

void

Example

mp.game.hud.setTextColour(255, 255, 255, 255);

setTextDropshadow()

setTextDropshadow(distance, r, g, b, a): void

Gives the next text a drop shadow.

Parameters

distance

number

Ignored: the shadow has one size.

r

number

Ignored.

g

number

Ignored.

b

number

Ignored.

a

number

Ignored.

Returns

void

Example

mp.game.hud.setTextDropshadow(2, 0, 0, 0, 255);

setTextDropShadow()

setTextDropShadow(): void

Gives the next text a drop shadow.

Returns

void

Example

mp.game.hud.setTextDropShadow();

setTextEdge()

setTextEdge(edge, r, g, b, a): void

Gives the next text an outline.

Parameters

edge

number

Ignored: the outline has one size.

r

number

Ignored.

g

number

Ignored.

b

number

Ignored.

a

number

Ignored.

Returns

void

Example

mp.game.hud.setTextEdge(1, 0, 0, 0, 255);

setTextFont()

setTextFont(fontType): void

Sets the font of the next text drawn with GameHudMp.endTextCommandDisplayText.

Parameters

fontType

number

The font number, an integer.

Returns

void

Remarks

The text settings apply to the next text only; each text starts from the defaults again.

Example

mp.game.hud.setTextFont(4);

setTextJustification()

setTextJustification(justifyType): void

Sets how the next text is aligned to its position.

Parameters

justifyType

number

0 centred, 1 left, 2 right.

Returns

void

Example

mp.game.hud.setTextJustification(2);

setTextOutline()

setTextOutline(): void

Gives the next text an outline.

Returns

void

Example

mp.game.hud.setTextOutline();

setTextProportional()

setTextProportional(p0): void

Accepted for compatibility; it changes nothing.

Parameters

p0

boolean

Ignored.

Returns

void

Example

mp.game.hud.setTextProportional(true);

setTextRenderId()

setTextRenderId(renderId): void

Sets the render id used for text.

Parameters

renderId

number

The render target's id, an integer.

Returns

void

Example

mp.game.hud.setTextRenderId(1);

setTextRightJustify()

setTextRightJustify(toggle): void

Aligns the next text's right edge to the position it is drawn at.

Parameters

toggle

boolean

True to right-align it.

Returns

void

Example

mp.game.hud.setTextRightJustify(true);

setTextScale()

setTextScale(scale, size): void

Sets the size of the next text.

Parameters

scale

number

Unused: pass the same number as size.

size

number

The text's size, about 0.3 for small and 1 for large.

Returns

void

Example

mp.game.hud.setTextScale(0.4, 0.4);

setTextWrap()

setTextWrap(start, end): void

Sets where the next text wraps.

Parameters

start

number

Where the text area starts, as a fraction of the screen's width.

end

number

Where the text area ends, as a fraction of the screen's width; the text is drawn on one line when 0.

Returns

void

Example

mp.game.hud.setTextWrap(0, 0.9);

setWaypointOff()

setWaypointOff(): void

Removes the waypoint from the map.

Returns

void

Example

mp.game.hud.setWaypointOff();

triggerSonarBlip()

triggerSonarBlip(x, y, z, _radius?, _p4?): void

Triggers a sonar blip at a point.

Parameters

x

number

x in metres.

y

number

y in metres.

z

number

z in metres.

_radius?

number

Accepted for RAGE MP compatibility; ignored.

_p4?

number

Accepted for RAGE MP compatibility; ignored.

Returns

void

Example

mp.game.hud.triggerSonarBlip(0, 0, 72);

unlockMinimapAngle()

unlockMinimapAngle(): void

Unlocks the minimap's angle.

Returns

void

Example

mp.game.hud.unlockMinimapAngle();