AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   server-side sound (https://forums.alliedmods.net/showthread.php?t=313836)

CrazY. 01-24-2019 13:11

server-side sound
 
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?

E1_531G 01-24-2019 16:15

Re: server-side sound
 
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.

CrazY. 01-24-2019 17:56

Re: server-side sound
 
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. 01-25-2019 08:50

Re: server-side sound
 
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); }


All times are GMT -4. The time now is 07:36.

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