Raised This Month: $ Target: $400
 0% 

server-side sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-24-2019 , 13:11   server-side sound
Reply With Quote #1

Hello, I'm trying to emit sounds on server-side (spk or mp3 play), so I will not need to replay sound when player connect.

I noticed that the call of client_cmd with index 0 will loop through all connected players, so won't work.
https://github.com/alliedmodders/amx...modx.cpp#L2008

I tried with server_cmd but doesn't work. Any suggestion?
__________________








CrazY. is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 01-24-2019 , 16:15   Re: server-side sound
Reply With Quote #2

What do "server-side sound" means?

Client can hear a sound because it has sound file in his /sound/ dir.
To start playing a sound the client has to recieve "play this sound" command from the server, by client_cmd() ("spk" or "mp3 play") or emit_sound().
If the client is not connected when the command is sent, it won't hear anything after connect.
__________________
My English is A0

Last edited by E1_531G; 01-24-2019 at 16:16.
E1_531G is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-24-2019 , 17:56   Re: server-side sound
Reply With Quote #3

Quote:
If the client is not connected when the command is sent, it won't hear anything after connect.
I want to make it so whoever connect will hear the sound as well. I will try with ambient_generic.
__________________








CrazY. is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-25-2019 , 08:50   Re: server-side sound
Reply With Quote #4

I tested following code. I want to trigger at any time calling "CAmbientGeneric::ToggleUse" (force_use or Ham_Use), but for some reason it's not working; The sound it's emitted properly without spawnflag SF_AMBIENT_SOUND_NOT_LOOPING but I can't toggle it on/off.

Code:
#define BIT(%0) (1<<%0) #define SF_AMBIENT_SOUND_EVERYWHERE     BIT(0) #define SF_AMBIENT_SOUND_NOT_LOOPING    BIT(5) [...] public plugin_precache() {     new pAmbient = create_entity("ambient_generic");     entity_set_int(pAmbient, EV_INT_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE|SF_AMBIENT_SOUND_NOT_LOOPING);     entity_set_string(pAmbient, EV_SZ_message, "ambience/Opera.wav");     entity_set_float(pAmbient, EV_FL_health, 10.0);     DispatchSpawn(pAmbient);     force_use(pAmbient, pAmbient); }
__________________









Last edited by CrazY.; 01-25-2019 at 09:10.
CrazY. is offline
Reply


Thread Tools
Display Modes

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


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