Author Topic: Scripts & PlaySound(...) function  (Read 951 times)

0 Members and 1 Guest are viewing this topic.

Offline Szaman

  • Soldier
  • **
  • Posts: 145
Scripts & PlaySound(...) function
« on: March 30, 2014, 02:34:47 pm »
Hi,

According to the thread: http://forums.soldat.pl/index.php?topic=42042.msg507767
Would you be so kind and give me some examples of using that function? What those parameters stands for? Sound name is the relative filename or absolute filename?

And - additionally - can I ask you for updating dev wiki with entry about that function?

Best regards,
Szaman.

Offline kicikici

  • Soldier
  • **
  • Posts: 180
Re: Scripts & PlaySound(...) function
« Reply #1 on: March 30, 2014, 03:33:21 pm »
Code: [Select]
function OnCommand(ID: Byte; Text: string): boolean;
begin
   if GetPiece(Text, ' ', 0) = '/plays' then begin
      PlaySound(ID, 'takebow.wav', GetPlayerStat(ID, 'X'), GetPlayerStat(ID, 'Y'));
   end;
   Result := false;
end;

ID - destination player (I am guessing);
Name - only name sound;
X, Y - coordinates of sound source;
Classic banana

Offline Drax

  • Soldier
  • **
  • Posts: 241
Re: Scripts & PlaySound(...) function
« Reply #2 on: March 30, 2014, 04:48:25 pm »
Code: [Select]
function OnCommand(ID: Byte; Text: string): boolean;
begin
   if GetPiece(Text, ' ', 0) = '/plays' then begin
      PlaySound(ID, 'takebow.wav', GetPlayerStat(ID, 'X'), GetPlayerStat(ID, 'Y'));
   end;
   Result := false;
end;

it works on my server
I also tested with Szaman if you can use your own downloaded sounds - you can
but the question is, can we make it play for every player in server?


Code: [Select]
function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
   if GetPiece(Text, ' ', 0) = '/plays' then begin
      PlaySound(0, 'aura.wav', GetPlayerStat(ID, 'X'), GetPlayerStat(ID, 'Y'));
   end;
   Result := false;
end;

only default sounds work for everyone or they have to download it and put it in sfx folder

it's going to be a huge plus for scripted/modded servers
Huuuge thank you to: Szaman&kicikici

« Last Edit: March 30, 2014, 05:40:25 pm by Drax »

Offline Szaman

  • Soldier
  • **
  • Posts: 145
Re: Scripts & PlaySound(...) function
« Reply #3 on: March 30, 2014, 04:52:07 pm »
@kicikici - thank you very much :)
And I also remind about updating wiki.

Best regards,
Szaman.