Raised This Month: $32 Target: $400
 8% 

ClientCommand(client, "play


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-26-2019 , 09:35   ClientCommand(client, "play
Reply With Quote #1

Hi,
Is there a way to set volume of sound played by this command?
I thought that i saw sth before, but can't find it out now anyway
ClientCommand(client, "play xxx");

Last edited by supertimor; 06-26-2019 at 09:35.
supertimor is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 06-26-2019 , 10:17   Re: ClientCommand(client, "play
Reply With Quote #2

no, u cant set the volume in this way.

check this
https://sm.alliedmods.net/new-api/sd...ound/EmitSound

Last edited by farawayf; 06-26-2019 at 10:17.
farawayf is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-26-2019 , 10:33   Re: ClientCommand(client, "play
Reply With Quote #3

Its not working in my plugin. Its.. quite undefined why. Sometimes it works, sometimes not. One player can hear it, another nope. Anyway, tried also with EmitSoundAny, with same result.
If i can't set volume, then ok. Unfortunately thanks!
supertimor is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-26-2019 , 16:31   Re: ClientCommand(client, "play
Reply With Quote #4

Which game?

Provide an example of how your calling it.
__________________
Neuro Toxin is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-29-2019 , 08:17   Re: ClientCommand(client, "play
Reply With Quote #5

CS:GO.
I am getting path's to files using steamworks. Eveything is fine, i have paths and precached sounds.
There is scratch from menu, where you can play all sounds and check it.

Quote:
public int OdsluchHandler(Menu menu, MenuAction action, int client,int param)
{
if(action == MenuAction_Select)
{
char mvp_name[100];
GetMenuItem(menu, param, mvp_name, sizeof(mvp_name));
char sound[100];
int iDoOdsluchu;
iDoOdsluchu = DoOdsluchu[client];
Format(sound, sizeof(sound), "%s", roundsound_sciezka[iDoOdsluchu]);
StopSound(client, SNDCHAN_STATIC, sound);

if(StrContains(mvp_name, "VIP", false) != -1)
{
if(GetUserFlagBits(client) & ADMFLAG_RESERVATION)
{
DoOdsluchu[client] = FindMVPIDByName(mvp_name);
}
else
{
PrintToChat(client, "%s Aby móc wybrać ten hymn, będziesz musiał posiadać VIP.", PREFIX);
DoOdsluchu[client] = FindMVPIDByName(mvp_name);
}
}
else
{
DoOdsluchu[client] = FindMVPIDByName(mvp_name);
}
PrintToChat(client, "%s Hymn - %s", PREFIX, mvp_name);
iDoOdsluchu = DoOdsluchu[client];
Format(sound, sizeof(sound), "%s", roundsound_sciezka[iDoOdsluchu]);
ClientCommand(client, "playgamesound Music.StopAllMusic");
EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SNDCHAN_STATIC, SNDLEVEL_NONE, _, VolMVP[client]);
DisplayOdsluchMenu(client);
}
if(action == MenuAction_End)
{
delete menu;
}
}
I've noticed, that you can hear every sound in CT and SPECT, nor in T.
I don't have any f*cking clue why, i don't have anything about teams in this code, and in includes also.
supertimor is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-02-2019 , 15:12   Re: ClientCommand(client, "play
Reply With Quote #6

Despite my request to Valve that obviously care about us, servers aren't allowed to make player's write "playvol" which does what you wanted, so use EmitSound.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 07-02-2019 , 18:10   Re: ClientCommand(client, "play
Reply With Quote #7

This for Windows or Linux?
MasterMind420 is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 07-05-2019 , 05:18   Re: ClientCommand(client, "play
Reply With Quote #8

Server is hosted on linux system.
supertimor is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 07-05-2019 , 11:15   Re: ClientCommand(client, "play
Reply With Quote #9

This is just an example but try using this instead for linux...

EmitGameSoundToClient(client, "AutoShotgun.FireIncendiary", SOUND_FROM_PLAYER, SND_NOFLAGS);

This is from my Thirdperson shoulder shotgun sound fix plugin for linux...it may not make any difference. But what may be causing your problems are the extra settings you're setting SNDLEVEL_NONE may be an issue, SNDCHAN_STATIC should be fine. experiment with various settings until u find what works. EmitGameSoundToClient is linux only, will cause crashes on windows servers I believe. Also wouldn't hurt to do this as well. Although EmitGameSoundToClient may only actually work with actual game sounds and not custom ones. Just some thoughts...

Code:
public void OnMapStart()
{
	PrefetchSound(sound);
	PrecacheSound(sound, true);
}
Worst case scenario you can specifically target people on different teams for the sound and see what happens...

Last edited by MasterMind420; 07-05-2019 at 11:25.
MasterMind420 is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 07-05-2019 , 14:56   Re: ClientCommand(client, "play
Reply With Quote #10

Thanks for reply.
I am going to play custom sounds only, so EmitGameSoundToClient is little bit useless for me already.
I'll try with these settings as you said, and check it if works. Thanks.
supertimor 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 17:04.


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