Raised This Month: $18 Target: $400
 4% 

EmitSoundToAll problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-25-2015 , 16:51   EmitSoundToAll problem
Reply With Quote #1

Hello, i need to make small plugin with table where i can start music and stop music. Start Music works fine, but i cant stop music and if i start another music, i have here StopSound and then emit... for next song, but song didnt stop and play another, then i hear two songs at a time. Can someone help me please? Here is a example for a code, i test SNDCHAN_AUTO too. Thanks

Code:
public Action:HudbaTabulka(client, args){     new Handle:hudba = CreateMenu(HudbaMenu);     SetMenuTitle(hudba, "[SM] URNA Hudba Menu DJ");     AddMenuItem(hudba, "mathew", "Matthew Strider");     AddMenuItem(hudba, "poltergeist", "Poltergeist");     SetMenuPagination(hudba, 7);     SetMenuExitButton(hudba, true);     DisplayMenu(hudba, client, MENU_TIME_FOREVER); } public HudbaMenu(Handle:hudba, MenuAction:action, client, Position){     new String:item[32];     if(action == MenuAction_Select){         GetMenuItem(hudba, Position, item, sizeof(item));         if(StrEqual(item, "mathew")){             for(new i = 1; i <= GetMaxClients(); i++){                 if(IsClientInGame(i)){                     StopSound(i, 8, "urna/matthewstrider.mp3");                     StopSound(i, 8, "urna/poltergeist.mp3");                 }             }             EmitSoundToAll("urna/matthewstrider.mp3", SOUND_FROM_WORLD, 8, SNDLEVEL_AIRCRAFT);         }         else if(StrEqual(item, "poltergeist")){             for(new i = 1; i <= GetMaxClients(); i++){                 if(IsClientInGame(i)){                     StopSound(i, 8, "urna/matthewstrider.mp3");                     StopSound(i, 8, "urna/poltergeist.mp3");                 }             }             EmitSoundToAll("urna/poltergeist.mp3", SOUND_FROM_WORLD, 8, SNDLEVEL_AIRCRAFT);         }     } }

Last edited by BAILANDO; 03-25-2015 at 16:52.
BAILANDO is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 03-25-2015 , 18:46   Re: EmitSoundToAll problem
Reply With Quote #2

Where did you use SNDCHAN_AUTO? You should use it where you're using SOUND_FROM_WORLD, as well as in StopSound() where you have 8.
bl4nk is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-26-2015 , 07:22   Re: EmitSoundToAll problem
Reply With Quote #3

i try it with SNDCHAN_AUTO too, but its same, sound didnt stop and i hear another music, then two songs at time
BAILANDO is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-26-2015 , 07:27   Re: EmitSoundToAll problem
Reply With Quote #4

Code:
public HudbaMenu(Handle:hudba, MenuAction:action, client, Position){     new String:item[32];     if(action == MenuAction_Select){         GetMenuItem(hudba, Position, item, sizeof(item));         if(StrEqual(item, "mathew")){             for(new i = 1; i <= GetMaxClients(); i++){                 if(IsClientInGame(i)){                     StopSound(i, SNDCHAN_AUTO, "urna/matthewstrider.mp3");                     StopSound(i, SNDCHAN_AUTO, "urna/poltergeist.mp3");                 }             }             EmitSoundToAll("urna/matthewstrider.mp3", SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_AIRCRAFT);         }         else if(StrEqual(item, "poltergeist")){             for(new i = 1; i <= GetMaxClients(); i++){                 if(IsClientInGame(i)){                     StopSound(i, SNDCHAN_AUTO, "urna/matthewstrider.mp3");                     StopSound(i, SNDCHAN_AUTO, "urna/poltergeist.mp3");                 }             }             EmitSoundToAll("urna/poltergeist.mp3", SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_AIRCRAFT);         }         else if(StrEqual(item, "scary")){             for(new i = 1; i <= GetMaxClients(); i++){                 if(IsClientInGame(i)){                     StopSound(i, SNDCHAN_AUTO, "urna/matthewstrider.mp3");                     StopSound(i, SNDCHAN_AUTO, "urna/poltergeist.mp3");                 }             }             EmitSoundToAll("urna/poltergeist.mp3", SOUND_FROM_WORLD, SNDCHAN_AUTO, SNDLEVEL_AIRCRAFT);         }     } }

this didnt work too.
BAILANDO is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 03-27-2015 , 01:19   Re: EmitSoundToAll problem
Reply With Quote #5

Was drinking when I made my reply, and what I was trying to say didn't come out right. You're playing the sound from the world, and trying to stop it on the client. I think that your problem is that you should play the sound from the client, or try to stop the sound on entity 0 instead.
bl4nk is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-27-2015 , 08:47   Re: EmitSoundToAll problem
Reply With Quote #6

Oh, okey, i try it. Thanks.
BAILANDO is offline
Reply


Thread Tools
Display Modes

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 14:07.


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