Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: how to stop sound?

  1. #11
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    PlaySound is global, and PlayLocalSound is only for players you defined (e.g, self or attacker) I think

  2. The Following 2 Users Say Thank You to EvoloZz For This Useful Post:

    kung foo man (7th March 2013),pollo (6th March 2013)

  3. #12
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    116
    Thanks
    93
    Thanked 69 Times in 35 Posts
    But you could also do (if I am right) this:

    Code:
    soundfunc()
    {
    trig = getent("trig_sound","targetname");
    
    while(1)
    {
    trig waittill("trigger",player);
    player playsound("sound");
    }
    }

    So the sound is only played to the player... Don't know the difference between them, but thanks for the answer anyways

  4. #13
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by pollo View Post
    But you could also do (if I am right) this:

    Code:
    soundfunc()
    {
    trig = getent("trig_sound","targetname");
    
    while(1)
    {
    trig waittill("trigger",player);
    player playsound("sound");
    }
    }

    So the sound is only played to the player... Don't know the difference between them, but thanks for the answer anyways
    Have you read evolvz reply?

    Using code like that will make the player EMIT the sound (is the source of the sound) which will audible for all nearby players.

    player playlocalsound(sound goes here); is the correct way to do it!

  5. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (7th March 2013),pollo (8th March 2013)

  6. #14
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    PlaySound = Play sound at position/origin (everyone near it can hear).
    PlayLocalSound = Play sound only for player
    AmbientPlay = Play on the whole map (It bugs for new joining players, so would be better to use playLocalSound via for() loop)
    No ... No ... this is not possible .......

  7. The Following 2 Users Say Thank You to Earliboy For This Useful Post:

    Ni3ls (7th March 2013),pollo (8th March 2013)

  8. #15
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    116
    Thanks
    93
    Thanked 69 Times in 35 Posts
    Ahhh Understood already :]

    I thought that the sound was played to the player but now I understand the difference^^

    Thank you all!

  9. #16
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Quote Originally Posted by kat_ View Post
    hi, you can stop the music by this way: PlaySound("null");
    This doesnt work for me :/ I still hear the ambient playing

  10. #17
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    Ambient? then use AmbientStop(fadeout time); to stop it

  11. #18
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    That doesnt work. I dont get any error, but the ambient just keeps playing.
    Code:
    musicoff()
    {
    	while(1)
    	{
    		if(getCvar("scr_music") == "1")
    		{
    			AmbientStop(0);
    			AmbientStop("zom_scary");
    		}
    	wait 1;
    	}
    }

  12. #19
    ... connecting iBuddie's Avatar
    Join Date
    Sep 2013
    Location
    mp_toujane
    Posts
    7
    Thanks
    2
    Thanked 1 Time in 1 Post
    I stepped over a problem today: Stopping a sound works with playLocalSound, but not with playSound. This is annoying, as sounds might overlap in some scenarios. The soundalias was:

    Code:
    name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage
    
    test_local,,startsound.mp3,1,1,,,,1000000,,local,streamed,1
    test_stop_local,,stopsound.mp3,1,1,,,,1000000,,local,streamed,1
    Removing the entity, which played the sound, did not help, neither did moving the entity away (the sound stays at the location where it has been played).

    Any known solutions? Playing the desired sound by a playLocalSound loop over all players it not nice, as the distance<->volume curve gets lost.

    Maybe I just forgot something ^^

  13. #20
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by iBuddie View Post
    I stepped over a problem today: Stopping a sound works with playLocalSound, but not with playSound. This is annoying, as sounds might overlap in some scenarios. The soundalias was:

    Code:
    name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage
    
    test_local,,startsound.mp3,1,1,,,,1000000,,local,streamed,1
    test_stop_local,,stopsound.mp3,1,1,,,,1000000,,local,streamed,1

    Removing the entity, which played the sound, did not help, neither did moving the entity away (the sound stays at the location where it has been played).

    Any known solutions? Playing the desired sound by a playLocalSound loop over all players it not nice, as the distance<->volume curve gets lost.

    Maybe I just forgot something ^^
    The soundalias has "local" set for the masterslave channel. Try removing the word "local" so that it defaults to "world".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •