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)

shanapu 01-20-2018 07:52

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

Originally Posted by _GamerX (Post 2573084)
How to stop sound from EmitAmbientSoundAny?

https://forums.alliedmods.net/showpo...7&postcount=16

PHP Code:

stock StopSoundAny(entitychannel, const String:name[]) 


_GamerX 01-20-2018 09:20

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
for me not work sound still play if i use this function

Berva 02-27-2018 17:17

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
what do i do with that .inc? :D im kinda new into plugins

Powerlord 03-14-2018 16:40

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
To be fair, I'm not even sure if this include is necessary any more. I've heard a recent CS:GO update made it unnecessary.

fragnichtnach 06-08-2018 10:58

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
since this update
http://blog.counter-strike.net/index.php/2018/04/20400/
sounds are not played. Before this update everything was working fine.

Code:

[Sound] S_StartSound(): Failed to load sound '*folder\sound.mp3'. File is missing from disk or is invalid.
the custom sound is precached but not played and located here:
csgo\sound\folder\sound.mp3

fragnichtnach 06-09-2018 05:42

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
The result of some researches:

Joining a server and downloading new *.mp3 will not make them working immidiately. You need to restart CS:GO. Probably something like "snd_rebuildaudiocache" (what has been removed some weeks ago) would help.

Is there a way to make it possible to play custom sounds directly after the are downloaded?

Here is the current code I am using:
Code:

#include <sourcemod>
#include <emitsoundany>

#define MAX_FILE_LEN 80

Handle g_CvarSound = INVALID_HANDLE;
char g_soundsound[MAX_FILE_LEN];

public void OnPluginStart()
{
        SoundFilespluginStart();
        AutoExecConfig(true, "testsound");
        RegConsoleCmd("sm_testsound", Command_Sound);
}

public void SoundFilespluginStart()
{
        g_CvarSound = CreateConVar("sound", "Sound.mp3", "Sound");
}

public void OnMapStart()
{
    precache_sounds();
}

public void precache_sounds()
{
    GetConVarString(g_CvarSound, g_soundsound, MAX_FILE_LEN);
    char buffer[MAX_FILE_LEN];
    PrecacheSoundAny(g_soundsound, true);
    Format(buffer, sizeof(buffer), "sound/%s", g_soundsound);
    AddFileToDownloadsTable(buffer);
}

public Action Command_Sound(int client, int args)
{
        CreateTimer(0.1,PlaySound);
        return Plugin_Handled;
}

public Action PlaySound(Handle timer)
{
        float volume=0.3;
        for(int client=1; client<MAXPLAYERS; client++)
        {
                if(IsClientInGame(client) && !IsFakeClient(client))
                        EmitSoundToClientAny(client,g_soundsound,SOUND_FROM_PLAYER, SNDCHAN_AUTO, SNDLEVEL_NORMAL, SND_NOFLAGS, volume, SNDPITCH_NORMAL, -1, NULL_VECTOR, NULL_VECTOR, true,0.0);
        }
}


Bacardi 06-09-2018 06:23

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
@fragnichtnach, ...what I remember, there is differences with *.wav and *.mp3 files. *.wav files work immediatelly if I don't remember wrong.

Papero 06-17-2018 14:55

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

Originally Posted by Powerlord (Post 2583040)
To be fair, I'm not even sure if this include is necessary any more. I've heard a recent CS:GO update made it unnecessary.

I've just ran some test and the results were that the sound got played even tough I haven't used emitsoundany but the "default" emitsound so I can confirm you tought

My test case:
PHP Code:

#define SOUND "sound/hexah/mafix.wav"
#define PLAY "hexah/mafix.wav"

public void OnPluginStart()
{
    
RegConsoleCmd("sm_playsound"Cmd_Play);
}

public 
void OnMapStart()
{
    
AddFileToDownloadsTable(SOUND);
    
PrecacheSound(PLAY);
}

public 
Action Cmd_Play(int clientint args)
{
    
float vPos[3];
    
GetClientAbsOrigin(clientvPos);
    
EmitAmbientSound(PLAYvPos);


I've tried both .mp3 & .wav

Quote:

Originally Posted by Bacardi (Post 2595968)
@fragnichtnach, ...what I remember, there is differences with *.wav and *.mp3 files. *.wav files work immediatelly if I don't remember wrong.

Here works fine with both

PeEzZ 07-08-2018 05:39

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
I can confirm you don't need anymore, now you can play more sound at one time, and map side-imported custom sounds is working well, like in css.

paulo_crash 06-14-2021 14:17

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Could someone help me, I'm trying to use the following native for the spray sounds:
PHP Code:

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)
{
    new 
clients[1];
    
clients[0] = client;
    
/* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */
    
entity = (entity == SOUND_FROM_PLAYER) ? client entity;
    
EmitSoundAny(clients1sampleentitychannel
    
levelflagsvolumepitchspeakerentity,
    
origindirupdatePossoundtime);


In case I wanted only the player, when using the spray on the server, to hear the audio of the spray being applied, other players wouldn't hear anything.

I tried as follows:
PHP Code:

EmitSoundToClientAny(SOUND_SPRAY_RELiClientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.4); 

Porém da este erro na hora de compilar:
PHP Code:

//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// franug_valvesprays.sp
//
// D:\Google Drive\ZK ServidoresÖ\Servidores CSGO\Editar Plugins\addons\sourcemod\scripting\valvesprays.sp(48) : warning 241: Array-based enum structs will be removed in 1.11. See [url]https://wiki.alliedmods.net/SourcePawn_Transitional_Syntax#Enum_Structs[/url]
// D:\Google Drive\ZK ServidoresÖ\Servidores CSGO\Editar Plugins\addons\sourcemod\scripting\valvesprays.sp(52) : warning 241: Array-based enum structs will be removed in 1.11. See [url]https://wiki.alliedmods.net/SourcePawn_Transitional_Syntax#Enum_Structs[/url]
// D:\Google Drive\ZK ServidoresÖ\Servidores CSGO\Editar Plugins\addons\sourcemod\scripting\valvesprays.sp(177) : warning 234: symbol "GetMaxClients" is marked as deprecated: Use MaxClients variable instead.
//
//
// D:\Google Drive\ZK ServidoresÖ\Servidores CSGO\Editar Plugins\addons\sourcemod\scripting\valvesprays.sp(287) : error 035: argument type mismatch (argument 1)
// D:\Google Drive\ZK ServidoresÖ\Servidores CSGO\Editar Plugins\addons\sourcemod\scripting\valvesprays.sp(362) : warning 234: symbol "GetMaxClients" is marked as deprecated: Use MaxClients variable instead.
//
//
//
// 1 Error.
//
// Compilation Time: 0,7 sec
// ----------------------------------------

Press enter to exit ... 

How can I fix it, or is it even another native I should use?


All times are GMT -4. The time now is 11:17.

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