Jump to content
Sign in to follow this  
Zombitch

How to playMusic and Say function execute on all player client ?

Recommended Posts

Hello,

I would like to playMusic and to execute say function on each client.

In fact when a player do a certain action, it's activating this line :

guardenKeeper say "willEnableLightHouseSound";

The thing is this function is only "played" on the player who did the action, the other players won't heard what guardenKeeper said whereas I would like all player near the guardenKeeper hear what he said.

I gooogled a bit and found I could use RemoteExecution or BIS_fnc_MP, but I didn't understand the real difference between both functions.

Does anyone have any example to show me how to make it work ?

Thanks a lot.

Regards,

Zombitch

Share this post


Link to post
Share on other sites

ive never used 'say' function, but this is the code for each west player on server to see a hint

if (side player == west) then {hint "This appears for players on BLUFOR in their hints.";};

maybe u can convert for say function?

as for the track u will need to execute a script ingame which contains the track. do not execute on server with if(isServer) because then the it wil only play on server and no on will hear it.

so, u need to execute the script, we will call it 'soundtrack.sqf'

in ur soundtrack.sqf script u need this line:

playMusic "track1";

in ur description.ext u need these lines:

class cfgMusic

{

class track1

{

name = "track1";

sound[] = {"sounds\NAMEOFTRACK.ogg", db+1, 1};

};

};

u need a .ogg music file in 'sounds' folder within ur mission folder

Share this post


Link to post
Share on other sites

@Azer1234

Thanks but it don't work.

I tried a lot of thing and the only thing that works is the following :

I am using the BIS_fnc_MP function.

So first I created a new sqf file (playMusicMP.sqf) with the following content :

private["_object"];
_musicName = _this select 0;
playMusic _musicName;

And in order to play music on each client I use the BIS_fnc_MP :

_null = [[["readyToWarMusic"],"MPFunctions\playMusicMP.sqf"],"BIS_fnc_execVM",nil,true] call BIS_fnc_MP;

(readyToWarMusic is the music I declared in the description.ext file (in cfgMusic part))

Hope it will help someone else.

Bye.

Share this post


Link to post
Share on other sites

Don't use BIS_fnc_MP for this, it's not needed. Use publicVariableEventHandlers as shown here. That way all you're doing is passing a word as opposed to having everyone on the server and who will ever join the server run a script.

Share this post


Link to post
Share on other sites

@kylania

Thanks, I modified my code according to your advice.

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  

×