Author Topic: client sidedly play audio files?  (Read 1141 times)

like the client>playsound event.

What I want to do is something like
if(%msg $= "play music")
       {
          have it play a sound here
        }

I think it is alxPlay(AudioProfileDatablock); and alxStop(AudioProfileDatablock);

Probably use a global variable in case you want to stop it.

Do i just replace AudioProfileDatablock with whatever sound I want to play?

Do i just replace AudioProfileDatablock with whatever sound I want to play?
As long as it is a datablock and a "AudioProfile" class.

Your request is far too unclear.

Do you want a server mod or a client mod? Do you want it so that, on your server, when someone says "play music" music will play? Or do you want it so that when you are playing on any other server and YOU say "play music" music will play for you?

If you want to play music to a client on a server, call GameConnection::play2d( audioprofiledatablock )

If you want to play music to yourself, regardless of what server you're on, call alxPlay( audioprofiledatablock )

Do you want to play music or a sound? If you want to play music, ensure the .ogg file is in Add-Ons/Music and use musicData_Name as the audio profile datablock. If you want to play a sound, you're going to have to create your own datablock.

Would this work?
Code: [Select]
package music
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);

if(%msg $= "playtest")
{
alxPlay(musicData_After_School_Special.ogg);
}
}
};
activatepackage(music);

musicData_After_School_Specia l is the datablock.

Code: [Select]
if(%msg $= "playtest")
{
alxPlay(musicData_After_School_Special);
}
This should work.

musicData_After_School_Special is the datablock.

Code: [Select]
if(%msg $= "playtest")
{
alxPlay(musicData_After_School_Special);
}
This should work.
Nothing plays when I say playtest.
No error in the console either.

Nothing plays when I say playtest.
No error in the console either.
I'm not sure you can play the music datablocks directly from the client. You would have to make your own audio datablock with your own file.

I'm not sure you can play the music datablocks directly from the client. You would have to make your own audio datablock with your own file.
So I put the .ogg in the addon folder?


So I put the .ogg in the addon folder?
You'd just have to make an audio datablock using the file so that it can be played.

You'd just have to make an audio datablock using the file so that it can be played.
How would I go about doing this?