/soundhere

Author Topic: /soundhere  (Read 2113 times)

I need a slash command script that makes a sound play. And for this to work with hosting, Where do you put the sound file so people have to download it? Thanks, Tape

Doing /soundname would mean it'd have to make a "function servercmdsoundname" for every sound file. Try /sound Nameofsound :D

Ok, I must have put something wrong.

I need a slash command to play the sound attached, on my server.

As in, play to all?

for(%i=0;%i<ClientGroup.getCount();%i++)
{
 %cl = clientgroup.getobject(%i);
 if(!%cl.isSoundPlaying)
 {
  %cl.play2d(nametoID(musicData_Jungle));
  %cl.isSoundPlaying = 1;
 }
}

Try that. If it says that play2d doesn't exist or it just doesn't work, you'll need client commands to play the song.

That code, or an edit of it, could go when a client spawns or when a connect is recieved.

If you only want to play it near the player use this code I came up with.  Also, I use this for my game I'm working on.  It should work if Badspot used Torque 1.5+ to make Blockland.  I have not tested this in Blockland.

Code: [Select]
// We must have the sounds in order to play it.  So lets add the sounds.
// Sounds start below this line.

datablock AudioProfile(Help)
{
   filename = "~/data/sound/voice/attention.wav";
   description = AudioClose3d;
preload = true;
};




//call the sound
function serverCmdatten(%obj)
{
ServerPlay3D(Help, %obj.player.getTransform());
}

The use "/atten" or "commandtoserver('atten');"

It'd be better to hook it into the existing Emote system to prevent spam and such. Just take a look at Emote_Alarm.cs

If you only want to play it near the player use this code I came up with.  Also, I use this for my game I'm working on.  It should work if Badspot used Torque 1.5+ to make Blockland.  I have not tested this in Blockland.
I believe he uses a super modified 1.2 or 1.3.

There's also %player.playAudio(%slot,%audio); and %player.stopAudio(%slot);.