M MY Multiplayer: Wiki
Side
Kind

setSoundSpeaker

Client

Has a ped speak a sound: its mouth moves with the sound's level and, if the sound is 3D, it comes from the ped's head every frame.

bool setSoundSpeaker(sound sound, ped|false speaker)

Parameters

NameTypeDescription
soundsoundThe sound element, or a dui element for the browser's sound.
speakerped|falseThe ped or player who speaks the sound, or false for none.

Returns

true if the sound was found, false otherwise.

Example

local ped = createPed("male01", 2495.1, -1687.4, 13.5)
local line = playSound3D("voice/greeting.ogg", 2495.1, -1687.4, 13.5)
setSoundSpeaker(line, ped)
Coming from MTANot in MTA. It works like GTA V's PLAY_STREAM_FROM_PED.

See also