Playing sound just for one player

Discussion in 'Plugin Development' started by mouz_, Nov 30, 2015.

Thread Status:
Not open for further replies.
  1. Hi,

    how can I play sound to just one player, so nobody else can hear it?
     
  2. Offline

    sgavster

    I'm not going to feed you code, but it's very simple.

    You user player.playSound(location, sound, pitch, volume)
     
    Last edited: Nov 30, 2015
  3. Offline

    Zombie_Striker

    @sgavster
    1. One line is not spoonfeeding.
    2. That would not work. You also need the pitch and the volume. (The pitch should be 1, and the volume's max is 10.)
     
  4. Offline

    sgavster

    @Zombie_Striker Yeah, true. Really depends on your opinion, I've heard a million definitions on spoon feeding.

    And yeah, I forgot that.. Haha, sorry, I was in a rush with no IDE.
     
  5. So other players near this player won't hear this sound?
     
  6. Offline

    Zombie_Striker

    @mouz_
    Yes. If you want All other players near the player to hear it, then loop through all players online. If you want a select few from a group of player to hear the sound, add them to an array, loop through it, and use playerInArray.playSound()
     
Thread Status:
Not open for further replies.

Share This Page