AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved SVC_STOPSOUND message (https://forums.alliedmods.net/showthread.php?t=340495)

damage220 11-21-2022 22:21

SVC_STOPSOUND message
 
How should I use this message? I cannot get it to work.
PHP Code:

message_begin(MSG_ONESVC_STOPSOUND, {000}, pid);
write_short(pid);
message_end(); 

According to the doc:
Quote:

SVC_STOPSOUND
Stops an ambient sound.

Name: SVC_STOPSOUND
Structure: short EntityIndex
Am I correct to think that this is server side alternative to "stopsound" console command?

MrPickles 11-22-2022 01:34

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by damage220 (Post 2793389)
How should I use this message? I cannot get it to work.
PHP Code:

message_begin(MSG_ONESVC_STOPSOUND, {000}, pid);
write_short(pid);
message_end(); 

According to the doc:

Am I correct to think that this is server side alternative to "stopsound" console command?

client_cmd( id, "stopsound" );

should work to stop the ambient sound, i tested

Celena Luna 11-22-2022 02:15

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by MrPickles (Post 2793393)
client_cmd( id, "stopsound" );

should work to stop the ambient sound, i tested

Stop sound will stop all sound currently playing on the client
So depend what you need, it could be bad if you just want to silent 1 entity

damage220 11-22-2022 14:12

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by MrPickles (Post 2793393)
client_cmd( id, "stopsound" );

should work to stop the ambient sound, i tested

And indeed it works. It is how I currently stop ambient sound. I just assumed that this command triggers procedure:
1. Server sends "stopsound" to client
2. Client executes the command telling the server to stop the sound
3. Server stops the sound for the client

And so I decided to optimize the process. Does it make sense or the command need no server to stop the sound? I mean is it fully client side command with no further server communication?

damage220 11-22-2022 14:16

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by Celena Luna (Post 2793395)
Stop sound will stop all sound currently playing on the client
So depend what you need, it could be bad if you just want to silent 1 entity

I do not completely understand the message. Ii it supposed to stop the sound that a player hears, or it should stop the sound that the entity produce?

MrPickles 11-22-2022 14:16

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by Celena Luna (Post 2793395)
Stop sound will stop all sound currently playing on the client
So depend what you need, it could be bad if you just want to silent 1 entity

You only stop it when the client enters the server, it will only stop the ambient sound, because the client at that moment will not be playing any other sound

Quote:

Originally Posted by damage220 (Post 2793457)
And indeed it works. It is how I currently stop ambient sound. I just assumed that this command triggers procedure:
1. Server sends "stopsound" to client
2. Client executes the command telling the server to stop the sound
3. Server stops the sound for the client

And so I decided to optimize the process. Does it make sense or the command need no server to stop the sound? I mean is it fully client side command with no further server communication?


and for this, the ambient sound is independent of each user/client

kww 11-23-2022 10:13

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by damage220 (Post 2793458)
I do not completely understand the message. Ii it supposed to stop the sound that a player hears, or it should stop the sound that the entity produce?

It immediately stops every sound player hear

damage220 11-25-2022 06:20

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by kww (Post 2793537)
It immediately stops every sound player hear

Then why does it do nothing when I send it? I can still hear ambient sound on de_train or de_aztec, unlike when I issue stopsound command. You can see the code at the beginning of this thread (pid is player id).

MrPickles 11-25-2022 16:47

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by damage220 (Post 2793660)
Then why does it do nothing when I send it? I can still hear ambient sound on de_train or de_aztec, unlike when I issue stopsound command. You can see the code at the beginning of this thread (pid is player id).

You are getting too complicated for something very simple, just use stopound, the efficiency is minimal and almost irrelevant, just place it once when you enter the server and that's it

damage220 11-26-2022 01:16

Re: SVC_STOPSOUND message
 
Quote:

Originally Posted by MrPickles (Post 2793712)
You are getting too complicated for something very simple, just use stopound, the efficiency is minimal and almost irrelevant, just place it once when you enter the server and that's it

As far as I know you cannot use this command on client connect. It works only after spawn and have to be issued every round. Okay, I understand your point. It is not that important. I usually try to improve things if I can.


All times are GMT -4. The time now is 20:33.

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