Raised This Month: $ Target: $400
 0% 

Can't stop entities emit_sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 07-12-2012 , 18:35   Can't stop entities emit_sound
Reply With Quote #1

I'm starting the sound for env_sprite entity like this:

Code:
emit_sound(ent, CHAN_STATIC, "ambience/alien_beacon.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
The sound loops all the time, it's fine for me.

But before deleting the entity, I want the sound to stop playing, so I use:

Code:
emit_sound(ent, CHAN_STATIC, "ambience/alien_beacon.wav", VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)
But that does not work, the sound still plays.

Also tried this:

Code:
message_begin(MSG_BROADCAST, SVC_STOPSOUND)
write_short(ent)
message_end()
Doesn't work either (maybe I use it wrong?)

The only thing that worked was client_cmd(0, "stopsound"), but that is not suitable for me because it stops other sounds.

So how to stop the sound?

Last edited by BeasT; 07-12-2012 at 18:51.
BeasT is offline
Send a message via Skype™ to BeasT
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-12-2012 , 18:39   Re: Can't stop entities emit_sound
Reply With Quote #2

Emit an empty sound.
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-12-2012 , 18:40   Re: Can't stop entities emit_sound
Reply With Quote #3

Quote:
But after deleting the entity
Just to be sure, you remove the entity AFTER throwing emit_sound, right ?
__________________
Arkshine is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 07-12-2012 , 18:50   Re: Can't stop entities emit_sound
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
Just to be sure, you remove the entity AFTER throwing emit_sound, right ?
Yes. I meant before.

Quote:
Originally Posted by hleV View Post
Emit an empty sound.
I tried emiting ambience/_comma.wav. But it also didn't stop it.
BeasT is offline
Send a message via Skype™ to BeasT
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-12-2012 , 19:03   Re: Can't stop entities emit_sound
Reply With Quote #5

Try common/null.wav.
hleV is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 07-13-2012 , 08:32   Re: Can't stop entities emit_sound
Reply With Quote #6

Same...

Using different channels didn't help also..
BeasT is offline
Send a message via Skype™ to BeasT
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-13-2012 , 09:46   Re: Can't stop entities emit_sound
Reply With Quote #7

SND_STOP should work.

I've tried your sound, with 2 commands, to start/stop the sound, and SND_STOP stops well the sound.
__________________

Last edited by Arkshine; 07-13-2012 at 09:46.
Arkshine is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 07-13-2012 , 11:10   Re: Can't stop entities emit_sound
Reply With Quote #8

Did you tried it on a custom entity or on a player? Post your example.
BeasT is offline
Send a message via Skype™ to BeasT
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-13-2012 , 11:33   Re: Can't stop entities emit_sound
Reply With Quote #9

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> new Entity; public plugin_precache() {     precache_sound( "ambience/alien_beacon.wav" ); } public plugin_init() {     register_clcmd( "say cr", "ClientCommand_Create" );     register_clcmd( "say s1", "ClientCommand_StartSound" );     register_clcmd( "say s2", "ClientCommand_StopSound" ); } public ClientCommand_Create( const client ) {     new Float:origin[3];     pev( client, pev_origin, origin );         Entity = create_entity( "info_target" );     set_pev( Entity, pev_origin, origin );     return PLUGIN_HANDLED; } public ClientCommand_StartSound( const client ) {     emit_sound( Entity, CHAN_STATIC, "ambience/alien_beacon.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM );     return PLUGIN_HANDLED; } public ClientCommand_StopSound( const client ) {     emit_sound( Entity, CHAN_STATIC, "ambience/alien_beacon.wav", VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM );     return PLUGIN_HANDLED; }


Tried with player and entity, both way stop the sound.
__________________
Arkshine is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-13-2012 , 12:16   Re: Can't stop entities emit_sound
Reply With Quote #10

Even though it doesn't really matter, what's the reason behind including Fakemeta only for getting/setting origin when Engine has equivalent funtions for that? xD
hleV 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 15:10.


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