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 soundId = exports['mx-surround']:Play(nil, 'https://www.youtube.com/watch?v=RP0_8J7uxhs&ab_channel=RHINO', 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.
local url ='https://www.youtube.com/watch?v=r2LpOUwca94&ab_channel=MajorLazerOfficial'local unicornLocation =vec(108.65, -1288.81, 28.86) -- Vanilla Unicorn' locationlocal panner = { panningModel ='HRTF', -- https://developer.mozilla.org/en-US/docs/Web/API/PannerNode refDistance =20.0, -- Distance of the volume dropoff start rolloffFactor =1.8, -- How fast the volume drops off distanceModel ='exponential', -- How the volume drops off (linear, inverse, exponential) coneInnerAngle = 360.0, -- https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/coneInnerAngle
coneOuterAngle = 0.0, -- https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/coneOuterAngle
}exports['mx-surround']:Play(nil, url, unicornLocation, false, 1.0, panner)
Don't think this complicated. You can do it without special panner.