Author Topic: Is there a way to make the server play a sound?  (Read 1958 times)

I was thinking about making an announce script play a sound when it's done, but I need to know how to make the server play a sound for everyone to hear when the command is used.
Similar to the connect/disconnect sounds and whatnot.

Umm i know how to make it play a sound but, i dont know how to make it play that sound
Code: [Select]
messageall('Sound',"MSG");

Umm i know how to make it play a sound but, i dont know how to make it play that sound
Code: [Select]
messageall('Sound',"MSG");
That didn't help at all.

ServerPlay2D(%profile)
%profile being the audio profile.

ServerPlay2D(%profile)
%profile being the audio profile.
Audio profile being the filepath?

I'm not sure if a filepath would work.

Look at any sound add-on on how to make audio profiles.

I'm not sure if a filepath would work.

Look at any sound add-on on how to make audio profiles.
K, thanks.
I'll post back here if I don't understand something.

Edit:
Correct me if I'm wrong, but shouldn't the ServerPlay2D(%p) have a semicolon after the closing parenthesis?
« Last Edit: September 27, 2009, 05:00:38 PM by Niliscro »

It uses gameconnection::play2D, which I believe supports filepaths.

It uses gameconnection::play2D, which I believe supports filepaths.
So I should be able to do
Code: [Select]
ServerPlay2D("./base/data/sound/Admin.wav")
?

Not with that ./  there.
That only works while doing an exec. (Example, base/lolfile.cs was execed, ./ will be base/)

But instead of asking, why don't you test it first?

Not with that ./  there.
That only works while doing an exec. (Example, base/lolfile.cs was execed, ./ will be base/)

But instead of asking, why don't you test it first?
Because I'm pressed for time atm.

Edit:
ServerPlay2D(%p) needs a semicolon, and filepaths don't seem to work.
« Last Edit: September 27, 2009, 05:26:08 PM by Niliscro »

No, it doesn't need a semicolon. Ends of lines that aren't conditionals, functions, or loops need semicolons.
I am not coding I'm giving you the function name.

And no it does not work with filepaths, sadly.
Oh well if you use a profile people can download it when they join.

No, it doesn't need a semicolon. Ends of lines that aren't conditionals, functions, or loops need semicolons.
I am not coding I'm giving you the function name.

And no it does not work with filepaths, sadly.
Oh well if you use a profile people can download it when they join.
I figured it needed one becasue I was getting an error halt at the closing bracket of my if statement, which usually indicates you forgeted up inside the statement somewhere.

Also, did I do this right?  I'm not getting any sounds when I do it, and I don't want to make people download a sound they have already.

Code: [Select]
datablock AudioProfile(PlayerLeave)
{
filename = "base/data/sounds/playerLeave.wav";
description = AudioClosest3d;
preload = false;
};

Strange, doing serverplay2d(Beep_TryAgain_Sound); works but serverplay2d(PlayerLeave); wont. Try preload = true;
And no, they wont have to redownload it if they already have it.

Edit: Could not locate sound file: base/data/sounds/playerLeave.wav (download failed)
Edit2: Change /sounds/ to /sound/
« Last Edit: September 27, 2009, 05:50:35 PM by Chrono »

Strange, doing serverplay2d(Beep_TryAgain_Sound); works but serverplay2d(PlayerLeave); wont. Try preload = true;
And no, they wont have to redownload it if they already have it.

Edit: Could not locate sound file: base/data/sounds/playerLeave.wav (download failed)
The sound playerLeave isn't used in any accessible script, so it doesn't have an audio profile.  That's why I was trying to create one, but I couldn't get the filepath right, or it just won't play the sound.

Edit2: Change /sounds/ to /sound/
Ohai
« Last Edit: September 27, 2009, 05:51:48 PM by Niliscro »