AudioClient

setMicrophonePosition

SET_MICROPHONE_POSITION0xB6AE90EDDE95C762

The GTA V native SET_MICROPHONE_POSITION of the AUDIO namespace, as LS:MP client scripts call it: the global function setMicrophonePosition, in JavaScript and in Lua.

SignatureJavaScript
setMicrophonePosition(
  toggle: boolean,
  x1: number,
  y1: number,
  z1: number,
  x2: number,
  y2: number,
  z2: number,
  x3: number,
  y3: number,
  z3: number
): void
SignatureLua
setMicrophonePosition(
  toggle: boolean,
  x1: number,
  y1: number,
  z1: number,
  x2: number,
  y2: number,
  z2: number,
  x3: number,
  y3: number,
  z3: number
)

Usage

JavaScript
setMicrophonePosition(toggle, x1, y1, z1, x2, y2, z2, x3, y3, z3);
Lua
setMicrophonePosition(toggle, x1, y1, z1, x2, y2, z2, x3, y3, z3)

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
setMicrophonePosition(toggle, pos1, pos2, pos3);
Lua · with vectors
setMicrophonePosition(toggle, pos1, pos2, pos3)

Parameters

ParameterTypeJavaScriptLua
toggleBOOLbooleanboolean
x1floatnumbernumber
y1floatnumbernumber
z1floatnumbernumber
x2floatnumbernumber
y2floatnumbernumber
z2floatnumbernumber
x3floatnumbernumber
y3floatnumbernumber
z3floatnumbernumber

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

This native controls where the game plays audio from. By default the microphone is positioned on the player.
When p0 is true the game will play audio from the 3 positions inputted.
It is recommended to set all 3 positions to the same value as mixing different positions doesn't seem to work well.
The scripts mostly use it with only one position such as in fbi3.c:

setMicrophonePosition(true, getEntityCoords(iLocal_3091, true), getEntityCoords(iLocal_3091, true), getEntityCoords(iLocal_3091, true));

Reference

Namespace
Audio AUDIO
In the game
void SET_MICROPHONE_POSITION(BOOL toggle, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
Hash
0xB6AE90EDDE95C762

Open in the interactive natives reference