Raised This Month: $51 Target: $400
 12% 

Making clients download sounds from server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
foot33333
Junior Member
Join Date: Jul 2009
Old 07-05-2009 , 19:43   Making clients download sounds from server
Reply With Quote #1

I am writing a plugin where I want to play sounds that are stored on the server. When an event occurs and I want the sound file to play my client console says:

"S_StartSound: Failed to load sound 'sounds\test.mp3', file probably missing form disk/repository"

Do I have to somehow make the clients download the sound when they connect to the server? How do I do this? Thanks
foot33333 is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 07-05-2009 , 19:49   Re: Making clients download sounds from server
Reply With Quote #2

You have to add and precache any sound/model etc to download table.

Code:
new Handle:cvarSound;

  public OnPluginStart()
{
  cvarSound = CreateConVar("sm_rickroll_sound", "rr2a.mp3", "Sound to play", FCVAR_PLUGIN);
}

public OnMapStart()
{
    decl String:sound[PLATFORM_MAX_PATH+1], String:path[PLATFORM_MAX_PATH+1];
    GetConVarString(cvarSound, sound, sizeof(sound));
    Format(path, sizeof(path), "sound/%s", sound);

    AddFileToDownloadsTable(path);
    PrecacheSound(sound);
}
retsam is offline
foot33333
Junior Member
Join Date: Jul 2009
Old 07-05-2009 , 20:02   Re: Making clients download sounds from server
Reply With Quote #3

What is the root directory that sourcemod looks in for the sound files? I am still getting the same error. I want to play I sound everytime someone dies in without doing damage to anyone during their life. Here is my code

#include <sourcemod>
#include <sdktools>


new DamageArray[8] = {0, 0, 0, 0, 0, 0, 0, 0,};
new Handle:cvarSound;



public OnPluginStart()
{
cvarSound = CreateConVar("sm_humiliation", "humiliation.mp3", "Sound to play", FCVAR_PLUGIN);
PrecacheSound("sounds/humiliation.mp3")
HookEvent("player_death", Event_PlayerDeath)
HookEvent("player_hurt", Event_PlayerHurt)
}

public OnMapStart()
{
decl String:sound[PLATFORM_MAX_PATH+1], String:path[PLATFORM_MAX_PATH+1];
GetConVarString(cvarSound, sound, sizeof(sound));
Format(path, sizeof(path), "sounds/%s", sound);

AddFileToDownloadsTable(path);
PrecacheSound(sound);
}

public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new victim_id = GetEventInt(event, "userid")


if(DamageArray[victim_id] == 0){
PrintToServer("embarrased")
EmitSoundToAll("sounds/humiliation.mp3")
}
PrintToServer("a death occurred")

DamageArray[victim_id] = 0

}


public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{

new attacker_id = GetEventInt(event, "attacker")

//PrintToServer("hurt occured")
DamageArray[attacker_id] = 1


}

Last edited by foot33333; 07-05-2009 at 20:17.
foot33333 is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 07-05-2009 , 20:29   Re: Making clients download sounds from server
Reply With Quote #4

tf\sound\blah.mp3 is where that sound would be pointing from. You have to change it if you wanted it in another folder.
retsam is offline
foot33333
Junior Member
Join Date: Jul 2009
Old 07-05-2009 , 20:32   Re: Making clients download sounds from server
Reply With Quote #5

where is the "tf" folder? I am writing the mod for left 4 dead
foot33333 is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 07-05-2009 , 20:35   Re: Making clients download sounds from server
Reply With Quote #6

I dont play l4d so...

but I dont see why it would be much different.

orangebox\tf\sound
retsam is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 07-05-2009 , 21:32   Re: Making clients download sounds from server
Reply With Quote #7

For an L4d Dedi it would be l4d\left4dead\sound
Dragonshadow is offline
foot33333
Junior Member
Join Date: Jul 2009
Old 07-05-2009 , 21:49   Re: Making clients download sounds from server
Reply With Quote #8

I have precached the sound file and I am still having the same problem. I have verified that the client is downloading the file properly. I have consolodated my code a little and here is what it looks like:

#include <sourcemod>
#include <sdktools>


new DamageArray[8] = {0, 0, 0, 0, 0, 0, 0, 0,};


public OnPluginStart()
{
AddFileToDownloadsTable("sound/humiliation.mp3");
PrecacheSound("sound/humiliation.mp3")
HookEvent("player_death", Event_PlayerDeath)
HookEvent("player_hurt", Event_PlayerHurt)
}


public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new victim_id = GetEventInt(event, "userid")

if(DamageArray[victim_id] == 0){
PrintToServer("embarrased")
EmitSoundToAll("sound/humiliation.mp3")
}
PrintToServer("a death occurred")

DamageArray[victim_id] = 0




}


public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{

new attacker_id = GetEventInt(event, "attacker")

DamageArray[attacker_id] = 1

}

anyone have any other ideas? Again the client is still giving the error:

"S_StartSound: Failed to load sound 'sound\humiliation.mp3', file probably missing form disk/repository"
foot33333 is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 07-05-2009 , 21:56   Re: Making clients download sounds from server
Reply With Quote #9

Look at my code. Im pretty sure you cant precache or addsounds to downloadtable onpluginstart....

Its gotta be OnMapStart or ConfigsExecuted I believe.
retsam is offline
foot33333
Junior Member
Join Date: Jul 2009
Old 07-05-2009 , 22:18   Re: Making clients download sounds from server
Reply With Quote #10

I've updated my code and it is still throwing me the error:

"S_StartSound: Failed to load sound 'humiliation.mp3', file probably missing form disk/repository"

here is my new code:

Code:
#include <sourcemod>
#include <sdktools>


new DamageArray[8] = {0, 0, 0, 0, 0, 0, 0, 0,};


public OnPluginStart()
{
   
   HookEvent("player_death", Event_PlayerDeath)
   HookEvent("player_hurt", Event_PlayerHurt)
}

public OnMapStart()
{
   AddFileToDownloadsTable("sound/humiliation.mp3");
   PrecacheSound("humiliation.mp3")
}



public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
   new victim_id = GetEventInt(event, "userid")

   if(DamageArray[victim_id] == 0){
    PrintToServer("embarrased")
    EmitSoundToAll("humiliation.mp3")
   }
   PrintToServer("a death occurred")
    
   DamageArray[victim_id] = 0


 

}


public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{

   new attacker_id = GetEventInt(event, "attacker")

   DamageArray[attacker_id] = 1
 
}
foot33333 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode