AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-19) (https://forums.alliedmods.net/showthread.php?t=237045)

Powerlord 03-16-2014 16:31

EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-19)
 
6 Attachment(s)
As of a 2018 CS:GO update, this include is no longer necessary

Warning: This only works for MP3s

Version: 1.0.3

Changelog
  • 1.0.3
    • Added StopSoundAny.
    • Fix incorrect variable name in EmitAmbientSoundAny
  • 1.0.2
    • Added include guard in case your code attempts to include it twice.
    • Adds second argument to PrecacheSoundAny.
    • Adds #include <sdktool> in case you include it before including sdktools.
  • 1.0.1
    • Fixed the engine check being done every call instead of just the first.
  • 1.0.0
    • Initial release based on the CS:GO Quirks page (both psychonic's and my work on it)

What is EmitSoundAny

So, what's the point of this?

Well, it's to provide a simple include that plugins can use to have CS:GO and DOTA2 compatible sound playing. If you have read the CS:GO Quirks page, you know that CS:GO doesn't work with PrecacheSound and EmitSound without having to go through some tricks.

So... I wrote this include, which neatly wraps the game detection and precaches/emits appropriately.

The wrappers it includes are:

Code:

stock bool:PrecacheSoundAny(const String:szPath[], bool:preload=false)

stock EmitSoundAny(const clients[],
                numClients,
                const String:sample[],
                entity = SOUND_FROM_PLAYER,
                channel = SNDCHAN_AUTO,
                level = SNDLEVEL_NORMAL,
                flags = SND_NOFLAGS,
                Float:volume = SNDVOL_NORMAL,
                pitch = SNDPITCH_NORMAL,
                speakerentity = -1,
                const Float:origin[3] = NULL_VECTOR,
                const Float:dir[3] = NULL_VECTOR,
                bool:updatePos = true,
                Float:soundtime = 0.0)

stock EmitSoundToClientAny(client,
                const String:sample[],
                entity = SOUND_FROM_PLAYER,
                channel = SNDCHAN_AUTO,
                level = SNDLEVEL_NORMAL,
                flags = SND_NOFLAGS,
                Float:volume = SNDVOL_NORMAL,
                pitch = SNDPITCH_NORMAL,
                speakerentity = -1,
                const Float:origin[3] = NULL_VECTOR,
                const Float:dir[3] = NULL_VECTOR,
                bool:updatePos = true,
                Float:soundtime = 0.0)

stock EmitSoundToAllAny(const String:sample[],
                entity = SOUND_FROM_PLAYER,
                channel = SNDCHAN_AUTO,
                level = SNDLEVEL_NORMAL,
                flags = SND_NOFLAGS,
                Float:volume = SNDVOL_NORMAL,
                pitch = SNDPITCH_NORMAL,
                speakerentity = -1,
                const Float:origin[3] = NULL_VECTOR,
                const Float:dir[3] = NULL_VECTOR,
                bool:updatePos = true,
                Float:soundtime = 0.0)

stock EmitAmbientSoundAny(const String:sample[],
                        const Float:pos[3],
                        entity = SOUND_FROM_WORLD,
                        level = SNDLEVEL_NORMAL,
                        flags = SND_NOFLAGS,
                        Float:vol = SNDVOL_NORMAL,
                        pitch = SNDPITCH_NORMAL,
                        Float:delay = 0.0)

stock StopSoundAny(entity, channel, const String:name[])

(Note that EmitSoundAny is missing its any:.. because SourcePawn doesn't have any way to process those outside of VFormat, which is inappropriate for this)

Usage of this is the same as playing sounds in most game using SourceMod:

PHP Code:

public OnMapStart()
{
    
AddFileToDownloadsTable("sound/sourcemod/mymod/bacon.mp3");
    
PrecacheSoundAny("sourcemod/mymod/bacon.mp3");
}

// In response to something
    
EmitSoundToAllAny("sourcemod/mymod/bacon.mp3"); 

Edit: Minor update to make the variables static.

Edit 2: Edit to make g_bCheckedEngine actually save its value to stop GetEngineVersion from being called every time.

Bacardi 03-17-2014 01:54

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible)
 
Ok.
Just thinking maybe it no harm add that sound char *
for everygame :/

Peace-Maker 03-17-2014 07:54

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible)
 
Quote:

Originally Posted by Bacardi (Post 2112521)
Ok.
Just thinking maybe it no harm add that sound char *
for everygame :/

I thought you weren't able to specify the sounds location when streaming it from disk with *. You would lose that possibility when using * for every other game.

Also you never set g_bCheckedEngine to true ;)

Powerlord 03-17-2014 08:41

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible)
 
Quote:

Originally Posted by Peace-Maker (Post 2112567)
Also you never set g_bCheckedEngine to true ;)

Whoops, you're right. I'll fix it in a minute.

Powerlord 03-19-2014 09:50

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible)
 
I uploaded version 1.0.2, which includes these fixes:
  • Adds an include guard so things don't blow up if you try to include it twice. (I ran into this while working with UMC).
  • Adds an #include <sdktools> so that it can be placed before #include <sdktools> in your own code (which works because sdktools also has an include guard)
  • Adds the preload argument to PrecacheSoundAny (which is passed to PrecacheSound for supported games)

Bittersweet 03-19-2014 12:33

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Very handy, they should roll it in.

Powerlord 03-20-2014 13:58

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Bittersweet (Post 2113481)
Very handy, they should roll it in.

If they were going to roll it in, they could have just updated PrecacheSound and EmitSound* directly, but it's too late to do that now because it'll break code that depends on the code on the CS:GO Quirks page.

Jargon 03-25-2014 17:07

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
I changed a round sounds plugin to use this and now the sound has gone from being normal levels (using the CS:GO Quirks workaround) to being so quiet it can barely be heard. Do you have any idea why this could be?

Powerlord 03-25-2014 17:19

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Jargon (Post 2115893)
I changed a round sounds plugin to use this and now the sound has gone from being normal levels (using the CS:GO Quirks workaround) to being so quiet it can barely be heard. Do you have any idea why this could be?

Which CS:GO Quirks workaround were you using? If it was the music/ folder one, the volumes would be different as files being played from the music folder have their volume controlled by the client's music volume control.

Jargon 03-25-2014 17:26

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
No just the fakeprecache sound method with the * before the filename. I may have foolishly saved over the changed version I made but I'll try to replicate it.

Just to be sure, even though my sounds aren't in the music folder I tried adjusting the music volume which made no difference, and tried to change the SNDLEVEL in the include which also didn't increase it at all.

Powerlord 03-25-2014 17:29

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Jargon (Post 2115902)
No just the fakeprecache sound method with the * before the filename. I may have foolishly saved over the changed version I made but I'll try to replicate it.

Just to be sure, even though my sounds aren't in the music folder I tried adjusting the music volume which made no difference, and tried to change the SNDLEVEL in the include which also didn't increase it at all.

That's weird, this should be functionally identical to the method you were using.

Jargon 03-25-2014 17:43

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Actually after testing with the original plugin, it seems like it's only some audio files. Checking them with mediainfo shows they're all encoded identically (all mp3's, same bitrate, same sampling rate) yet play at vastly different volumes.

I'll try to replicate with the normal volume sounds using this include and compare like for like. Do you know why some sounds would be quiet though?

Edit: Sorry it's hard to tell as the plugin picks sounds at random to play at the end, but it seems there's a mixed success rate with either method. Is there a file size limit to fake precaching a sound? That's the only discriminating factor between any of my audio files. What plays consistently works, and what doesn't play consistently doesn't.

All sounds can be played in WinAMP, WMP, iTunes and VLC so there's nothing iffy about the files.

Jargon 03-26-2014 02:59

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Interestingly enough they play at normal levels on CS:S using the original, non-quirk, version of the plugin.

zozo1121 07-17-2014 12:16

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Hi!

I found this page because i searched to a problem because my cs go server has a admin sound plugin and if i want to play a sound the following problem has cought me : Failed to load sound file can't create mixer!

And i found this site for a solution...... and i just don't know whato to do this codes or what this emitting thing.... i'm lost...... so can someone help me to fix this? snd_rebuildaudiocache is not working

Bittersweet 07-17-2014 14:29

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by zozo1121 (Post 2169340)
Hi!

I found this page because i searched to a problem because my cs go server has a admin sound plugin and if i want to play a sound the following problem has cought me : Failed to load sound file can't create mixer!

And i found this site for a solution...... and i just don't know whato to do this codes or what this emitting thing.... i'm lost...... so can someone help me to fix this? snd_rebuildaudiocache is not working

Well, this thread is actually about a tool for plugin developers: EmitSoundAny. If you acquired your plugin from someone else, then you should post something in the forum/thread where you got the plugin. If you wrote your own plugin, you should probably post the code in a new thread in the Sourcemod "Scripting" forum here at AlliedModders. If nothing else, post the problem in the Sourcemod "General" forum. This is all assuming you are running Sourcemod...if not, you are completely in the wrong area of the forums.

Bara 07-18-2014 10:16

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
1 Attachment(s)
I've added StopSoundAny (because StopSound not work in csgo..) and works fine with csgo (other games untested).

Powerlord 07-18-2014 11:41

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Bara (Post 2169877)
I've added StopSoundAny (because StopSound not work in csgo..) and works fine with csgo (other games untested).

I would have thought StopSound would have the same problem as EmitSound in that you'd need to put a * in front of the sound name in order to stop it.

For that matter, wouldn't playing the same sound again on a different channel with 0.0 volume not actually stop it?

Bara 07-18-2014 11:51

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Powerlord (Post 2169936)
I would have thought StopSound would have the same problem as EmitSound in that you'd need to put a * in front of the sound name in order to stop it.

Oh right, you're right. I've updated it. :oops:

Powerlord 07-18-2014 11:54

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
1 Attachment(s)
Quote:

Originally Posted by Bara (Post 2169944)
Oh right, you're right. I've updated it. :oops:

Except now it assumes the sound is playing on channel 1 (which is )

Besides, I've wrote a version after I saw your first version.

Having said that, there is one problem with it... you should only use StopSoundAny on sounds you've emitted with EmitSoundAny as sounds emitted by the game engine won't necessarily start with * as they're not subject to the CS:GO Quirks restrictions.

Pohearts 10-01-2014 08:29

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Somehow the compiler crashed when i compile it :/
possibly i'm using SM 1.7..
i will have to go for traditional way to EmitSound for csgo then ..

rodpod 12-28-2014 14:02

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
do I still need to force clients to download custom content from server? i.e. from folder sound/music/MYOWNFOLDER/*.* using separate plugin?

Powerlord 12-29-2014 10:30

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by rodpod (Post 2241069)
do I still need to force clients to download custom content from server? i.e. from folder sound/music/MYOWNFOLDER/*.* using separate plugin?

Yes, something needs to make the user download the files.

Having said that, this is only a plugin fragment intended to be included in other plugins that need to be able to play sounds on both CS:GO and older games (like CS:S).

apocalyptic 02-21-2015 23:32

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Pohearts (Post 2205650)
Somehow the compiler crashed when i compile it :/
possibly i'm using SM 1.7..
i will have to go for traditional way to EmitSound for csgo then ..

yes, i got the same problem here. sourcemod 5155 cannot fix it.

vanbka9 02-22-2015 11:05

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
PHP Code:

stock EmitAmbientSoundAny(const String:name[], // switch to "sample" 
                        
const Float:pos[3],
                        
entity SOUND_FROM_WORLD,
                        
level SNDLEVEL_NORMAL,
                        
flags SND_NOFLAGS,
                        
Float:vol SNDVOL_NORMAL,
                        
pitch SNDPITCH_NORMAL,
                        
Float:delay 0.0)
{
    
decl String:szSound[PLATFORM_MAX_PATH];
    
    if (
g_bNeedsFakePrecache)
    {
        
Format(szSoundsizeof(szSound), "*%s"sample); // cuz here "sample"
    
}
    else
    {
        
strcopy(szSoundsizeof(szSound), sample);
    }
    
    
EmitAmbientSound(szSoundposentitylevelflagsvolpitchdelay);



Powerlord 02-22-2015 14:56

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by apocalyptic (Post 2265076)
yes, i got the same problem here. sourcemod 5155 cannot fix it.

I'm not sure what to tell you. I can even compile a new-style test plugin and it doesn't crash.

Having said that, I've noticed I can't compiler the EmitSoundAny version of MapChooser Extended Sounds under 1.7. The errors it spits don't seem to make sense either.

I'll have to look into that.

Quote:

Originally Posted by vanbka9 (Post 2265267)
PHP Code:

stock EmitAmbientSoundAny(const String:name[], // switch to "sample" 
                        
const Float:pos[3],
                        
entity SOUND_FROM_WORLD,
                        
level SNDLEVEL_NORMAL,
                        
flags SND_NOFLAGS,
                        
Float:vol SNDVOL_NORMAL,
                        
pitch SNDPITCH_NORMAL,
                        
Float:delay 0.0)
{
    
decl String:szSound[PLATFORM_MAX_PATH];
    
    if (
g_bNeedsFakePrecache)
    {
        
Format(szSoundsizeof(szSound), "*%s"sample); // cuz here "sample"
    
}
    else
    {
        
strcopy(szSoundsizeof(szSound), sample);
    }
    
    
EmitAmbientSound(szSoundposentitylevelflagsvolpitchdelay);



Yes, this is definitely a bug.

apocalyptic 02-25-2015 02:04

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by vanbka9 (Post 2265267)
PHP Code:

stock EmitAmbientSoundAny(const String:name[], // switch to "sample" 


modify emitsoundany.inc, replace name with sample, then everything will be good.
remember: source engine may not support wav sounds, you can use mp3 sounds.

Powerlord 02-26-2015 14:07

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by apocalyptic (Post 2266324)
modify emitsoundany.inc, replace name with sample, then everything will be good.
remember: source engine may not support wav sounds, you can use mp3 sounds.

I've already modified it, I just wanted to wait to get any other bugs out of the way before replacing the version in the first post with it... but as I said, I can (and have) compiled plugins using SM 1.7 with it and haven't run into a problem with PrecacheSoundAny. EmitSoundAnyToClient, EmitSoundAnyToAll, and EmitSoundAny.

DabuDos 03-03-2015 04:44

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Powerlord (Post 2266877)
I've already modified it, I just wanted to wait to get any other bugs out of the way before replacing the version in the first post with it... but as I said, I can (and have) compiled plugins using SM 1.7 with it and haven't run into a problem with PrecacheSoundAny. EmitSoundAnyToClient, EmitSoundAnyToAll, and EmitSoundAny.

They are working, yes. But I allways have to change the map one time before it works. Otherwise "Sound is not Precached".

Totenfluch 03-07-2015 15:37

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Hey, I tried using your .include with my Sound plugin but the Sound didn't play and I also didn't get any Error either the Client console and Server console.

My Code looks like the following:

Code:

public OnMapStart()
{
    AddFileToDownloadsTable(..);
    PrecacheSoundAny(..);
}
public EventRoundEnd(...) {
    for( new client = 1; client < MAXPLAYERS-2; client++){
                        if(IsValidClient(client)){
                        EmitSoundToClientAny(client, "music/TPlayer/xlol.mp3", _, _, _, _, 1.0);
                        }
      }
}

Any clues what I may have done wrong?

iGANGNAM 03-12-2015 14:06

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Can you give me example of StopSoundAny?

Mitchell 03-12-2015 15:21

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by iGANGNAM (Post 2273066)
Can you give me example of StopSoundAny?

It basically works like SM's StopSound() which will stop the sound playing to a client matching the exact sound name.
if you emit a sound of "bot/hate.wav" you can use StopSound to with "bot/hate.wav"

iGANGNAM 03-13-2015 03:09

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
so it's something like that?

StopSoundAny(entity, _, "music/l4d/tank/1.mp3");

NatalyaAF 05-10-2015 10:22

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Hi, I am working with someone else's plugin, trying to make it use this include. Here's what I've got:

PHP Code:

#include <sourcemod>
#include <sdktools>
#include <sdktools_sound>
#include <emitsoundany>

#pragma semicolon 1
#define MAX_FILE_LEN 80
new Handle:g_CvarSoundName INVALID_HANDLE;
new 
String:g_soundName[MAX_FILE_LEN];

#define PLUGIN_VERSION "1.0"
public Plugin:myinfo 
{
    
name "CS:GO Sound",
    
author "Team-Secretforce.com",
    
description "Join Sound on your CS:GO Server",
    
version PLUGIN_VERSION,
    
url "http://www.Team-Secretforce.com/"
};
public 
OnPluginStart()
{
    
// Create the rest of the cvar's
CreateConVar("sm_welcome_snd_version"PLUGIN_VERSION"CS:GO Sound Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
g_CvarSoundName CreateConVar("sm_start_sound""natalya/server/moon-join-server.mp3""Welcome sound");
}
public 
OnConfigsExecuted()
{
    
GetConVarString(g_CvarSoundNameg_soundNameMAX_FILE_LEN);
    
decl String:buffer[MAX_FILE_LEN];
    
PrecacheSound(g_soundNametrue);
    
Format(buffersizeof(buffer), "sound/%s"g_soundName);
    
AddFileToDownloadsTable(buffer);
}
public 
OnClientPostAdminCheck(client)
{
    
EmitSoundToClientAny(clientg_soundName);


I'm not hearing anything, am I using this right? Or maybe I should play it later when the client gets spawned and then have like a boolean that gets set to true on first spawn and when true it won't play anymore or something like that.

Powerlord 05-10-2015 11:22

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by NatalyaAF (Post 2295219)
Hi, I am working with someone else's plugin, trying to make it use this include. Here's what I've got:

PHP Code:

#include <sourcemod>
#include <sdktools>
#include <sdktools_sound>
#include <emitsoundany>

#pragma semicolon 1
#define MAX_FILE_LEN 80
new Handle:g_CvarSoundName INVALID_HANDLE;
new 
String:g_soundName[MAX_FILE_LEN];

#define PLUGIN_VERSION "1.0"
public Plugin:myinfo 
{
    
name "CS:GO Sound",
    
author "Team-Secretforce.com",
    
description "Join Sound on your CS:GO Server",
    
version PLUGIN_VERSION,
    
url "http://www.Team-Secretforce.com/"
};
public 
OnPluginStart()
{
    
// Create the rest of the cvar's
CreateConVar("sm_welcome_snd_version"PLUGIN_VERSION"CS:GO Sound Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
g_CvarSoundName CreateConVar("sm_start_sound""natalya/server/moon-join-server.mp3""Welcome sound");
}
public 
OnConfigsExecuted()
{
    
GetConVarString(g_CvarSoundNameg_soundNameMAX_FILE_LEN);
    
decl String:buffer[MAX_FILE_LEN];
    
PrecacheSound(g_soundNametrue);
    
Format(buffersizeof(buffer), "sound/%s"g_soundName);
    
AddFileToDownloadsTable(buffer);
}
public 
OnClientPostAdminCheck(client)
{
    
EmitSoundToClientAny(clientg_soundName);


I'm not hearing anything, am I using this right? Or maybe I should play it later when the client gets spawned and then have like a boolean that gets set to true on first spawn and when true it won't play anymore or something like that.

Instead of using PrecacheSound, use PrecacheSoundAny.

NatalyaAF 05-10-2015 13:40

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Thanks, that got it working!!

DabuDos 05-30-2015 19:45

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Could it be that this is not needed anymore? When I'm using this the sounds are not working, using standard sourcemod EmitSound works again.

Bara 08-06-2015 10:13

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
I've found a "bug".

Code:

stock EmitAmbientSoundAny(const String:name[],
                        const Float:pos[3],
                        entity = SOUND_FROM_WORLD,
                        level = SNDLEVEL_NORMAL,
                        flags = SND_NOFLAGS,
                        Float:vol = SNDVOL_NORMAL,
                        pitch = SNDPITCH_NORMAL,
                        Float:delay = 0.0)
{
    decl String:szSound[PLATFORM_MAX_PATH];
   
    if (g_bNeedsFakePrecache)
    {
        Format(szSound, sizeof(szSound), "*%s", sample);
    }
    else
    {
        strcopy(szSound, sizeof(szSound), sample);
    }
   
    EmitAmbientSound(szSound, pos, entity, level, flags, vol, pitch, delay);
}

name is never used and sample is a undefined symbol ;)

Powerlord 08-06-2015 10:27

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Quote:

Originally Posted by Bara (Post 2329639)
I've found a "bug".

Code:

stock EmitAmbientSoundAny(const String:name[],
                        const Float:pos[3],
                        entity = SOUND_FROM_WORLD,
                        level = SNDLEVEL_NORMAL,
                        flags = SND_NOFLAGS,
                        Float:vol = SNDVOL_NORMAL,
                        pitch = SNDPITCH_NORMAL,
                        Float:delay = 0.0)
{
    decl String:szSound[PLATFORM_MAX_PATH];
   
    if (g_bNeedsFakePrecache)
    {
        Format(szSound, sizeof(szSound), "*%s", sample);
    }
    else
    {
        strcopy(szSound, sizeof(szSound), sample);
    }
   
    EmitAmbientSound(szSound, pos, entity, level, flags, vol, pitch, delay);
}

name is never used and sample is a undefined symbol ;)

As you probably guessed it should be sample and not name in the function header. Whoops.

shanapu 06-01-2016 18:18

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
ok, he deleted in second of my post :D
so...


Still works for me.
https://github.com/shanapu/MyJailbre...tSoundToAllAny

Kruzi 06-10-2016 14:05

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
I have this sound: EmitAmbientSoundAny(GRAB_PATH, vec);
How to stop it?
I tryed StopSoundAny(SOUND_FROM_WORLD,SNDCHAN_AUTO, GRAB_PATH);
but it don't works help me please


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

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