Raised This Month: $32 Target: $400
 8% 

Sound not being Precache


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MikeyMcMuffin
Junior Member
Join Date: Feb 2016
Old 02-24-2016 , 15:04   Sound not being Precache
Reply With Quote #1

Hi people,

Im probably missing something incredibly obvious, but I just cant get this plugin to work.

All the plugin does, is on player death play a sound file to the victim (supposed to be on sentry kills but Ive commented that out for now):

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
#define sentry_there "sound/muffin/green_scream.wav" 

public Plugin:myinfo 
{
    
name "",
    
author "Mikey McMuffin",
    
description "",
    
version "0.0.1",
    
url "http://www.sourcemod.net"
};
public 
OnPluginStart()
{
    
HookEvent("player_death"Event_Death);
}
public 
OnMapStart()
{
    
PrecacheSound("muffin/green_scream.wav"true);
    
AddFileToDownloadsTable("sound/muffin/green_scream.wav");
}
public 
Action:Event_Death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));
    
//new customkill = GetEventInt(event, "customkill")
    
    //if (customkill == TF_CUSTOM_PLAYER_SENTRY) {
    
    
EmitSoundToClient(victimsentry_there);
    
PrintToServer("SOUND WORKING");
    
//} 
However when it runs console is saying:

PHP Code:
SV_StartSoundsound/muffin/green_scream.wav not precached (0
Iv'e looked through a few threads but I can't see anything wrong, the file is being downloaded and I think my PrecacheSound looks ok.

Any ideas?
MikeyMcMuffin is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-24-2016 , 17:16   Re: Sound not being Precache
Reply With Quote #2

You're precaching the sound correctly but not using it right. What you have in the first parameter of the precache is what you ought to emit, so without the sound/ part. You can go ahead and have the define to be "muffin/green_scream.wav" and use it in both precache and emit.

Also, I doubt that the second parameter of PrecacheSound is necessary here, I just never used it in that function and it's always worked.

Last edited by Phil25; 02-24-2016 at 17:17.
Phil25 is offline
MikeyMcMuffin
Junior Member
Join Date: Feb 2016
Old 02-24-2016 , 17:38   Re: Sound not being Precache
Reply With Quote #3

Quote:
Originally Posted by Phil25 View Post
You're precaching the sound correctly but not using it right. What you have in the first parameter of the precache is what you ought to emit, so without the sound/ part. You can go ahead and have the define to be "muffin/green_scream.wav" and use it in both precache and emit.

Also, I doubt that the second parameter of PrecacheSound is necessary here, I just never used it in that function and it's always worked.
Thank you, changing following code fixed this issue:

PHP Code:
#define sentry_there "muffin/green_scream.wav" 
...
PrecacheSound(sentry_theretrue); 
However the sound is still not playing due to a different issue. The local player console says the following once dead:

PHP Code:
Failed to load sound "muffin\green_scream.wav"file probably missing from disk/repository 
I checked local files, and the sound is definitely there and downloaded (put in "common\Team Fortress 2\tf\download\sound\muffin\green_scream.wav") . Not sure why it would say it was missing, for reference I will attach the .wav file being downloaded.
Attached Files
File Type: zip green_scream.zip (945.0 KB, 90 views)

Last edited by MikeyMcMuffin; 02-24-2016 at 17:39.
MikeyMcMuffin is offline
MikeyMcMuffin
Junior Member
Join Date: Feb 2016
Old 02-25-2016 , 04:21   Re: Sound not being Precache
Reply With Quote #4

I have a feeling that it is actually my server set-up that is causing the issue raised above. Once I am home from work tonight I will make sure the server is set to sv_pure 1 (I am sure it is in the server config) and that the path to the sound files are added to whitelist.
MikeyMcMuffin is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-25-2016 , 17:28   Re: Sound not being Precache
Reply With Quote #5

Have you tried using a different emit function? I remember that at some point EmitSoundToClient wasn't working for me but EmitSoundToAll was. I've never pinned down what was wrong because I didn't really need it, but it's worth checking out if the sound actually works.
Phil25 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-26-2016 , 09:35   Re: Sound not being Precache
Reply With Quote #6

Quote:
Originally Posted by Phil25 View Post
Have you tried using a different emit function? I remember that at some point EmitSoundToClient wasn't working for me but EmitSoundToAll was. I've never pinned down what was wrong because I didn't really need it, but it's worth checking out if the sound actually works.
EmitSoundToClient and EmitSoundToAll are both stock functions that call the EmitSound native... if one's not working, both shouldn't be working.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
MikeyMcMuffin
Junior Member
Join Date: Feb 2016
Old 02-26-2016 , 18:11   Re: Sound not being Precache
Reply With Quote #7

PHP Code:
Failed to load sound "muffin\green_scream.wav"file probably missing from disk/repository 
I am still receiving this error, despite sv_pure being set to 1 and pure_server_whitelist.txt being set up (tried placing it in tf\cfg, and in tf root folder).

Here is my pure_server_whitelist.txt shortened:

PHP Code:
whitelist
{
sound\muffin\... allow_from_disk

Even changing the server to sv_pure 0 still causes this issue.

any ideas guys?
MikeyMcMuffin is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-27-2016 , 10:06   Re: Sound not being Precache
Reply With Quote #8

Quote:
Originally Posted by Powerlord View Post
EmitSoundToClient and EmitSoundToAll are both stock functions that call the EmitSound native... if one's not working, both shouldn't be working.
Yes, that's true and that must not be the case.

OP, is the sound file both in your tf/sounds folder and the server's? If it is, try to remove it from yours and download the file.
Phil25 is offline
MikeyMcMuffin
Junior Member
Join Date: Feb 2016
Old 02-27-2016 , 17:10   Re: Sound not being Precache
Reply With Quote #9

After some fiddling and redownloading I managed to get everything to work. Thanks for your help guys.

I have one small remaining issue, the sound is currently being played when a user has been killed by a sentry. However the sound is getting cut sort.

I imagine this has to do with the channel that the sound is being played on. What would I change it too however (this is in TF2).

PHP Code:
EmitSoundToClient(victimsentry_there); 
Thanks.

EDIT: Turns out that deathcam in TF2 mutes sound because it pulls away from the clients body I think. Clicking past the cam really fast to get back to your body cam allows you to hear the end of the sound. Not sure how to fix this.

Last edited by MikeyMcMuffin; 02-27-2016 at 17:44. Reason: additional info
MikeyMcMuffin is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-28-2016 , 15:27   Re: Sound not being Precache
Reply With Quote #10

Yeah, the deathcam does mute, which is really annoying because you won't hear the sounds that enemies grabbed the intel, started capping a point, etc... either.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-28-2016 at 17:16.
Powerlord 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 14:01.


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