AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved emit_sound help (https://forums.alliedmods.net/showthread.php?t=338555)

thebest24 07-12-2022 04:26

emit_sound help
 
hi again. i want add sound effects on menu, when you have not access to item and select that it will play no access sound for that player, but when i put sound all players can hear it.

i use this code for sound

emit_sound(id, CHAN_STATIC, "ambience/noaccess.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

and 1 player plays it everyone hear that how can i make it only for that player?
or is there other code for it?

Natsheh 07-12-2022 04:34

Re: emit_sound help
 
Use client_cmd(id, "spk ^"ambience/noaccess.wav^"");

thebest24 07-12-2022 04:57

Re: emit_sound help
 
it worked :)

thebest24 10-02-2022 06:39

Re: emit_sound help
 
also i wonder how can i disable emit or spk sound while its playing?

MrPickles 10-02-2022 15:13

Re: emit_sound help
 
Quote:

Originally Posted by thebest24 (Post 2790187)
also i wonder how can i disable emit or spk sound while its playing?

You cant stop the sound of spk
for emit sound, you can emit a new sound with the same channel of your previous emit sound, that new emit sound it will be a null sound( a .wav of 1 seg and 0% of volume )

deprale 10-02-2022 18:22

Re: emit_sound help
 
Quote:

Originally Posted by MrPickles (Post 2790219)
You cant stop the sound of spk

That's false, you can!

stopsound -> console command!

MrPickles 10-02-2022 18:29

Re: emit_sound help
 
Quote:

Originally Posted by deprale (Post 2790228)
That's false, you can!

stopsound -> console command!

oo i didnt know it, thanks if that works

fysiks 10-02-2022 22:13

Re: emit_sound help
 
Stopsound is a client command and I would consider this slowhacking because it affects way more than just the sound that you force the player to hear.

deprale 10-02-2022 23:52

Re: emit_sound help
 
Well, slowhacking is a grey area depending on how you use it - but aside that, you are right it also stops map sounds as well (for example de_train airplane, or even the truck sounds in T spawn), also nades and etc.

I guess stopsound would only be useful in very specific cases.

fysiks 10-04-2022 00:00

Re: emit_sound help
 
Quote:

Originally Posted by deprale (Post 2790251)
Well, slowhacking is a grey area depending on how you use it.

Generally, I agree with that sentiment. If it were something that only affected what you're plugin was doing (or even other plugins) then I wouldn't have an issue.


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

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