Jump to content
Sign in to follow this  

Issues with custom playsound3d in multiplayer (dedicated)

Recommended Posts

I'm trying to get playSound3D to work in multiplayer but I'm struggling with some issues. What do I want to achieve?

I want to have a radio playing a station on an OP to set the mood for the mission.

The technical side:

I got the sound working in singleplayer and for the first client who joins the server. For all following clients the sound does not play correctly in a 3D environment but more like the playsound command so they hear it on both headphones regardless of their orientation.

The script is called once by the server in the init.sqf and is then executed on the clients via the cba globalExecute command. The path for the soundfile is set using Karels instructions.

if(isServer) then {
[] execVM "skripte\musik.sqf";

[-1, {
sleep 10;
    private "_arr";
    _arr = toArray str missionConfigFile;
    _arr resize (count _arr - 15);
    toString _arr
playSound3D [MISSION_ROOT + "sound\radio2.ogg", radio, false, getPos radio, 200, 1, 300];
] call CBA_fnc_globalExecute;

There also seems to be some issues with the volume and distance. Anything lower than volume 200 and distance 300 won't be audible at all with playSound3D.

Does anyone got it working on a dedicated yet?

Share this post

Link to post
Share on other sites
It seems to be fixed, can you post an example how to use this correctly ?

With your script above it didn`t seems to work on a dedi.

It may not work because he is using a CBA (a mod) function, so if you aren't running CBA it won't work. But what you need to do for vanilla usage is place all the code (minus the CBA call) in a function, then use BIS_fnc_MP.

[[parameterForYourFunctionHere],"yourFunctionName",true,false,false] call BIS_fnc_MP;

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this