attach PlayAudioStream to a player?
#3

The solution above is good, but to do it yourself, basically:

- Keep constant track of the position of the players who have ongoing streams.
- Have a player variable ("Listening") for everyone which contains either the ID of the player who's stream they're near of, or INVALID_PLAYER_ID if none.
- Constantly (1 second timer perhaps) check for wether each individual player is near a player with a stream, and act accordingly:

1. If a player has their "Listening" variable as INVALID_PLAYER_ID and is near no stream, do nothing.
2. If a player has their "Listening" variable as INVALID_PLAYER_ID and is near a stream, assign that variable to the nearby player and start the stream.
3. If a player has their "Listening" variable the same as the nearby player who is streaming, do nothing.
4. If a player has their "Listening" variable as a player but now there's nothing near, stop the stream and set their "Listening" back to INVALID_PLAYER_ID.
5. Finally, if a player has their "Listening" variable as a player, but is now closer to another player with a stream, stop the previous stream, start the new one, and update the "Listening" variable.

Sounds complicated, but I reckon this solution can be factored in such a way that it'd take a meaningless amount of time to run.
Reply


Messages In This Thread
attach PlayAudioStream to a player? - by ShiffeyTheGamer - 26.01.2020, 20:50
Re: attach PlayAudioStream to a player? - by Davi52 - 26.01.2020, 21:07
Re: attach PlayAudioStream to a player? - by Markski - 26.01.2020, 21:32

Forum Jump:


Users browsing this thread: 1 Guest(s)