Author Topic: Sound Command Help  (Read 334 times)

I need help with this sound command thing, when I type /thanks , there is no sound. The addon works, but there is no sound. It is a .wav file too. Maybe i typed this code wrong...Here it is. [UPDATED, but still doesnt work.]

Code: [Select]
//Datablock Sounds

datablock AudioProfile(Thanks)
{
filename = "./Thanks.wav";
description = AudioClosest3d;
preload = false;
};

//Package ThanksSound

package ThanksSound
{
function servercmdThanks(%client)
{
%client.lastThanksTime = $Sim::Time;
%pos = %client.player.gettransform();
if($Sim::Time - %client.lastThanksTime > 10000)
{
  %player.playAudio(soundThanks);
}
else
{
%client.chatMessage("\c6You are doing that too much.");
}
}
};
activatepackage(ThanksSound);

If you help this, I can give you this addon. Thanks.
« Last Edit: September 27, 2012, 07:27:44 PM by Advanced Bot »

Here, use this instead. I'm not fully sure, but I've worked with sounds and I'm quite sure you use this instead.

Code: [Select]
serverPlay3d(soundDatablockName);

Multiple problems
1. Rename Thanks to ThanksEmoteSound (just more descriptive)
2. I've never heard of player::playeraudio, but if it exists, I'm pretty sure the argument given should be the sound datablock name, Thanks (or ThanksEmoteSound if you follow #1)
3. You're condition check is wrong; your checking if they're admin, but it looks like you want to add a spam prevention instead. Change %client.lastTime to %client.lastThanksTime (again, just being more descriptive) and change the condition to if($Sim::Time - %client.lastThanksTime > 10000) (change the 10000 to however many milliseconds you want)
4. The private add-on notification is completely unnecessary

serverPlay3d(soundDatablockName);
Yeah pretty sure you need to give it coordinates too

It is still doing the same thing again. Except, now its telling me Im doing it too much...