Author Topic: Playing a 2D sound to everyone  (Read 1202 times)

For some reason, I can't get a 2D sound to play to everyone in the server.
What I've currently got is as follows.
Code: [Select]
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);

if(isObject(%cl.player))
{
%cl.play2d(shoutingmuffinbakerSound);
}
}
Any points/suggestions/fixes/other stuff are appreciated.

You don't really need the isObject, not really helpful but :D, also with the isObject(%cl.player) if they Self Delete they won't here the sound while dead.

Code: [Select]
for(%i = 0; %i < ClientGroup.getCount(); %i++){
   %cl = ClientGroup.getObject(%i);
   %cl.play2d(shoutingmuffinbakerSound);
}

The best way to do it is by using a message callback, but it requires client-side code.  I imagine that's what Badspot's code does when you call %client.play2D().
« Last Edit: April 14, 2008, 07:29:22 PM by Trader »


Never mind, I forgot return();'s in a switch.
ServerPlay2D(sound); is used in the mid air'd script to play a sound to a client.

Oh god Hideous told me about this you bastard lawl.