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)

helpme_please 07-25-2016 22:53

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
hi. how to open 2 sound or more in 1 time.

_GamerX 10-19-2016 07:19

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Pls how to hook sound for non-player entity?

ESK0 10-23-2016 02:01

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
... ZßležÝ na tom co potřebuješ přesně hooknout a co stÝm budeš dělat

#en

It depends on what you need hook and what you are going to do with that.. nvm he is czech as me.. Such wow how can be some moderator so strict as arne.. I saw a lot ot comments or whole topic in other language than english without deleting..

sneaK 10-23-2016 04:54

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

Originally Posted by ESK0 (Post 2464163)
Such wow how can be some moderator so strict as arne.. I saw a lot ot comments or whole topic in other language than english without deleting..

Feel free to report any non-english posts you may run across and they will be taken care of :)

Quote:

Originally Posted by Rules
This is an English forum (other than a few specific, labeled subforums). If you're going to post in another language, also add the text in English, even if from online translator.


ESK0 10-23-2016 09:04

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

Originally Posted by blackhawk74 (Post 2464187)
Feel free to report any non-english posts you may run across and they will be taken care of :)

:O huh, okay...

REiMITZ 10-24-2016 10:05

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Sorry, I might sound retarded. But how do I use this? Thanks in advance.

ImACow 11-01-2016 06:55

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
has the most recent CS:GO patch (fixing directional sounds) fucked something up ?

- Emit audio to all players
- Kill yourself
- Spectate other player
- First person will have weird silent audio
- Switching to third person will sometimes work and give full audio again

dilalmon 11-02-2016 19:21

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
The audio gets played somewhere in the map (maybe at 0,0,0) which causes this issue.
So if you're spectating near it, you can kind of hear it.

Dkmuniz 11-08-2016 23:26

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

Originally Posted by ImACow (Post 2466799)
has the most recent CS:GO patch (fixing directional sounds) fucked something up ?

- Emit audio to all players
- Kill yourself
- Spectate other player
- First person will have weird silent audio
- Switching to third person will sometimes work and give full audio again

Same here

TheDS1337 01-29-2017 13:28

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Hey, it seems that the EmitSoundToClientAny is not working, but EmitAmbientSoundAny seems to work just fine.

I'm getting an error like this when I use EmitSoundToClientAny even tho the sounds is precached and I tried to precache the sound just before playing it too but it still doesnt work
Code:

SV_StartSound: *sound.mp3 not precached (7229)
PS: The game is CSGO

ThatOneGuy 01-31-2017 21:43

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

Originally Posted by DeagLe.Studio (Post 2490902)
Hey, it seems that the EmitSoundToClientAny is not working, but EmitAmbientSoundAny seems to work just fine.

I'm getting an error like this when I use EmitSoundToClientAny even tho the sounds is precached and I tried to precache the sound just before playing it too but it still doesnt work
Code:

SV_StartSound: *sound.mp3 not precached (7229)
PS: The game is CSGO

Check to make sure it is being downloaded properly. Delete it from your csgo sounds folder and see if you re-download it. If not, make sure the plugin is adding it to the downloads table and that it is on your fastDL and everything is named properly.

TheDS1337 02-01-2017 04:32

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

Originally Posted by ThatOneGuy (Post 2491676)
Check to make sure it is being downloaded properly. Delete it from your csgo sounds folder and see if you re-download it. If not, make sure the plugin is adding it to the downloads table and that it is on your fastDL and everything is named properly.

Its added in the sounds folder, and no I dont have a server atm so I'm testing in a listen server.

Peace-Maker 02-01-2017 05:24

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Did you use PrecacheSoundAny in OnMapStart?

TheDS1337 02-01-2017 05:37

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

Originally Posted by Peace-Maker (Post 2491740)
Did you use PrecacheSoundAny in OnMapStart?

Yes I did :) I tried also to use it just before starting the song (saw this in Zombie Reloaded's sourcecode) but it didnt work aswell.

thomasjosif 02-02-2017 21:21

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

Originally Posted by DeagLe.Studio (Post 2491743)
Yes I did :) I tried also to use it just before starting the song (saw this in Zombie Reloaded's sourcecode) but it didnt work aswell.

Would be better if you posted the code :)

TheDS1337 02-04-2017 10:03

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

Originally Posted by thomasjosif (Post 2492287)
Would be better if you posted the code :)

Well here it is.. the code is not fully functional and not completed but you should get me.
Code:

#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <emitsoundany>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo =
{
        name = "[ZR] Jetpack",
        author = "",
        description = "",
        version = "",
        url = ""
};

#define JETPACK_ENERGY 150                        // Calculated like: secs * 20.0
#define JETPACK_SPEED 350.0
#define JETPACK_ROCKET_DELAY 15.0       
#define JETPACK_ROCKET_SPEED 4000.0
#define JETPACK_ROCKET_MODEL "models/props/cs_italy/bananna.mdl"

bool g_HasJetpack[MAXPLAYERS + 1];
int g_JetpackEnergy[MAXPLAYERS + 1];
float g_NextRocketTime[MAXPLAYERS + 1];

float g_MaxSpeed[MAXPLAYERS + 1];

public void OnPluginStart()
{       
}

public void OnClientPutInServer(int client)
{
        g_HasJetpack[1] = true;
        g_JetpackEnergy[1] = JETPACK_ENERGY;
        g_NextRocketTime[1] = GetGameTime() * GetTickInterval();
       
        SDKHook(client, SDKHook_PreThink, OnPlayerPreThink);
        SDKHook(client, SDKHook_PreThinkPost, OnPlayerPreThink_Post);
}

public void OnMapStart()
{
        AddFileToDownloadsTable("sound/zombie_revolution/jetpack_fly.mp3");
        AddFileToDownloadsTable("sound/zombie_revolution/jetpack_noenergy.mp3");
        AddFileToDownloadsTable("sound/zombie_revolution/jetpack_firerocket.mp3");
       
        PrecacheSoundAny("zombie_revolution/jetpack_fly.mp3");
        PrecacheSoundAny("zombie_revolution/jetpack_noenergy.mp3");
        PrecacheSoundAny("zombie_revolution/jetpack_firerocket.mp3");
       
        PrecacheModel(JETPACK_ROCKET_MODEL);
}

public void OnPlayerPreThink(int client)
{
        if( !IsPlayerAlive(client) || !g_HasJetpack[client] )
        {       
                return;
        }
       
        static float origin[3], eyeAngles[3], velocity[3];
       
        int flags = GetEntityFlags(client);
        int buttons = GetClientButtons(client);
        int entity = 0;
        float gameTime = GetGameTime() * GetTickInterval();       
       
        if( g_JetpackEnergy[client] < JETPACK_ENERGY && ((flags & FL_ONGROUND) || (flags & FL_INWATER)) )
        {       
                g_JetpackEnergy[client]++;
        }               
        else if( g_JetpackEnergy[client] > 0 && (buttons & IN_JUMP) && (buttons & IN_DUCK) )
        {                               
                GetClientAbsOrigin(client, origin);
                GetClientEyeAngles(client, eyeAngles);
               
                eyeAngles[0] = -40.0;
               
                GetAngleVectors(eyeAngles, velocity, NULL_VECTOR, NULL_VECTOR);
                ScaleVector(velocity, JETPACK_SPEED);
               
                velocity[2] *= 0.8;
               
                TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
               
                g_JetpackEnergy[client]--;               
               
                if( GetRandomInt(0, 2) == 0 )
                {
                        DataPack data = new DataPack();
                       
                        eyeAngles[0] = 110.0;
                        origin[2] += 25.0;
                       
                        PrecacheSoundAny("zombie_revolution/jetpack_fly.mp3");
                        PrecacheSoundAny("zombie_revolution/jetpack_noenergy.mp3");
       
//                        EmitAmbientSoundAny(g_JetpackEnergy[client] > JETPACK_ENERGY / 4 ? "zombie_revolution/jetpack_fly.mp3" : "zombie_revolution/jetpack_noenergy.mp3", NULL_VECTOR, client);
                        EmitSoundToClientAny(client, g_JetpackEnergy[client] > JETPACK_ENERGY / 4 ? "zombie_revolution/jetpack_fly.mp3" : "zombie_revolution/jetpack_noenergy.mp3", SOUND_FROM_PLAYER, SNDCHAN_ITEM, SNDLEVEL_NORMAL, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_HIGH);
                       
                        static char parentname[32], targetname[32];                       
                        Format(parentname, sizeof(parentname), "jetpack_owner_%d", client);
                       
                        DispatchKeyValue(client, "targetname", targetname);                       

                        entity = CreateEntityByName("env_steam");

                        if( IsValidEdict(entity) )
                        {
                                Format(targetname, sizeof(targetname), "jetpack_flame_%d", client);
                               
                                DispatchKeyValue(entity, "parentname", parentname);
                                DispatchKeyValue(entity, "targetname", targetname);                               
                                DispatchKeyValue(entity, "SpawnFlags", "1");
                                DispatchKeyValue(entity, "Type", "0");
                                DispatchKeyValue(entity, "InitialState", "1");
                                DispatchKeyValue(entity, "Spreadspeed", "10");
                                DispatchKeyValue(entity, "Speed", "400");
                                DispatchKeyValue(entity, "Startsize", "20");
                                DispatchKeyValue(entity, "EndSize", "600");
                                DispatchKeyValue(entity, "Rate", "30");
                                DispatchKeyValue(entity, "JetLength", "200");
                                DispatchKeyValue(entity, "RenderColor", "255 100 30");
                                DispatchKeyValue(entity, "RenderAmt", "180");                               
                                DispatchSpawn(entity);
                               
                                TeleportEntity(entity, origin, eyeAngles, NULL_VECTOR);
                               
                                SetVariantString(parentname);

                                AcceptEntityInput(entity, "SetParent", entity, entity, 0);
                                AcceptEntityInput(entity, "TurnOn");
                               
                                data.WriteCell(entity);
                        }
                       
                        entity = CreateEntityByName("env_steam");
                       
                        if( IsValidEdict(entity) )
                        {
                                Format(targetname, sizeof(targetname), "jetpack_flame02_%d", client);
                               
                                DispatchKeyValue(entity, "parentname", parentname);
                                DispatchKeyValue(entity, "targetname", targetname);                               
                                DispatchKeyValue(entity, "SpawnFlags", "1");
                                DispatchKeyValue(entity, "Type", "1");
                                DispatchKeyValue(entity, "InitialState", "1");
                                DispatchKeyValue(entity, "Spreadspeed", "10");
                                DispatchKeyValue(entity, "Speed", "400");
                                DispatchKeyValue(entity, "Startsize", "20");
                                DispatchKeyValue(entity, "EndSize", "600");
                                DispatchKeyValue(entity, "Rate", "10");
                                DispatchKeyValue(entity, "JetLength", "200");
                                DispatchSpawn(entity);

                                TeleportEntity(entity, origin, eyeAngles, NULL_VECTOR);

                                SetVariantString(parentname);

                                AcceptEntityInput(entity, "SetParent", entity, entity, 0);
                                AcceptEntityInput(entity, "TurnOn");
                               
                                data.WriteCell(entity);
                        }
                       
                        CreateTimer(1.0, Timer_RemoveFlame, data);
                }
        }       
       
        if( g_NextRocketTime[client] <= gameTime && (buttons & IN_ATTACK2) )
        {
                entity = CreateEntityByName("hegrenade_projectile");
               
                if( IsValidEdict(entity) )
                {
                        GetClientAbsOrigin(client, origin);
                        GetClientEyeAngles(client, eyeAngles);                       
               
                        GetAngleVectors(eyeAngles, velocity, NULL_VECTOR, NULL_VECTOR);
                        ScaleVector(velocity, JETPACK_ROCKET_SPEED);                                       
                       
                        SetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity", client);                       
                        SetEntProp(entity, Prop_Send, "m_nSolidType", 2);
                        SetEntProp(entity, Prop_Data, "m_takedamage", 2);
                       
                        SetEntityMoveType(entity, MOVETYPE_FLY);
                        SetEntityModel(entity, JETPACK_ROCKET_MODEL);
                       
                        DispatchSpawn(entity);
                       
                        TeleportEntity(entity, origin, NULL_VECTOR, velocity);
                }
               
                g_NextRocketTime[client] = gameTime + JETPACK_ROCKET_DELAY;
        }
}

public void OnPlayerPreThink_Post(int client)
{
        g_MaxSpeed[client] = GetEntPropFloat(client, Prop_Data, "m_flMaxspeed");
}

public Action Timer_RemoveFlame(Handle timer, DataPack data)
{
        static char classname[32];
       
        data.Reset();
       
        int flameEntity = data.ReadCell();
       
        if( IsValidEdict(flameEntity) )
        {
                GetEdictClassname(flameEntity, classname, sizeof(classname));
               
                if( StrEqual(classname, "env_steam") )
                {
                        AcceptEntityInput(flameEntity, "TurnOff");
                        AcceptEntityInput(flameEntity, "Kill");
                }
        }
       
        flameEntity = data.ReadCell();
       
        if( IsValidEdict(flameEntity) )
        {
                GetEdictClassname(flameEntity, classname, sizeof(classname));
               
                if( StrEqual(classname, "env_steam") )
                {
                        AcceptEntityInput(flameEntity, "TurnOff");
                        AcceptEntityInput(flameEntity, "Kill");
                }
        }
       
        delete data;       
}


Kailo 02-22-2017 13:08

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
1 Attachment(s)
emitsoundany.inc with updated syntax.

TheDS1337 03-02-2017 17:11

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

Originally Posted by Kailo (Post 2497564)
emitsoundany.inc with updated syntax.

Did you test this?

Kailo 03-03-2017 09:19

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

Originally Posted by DeagLe.Studio (Post 2500245)
Did you test this?

Yes, i tested.

TheDS1337 03-03-2017 10:10

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

Originally Posted by Kailo (Post 2500385)
Yes, i tested.

I tested with EmitSoundToClientAny and it didnt work :/

Kailo 03-10-2017 04:06

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

Originally Posted by DeagLe.Studio (Post 2500399)
I tested with EmitSoundToClientAny and it didnt work :/

Tested in CS:GO. Working well.
PHP Code:

// ę Maxim "Kailo" Telezhenko, 2017

#pragma semicolon 1
#pragma newdecls required

#include <emitsoundany>

stock const char g_sound[] = "ui/csgo_ui_crate_open.wav";

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_emit"Cmd_Emit);
}

public 
void OnMapStart()
{
    
PrecacheSoundAny(g_sound);
}

// Usage: sm_emit <0|1|2|3>
public Action Cmd_Emit(int clientint args)
{
    if (!
args)
        return 
Plugin_Handled;

    
char arg[4];
    
GetCmdArg(1argsizeof(arg));
    switch (
StringToInt(arg)) {
        case 
0:
            
EmitSoundToClientAny(clientg_sound);
        case 
1:
            
EmitSoundToAllAny(g_sound);
        case 
2: {
            
float origin[3];
            
GetClientAbsOrigin(clientorigin);
            
EmitAmbientSoundAny(g_soundorigin);
        }
        case 
3:
            
StopSoundAny(clientSNDCHAN_AUTOg_sound);
    }

    return 
Plugin_Handled;



TheDS1337 03-14-2017 14:42

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Well, I forgot that I was testing in a Listen Server, maybe thats the reason its not working?

iBradleyy 03-18-2017 13:13

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
I am guessing it doesn't support .wav files.

TheDS1337 03-18-2017 14:55

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

Originally Posted by iBradleyy (Post 2504626)
I am guessing it doesn't support .wav files.

They are mp3, I converted them from wav to mp3.

usla 05-31-2017 07:21

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
did something changed in csgo with all new updates none of my sounds would precache anymore...

dyxL 06-24-2017 10:02

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
i uploaded emitsoundany.inc to include folder but still getting cant create mixer am i should to make different thing ?

Kalle801 06-26-2017 09:37

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

Originally Posted by dyxL (Post 2531324)
i uploaded emitsoundany.inc to include folder but still getting cant create mixer am i should to make different thing ?

Same here

ZASTRELIS 09-02-2017 06:14

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
how works sound dir?

doroemon 11-05-2017 05:19

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
Does anyone work fine with this?
I using this inc to complie plugins but still getting cant create mixer.....

_GamerX 01-20-2018 07:18

Re: EmitSoundAny - Cross-game sound emitting (aka CS:GO compatible) (1.0.2, 2014-03-1
 
How to stop sound from EmitAmbientSoundAny?

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 07:45.

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