AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] Custom Sound Help! (https://forums.alliedmods.net/showthread.php?t=121188)

bman87 03-12-2010 16:16

[L4D2] Custom Sound Help!
 
Please help! I cannot get this plugin to work.

The file downloads correctly, I can join the server and it transfers the file. But when I type the sm_haha command I do not hear the file play.

When I check my sound folder it created the tchalo directory and transfered the .wav file successfully. I am able to play the .wav in a media player.

Typing: 'play tchalo/haha3.wav' in the console does not work. Failed to load file...

Any ideas?

PHP Code:

#include <sourcemod>
#include <sdktools>

#define VERSION "1.1"

#define HAHASOUND "tchalo/haha3.wav"

public Plugin:myinfo =
{
    
name "L4D2 Sound Loader Test",
    
author "B-man",
    
description "TCHalo Servers",
    
version VERSION,
    
url "http://www.tchalo.com"
}

public 
OnPluginStart()
{
    
RegAdminCmd("sm_haha"playerLaughADMFLAG_GENERIC"Nelsons' Ha-ha!");
}

public 
OnMapStart()
{
    
AddFileToDownloadsTable("sound\\tchalo\\haha3.wav");
    
CallCacheSounds();
}

public 
Action:playerLaugh(clientargs)
{
    
EmitSoundToAll(HAHASOUND);
    
PrintToChat(client"Hah-ha!");
}

public 
CallCacheSounds()
{
    
PrecacheSound(HAHASOUNDfalse); 



Oshroth 03-13-2010 03:50

Re: [L4D2] Custom Sound Help!
 
I think this might be a problem with L4D2 itself. In my experience L4D2 won't play any sound files that are not in the sound cache, although I might be wrong.

AtomicStryker 03-13-2010 04:17

Re: [L4D2] Custom Sound Help!
 
Correct. Until you/any client run snd_rebuildaudiocache, you wont hear a thing.

Visual77 03-13-2010 06:59

Re: [L4D2] Custom Sound Help!
 
Interesting. I can force people to download coloured laser sights with this method, but they will have to restart the game before the vpk starts working.
Is their anyway to make the client reload his vpk files on connection?

I remeber you could call a command manually to do this, but is there anyway to let the client call it automaticly? So they could have green laser sights for example, directly after joining the server.

This one to be more exact.
update_addon_paths - Reloads the search paths for game addons.

alexip121093 03-13-2010 07:26

Re: [L4D2] Custom Sound Help!
 
Wonder there have anotherway need not rebuild sounds cache

Quote:

Originally Posted by Visual77 (Post 1116053)
Interesting. I can force people to download coloured laser sights with this method, but they will have to restart the game before the vpk starts working.
Is their anyway to make the client reload his vpk files on connection?

I remeber you could call a command manually to do this, but is there anyway to let the client call it automaticly? So they could have green laser sights for example, directly after joining the server.

This one to be more exact.
update_addon_paths - Reloads the search paths for game addons.

AddFileToDownloadsTable support vpk files?

Visual77 03-13-2010 07:35

Re: [L4D2] Custom Sound Help!
 
Yeah, even vpk.

bman87 03-13-2010 14:14

Re: [L4D2] Custom Sound Help!
 
Quote:

Originally Posted by AtomicStryker (Post 1115973)
Correct. Until you/any client run snd_rebuildaudiocache, you wont hear a thing.

Can I use one of the ClientCommand() functions to send the snd_rebuildcache command?

ChrisP 03-13-2010 15:19

Re: [L4D2] Custom Sound Help!
 
You wouldn't want to have them rebuild their audio cache because it takes a long time, much longer than them restarting their game. I too would like a way to make the sounds, as well as custom particle effects and textures, work without the client restarting their game, but I cant find a viable method for any of them.

AtomicStryker 03-13-2010 16:26

Re: [L4D2] Custom Sound Help!
 
Where is the audiocache, anyway? If its a small file perhaps we could force upload it on them?

kiraibrasil 03-13-2010 21:49

Re: [L4D2] Custom Sound Help!
 
Afake client play a hls


All times are GMT -4. The time now is 13:51.

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