Examples

Some of good examples

In general, examples are given on the client side. Because playing on the server side works in the same way. Only the first parameter is must be a source id

Play sound via file

local coords = GetEntityCoords(PlayerPedId())
local soundId = exports['mx-surround']:Play(nil, '/ui/sounds/beltalarm.ogg', coords)

Play sound via url (Youtube, Spotify, SoundCloud)

local coords = GetEntityCoords(PlayerPedId())
local url = 'https://www.youtube.com/watch?v=RP0_8J7uxhs&ab_channel=RHINO'
local soundId = exports['mx-surround']:Play(nil, url, coords)

Play sound via another resource

local path = 'https://cfx-nui-qs-smartphone-pro/'
local sound_path = path .. 'html/sounds/test.mp3'
local soundId = exports['mx-surround']:Play(nil, sound_path, coords)

Play sound in an interior (with special 3d properties)

What we do is that the sound gets more out and the sound behavior changes. So you don't need to specify whether a sound is interior or not. Script detects it directly.

Don't think this complicated. You can do it without special panner.


Attach a sound to an entity


Attach a sound to a player

The difference from attachEntity is that it detects whether the player is getting into the car or not. And performs filtering.


Add handler to a sound

Another way to add handler to a sound


Play Async (Server Side)

Last updated

Was this helpful?