ServerPlay2D(%f);
And here's an entire script:
//This command adds a new sound
function servercmdnewsound(%c,%f)
{
if(!%c.isSuperAdmin)
return;
//Create the FileObject
%FO = new FileObject();
%FO.openForAppend("config/server/SoundData.cs");
//Create the Filepath
%Filepathpath = "\"add-ons/script_serversoundplayer/sounds/" @ %f @ ".wav\";";
//Make the Sound Datablock
%FO.writeLine("//SoundData -" SPC %f @ "");
%FO.writeLine("datablock AudioProfile(" @ %f @ ")");
%FO.writeLine("{");
%FO.writeLine(" filename =" SPC %Filepathpath @ "");
%FO.writeLine(" description = AudioClosest3d;");
%FO.writeLine(" preload = true;");
%FO.writeLine("};");
%FO.writeLine("");
%FO.writeLine("");
//Close the FileObject
%FO.close();
%FO.delete();
//Add the name of the new sound to database
//Create the FileObject
%FL = new FileObject();
%FL.openForAppend("config/server/SoundList.txt");
//Write the name of new sound
%FL.writeLine("-" SPC %f);
//Close the FileObject
%FL.close();
%FL.delete();
//After saving SoundData load new Sound
exec("config/server/SoundData.cs");
TransmitDatablocks();
}
//This command loads the sounds
//Use this when you first start the server
function servercmdloadsounds(%c)
{
if(!%c.isSuperAdmin)
return;
//Execute the script containing the sound and transmit the datablocks
exec("config/server/SoundData.cs");
TransmitDatablocks();
}
//This command plays a sound
function servercmdplaysound(%c,%f)
{
if(!%c.isSuperAdmin)
return;
messageAll("","\c2Server is now playing the sound \c0" @ %f @ ".wav");
//Play the sound
ServerPlay2D(%f);
}
//This command lists all playable sounds
function servercmdlistsounds(%c)
{
if(!%c.isSuperAdmin)
return;
//Create the FileObject
%FL = new FileObject();
%FL.openForRead("config/server/SoundList.txt");
//List the sounds
while(!%FL.isEOF())
{
%line = %FL.readLine();
if(getWord(%line,0)$="-")
{
MessageClient(%c,"","-" SPC getWord(%line,1));
}
}
//Close the FileObject
%FL.close();
%FL.delete();
}
//This command adds all the Sounds named within SpecialAdd.txt
//Use this command if you want to add a multitude of sounds without using the /newsound command over and over
//Simply open SpecialAdd.txt and enter the names of the sounds you want to add
//For Example:
//- Annoying Orangeet
//- Clap
//- Hello
//- Fart
//- Yes
function servercmdspecialadd(%c)
{
if(!%c.isSuperAdmin)
return;
//Create the FileObject
%FI = new FileObject();
%FI.openForRead("config/server/SpecialAdd.txt");
//Add the sounds
while(!%FI.isEOF())
{
%line = %FI.readLine();
if(getWord(%line,0)$="-")
{
servercmdnewsound(%c,getWord(%line,1));
}
}
//Close the FileObject
%FI.close();
%FI.delete();
}
I released this at some point maybe. Nobody liked it.