Raised This Month: $51 Target: $400
 12% 

[CS:GO] Map Music (request)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 10-25-2016 , 17:22   [CS:GO] Map Music (request)
Reply With Quote #1

I want a plugin that allows me to play an ambience theme that starts every round (same theme). Also some cvar that can stop it would be great. I don't need it compiled, just the code where you also precache the sound, because I don't really know how to do it. That would be great, thanks in advice.
__________________
valio_skull is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 10-25-2016 , 17:47   Re: [CS:GO] Map Music (request)
Reply With Quote #2

not tested, but should work

PHP Code:
#include <sourcemod>
#include <emitsoundany>


#pragma semicolon 1
#pragma newdecls required


public void OnPluginStart()
{
    
RegAdminCmd("sm_stopambient"AdminCommand_StopADMFLAG_GENERIC);
    
    
HookEvent("round_start"Event_RoundStart);
}


public 
Action AdminCommand_Stop(int clientint args)
{
    for (
int i 1<= MaxClientsi++)
        
StopSoundAny(iSNDCHAN_AUTO"music/ambient.mp3");
    
    return 
Plugin_Handled;
}


public 
void OnMapStart()
{
    
PrecacheSoundAny("music/ambient.mp3");
    
AddFileToDownloadsTable("sound/music/ambient.mp3");
}


public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
EmitAmbientSoundAny("music/ambient.mp3"NULL_VECTOR);

edit: while posting this i just remember about this: [ANY] Ambient Sounds
__________________
coding & free software

Last edited by shanapu; 10-25-2016 at 17:50. Reason: edit
shanapu is offline
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 10-26-2016 , 12:26   Re: [CS:GO] Map Music (request)
Reply With Quote #3

Quote:
Originally Posted by shanapu View Post
not tested, but should work
Thank you very much, I've just compiled it but I can't test it right now because I don't have access to a host, but tomorrow I'll have one to test it.
__________________
valio_skull is offline
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 10-29-2016 , 05:06   Re: [CS:GO] Map Music (request)
Reply With Quote #4

It has a problem. Players can hear it only in some parts of the map, not everywhere...can you solve this ?
__________________
valio_skull is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 10-29-2016 , 08:23   Re: [CS:GO] Map Music (request)
Reply With Quote #5

Quote:
Originally Posted by valio_skull View Post
It has a problem. Players can hear it only in some parts of the map, not everywhere...can you solve this ?
Let's try EmitSoundToAllAny instead of EmitAmbientSoundAny

PHP Code:
#include <sourcemod>
#include <emitsoundany>


#pragma semicolon 1
#pragma newdecls required


public void OnPluginStart()
{
    
RegAdminCmd("sm_stopambient"AdminCommand_StopADMFLAG_GENERIC);
    
    
HookEvent("round_start"Event_RoundStart);
}


public 
Action AdminCommand_Stop(int clientint args)
{
    for (
int i 1<= MaxClientsi++)
        
StopSoundAny(iSNDCHAN_AUTO"music/ambient.mp3");
    
    return 
Plugin_Handled;
}


public 
void OnMapStart()
{
    
PrecacheSoundAny("music/ambient.mp3");
    
AddFileToDownloadsTable("sound/music/ambient.mp3");
}


public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
EmitSoundToAllAny("music/ambient.mp3");

__________________
coding & free software

Last edited by shanapu; 10-29-2016 at 08:23.
shanapu is offline
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 10-29-2016 , 09:09   Re: [CS:GO] Map Music (request)
Reply With Quote #6

same thing, works only on a few spots on the map...idk why
__________________
valio_skull is offline
valio_skull
Senior Member
Join Date: Jan 2013
Location: at home
Old 10-29-2016 , 09:14   Re: [CS:GO] Map Music (request)
Reply With Quote #7

and also, I don't know if it will intersect with cs:go's default music, because that's the only thing i can hear. No ambiental music.
__________________
valio_skull is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 10-29-2016 , 09:45   Re: [CS:GO] Map Music (request)
Reply With Quote #8

Quote:
Originally Posted by valio_skull View Post
same thing, works only on a few spots on the map...idk why
hmmm I'm at work right now and can't test it. IIRC EmitSoundToAllAny should do it global. If you are not total new to sourcepawn you could try with different flags. https://forums.alliedmods.net/showthread.php?t=237045

Quote:
Originally Posted by valio_skull View Post
and also, I don't know if it will intersect with cs:go's default music, because that's the only thing i can hear. No ambiental music.
I putted the mp3 file in ".../music/" so it will dependent on clients music volume.
__________________
coding & free software
shanapu 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 12:57.


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