Raised This Month: $ Target: $400
 0% 

[ SOLVED ] Stop specified sound?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-31-2015 , 16:37   [ SOLVED ] Stop specified sound?
Reply With Quote #1

How do i stop playing a specific sound, for example:

PHP Code:
#include < amxmodx >

new const SOUND[] = "sounds/test";

public 
plugin_init()
{
    
register_event("HLTV""event_round_start""a""1=0""2=0");
}

public 
event_round_start(id)
{
    
client_cmd(id"spk test/%s"SOUND);
}

public function(
id)
{
    
client_cmd(id"stopsound %s"SOUND);

__________________









Last edited by CrazY.; 11-02-2015 at 12:37.
CrazY. is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 10-31-2015 , 19:13   Re: [ HELP ] Stop specified sound?
Reply With Quote #2

First off, correct this.

PHP Code:
new const SOUND[] = "sounds/test"

PHP Code:
new const SOUND[] = "test.wav"
Second, you should precache it

And third, what are you exactly trying to do? Do you want to stop the sound at a point?
This might be the answer If I'm not wrong.

PHP Code:
// Add this under client_cmd in event_round_start
set_task(0.5"function"); // Or any time you think is good enough for your sound 
Oh and client_cmd is not supported here, but this looks like a harmless plugin.

Last edited by redivcram; 10-31-2015 at 19:14. Reason: typo
redivcram is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-31-2015 , 19:37   Re: [ HELP ] Stop specified sound?
Reply With Quote #3

Quote:
Originally Posted by redivcram
First off, correct this.

PHP Code:
new const SOUND[] = "sounds/test"

PHP Code:
new const SOUND[] = "test.wav"
Second, you should precache it...
I know about this. My code is a only test.

Quote:
Originally Posted by redivcram
And third, what are you exactly trying to do? Do you want to stop the sound at a point?
I want only the sound that ran stop playing, the other common sounds of the game continues, you know?
__________________








CrazY. is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 10-31-2015 , 20:10   Re: [ HELP ] Stop specified sound?
Reply With Quote #4

Only possible through emit_sound() since client_cmd() is sended like the client wrote it himself (it has to be broadcasted through a channel to stop the snd which it doesn't via client_cmd()). Which means you cannot stop a specific sound when you've executed a client-sided cmd through client_cmd().

Last edited by Rirre; 10-31-2015 at 20:41.
Rirre is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-01-2015 , 09:39   Re: [ HELP ] Stop specified sound?
Reply With Quote #5

With emit_sound() is possible?
Please show a example.
__________________








CrazY. is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 11-01-2015 , 14:03   Re: [ HELP ] Stop specified sound?
Reply With Quote #6

Use SND_STOP flag.
amxconst.inc
Code:
#define SND_STOP		(1<<5)		// stop sound
Rirre is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-02-2015 , 08:01   Re: [ HELP ] Stop specified sound?
Reply With Quote #7

How does this fit in my code?
Please show the full code.
__________________








CrazY. is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 11-02-2015 , 08:25   Re: [ HELP ] Stop specified sound?
Reply With Quote #8

https://forums.alliedmods.net/showthread.php?t=226690

Another idea is to convert the sound into mp3 format. If there aren't any other mp3 sound files playing while this is being played.
In that case you can send "mp3 stop" whenever you want your (mp3) sound file to stop play.

Last edited by Rirre; 11-02-2015 at 08:25.
Rirre is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-02-2015 , 08:36   Re: [ HELP ] Stop specified sound?
Reply With Quote #9

PHP Code:
client_cmd(id"mp3 play ^"file.mp3^""); 

PHP Code:
client_cmd(id"mp3 stop ^"file.mp3^""); 
?
__________________








CrazY. is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 11-02-2015 , 12:19   Re: [ HELP ] Stop specified sound?
Reply With Quote #10

Code:
client_cmd (id, "mp3 play filename") client_cmd (id, "mp3 stop")
Rirre 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 18:03.


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