Help with audio streaming -
Compton - 27.06.2012
Hello, I would like to ask if someone can help me solve a little problem that I dont know how to define with the music stream.
I want my vehicle radio to work like so:
That all the passangers will hear the same radio station as driver chosen, and they wont be able to change it, they should be only able to turn it off for themselves if they want
p.s. If any code line will be needed, ask.
-Thank you
Re: Help with audio streaming -
Kindred - 27.06.2012
Make it so it checks if the player is driver when he uses the command to change the station. If it is, allow them to continue. Then, set the audiostream for the playerid (driver) and then you can make a loop to check what players are in the vehicle with you, and set there audiostream as-well.
Example:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
PlayAudioStreamForPlaeyr(.......);
}
}
If you want them to stop the current music playing, use:
StopAudioStreamForPlayer
Re: Help with audio streaming -
Compton - 27.06.2012
Well look how I did it(How I understood):
I allowed the usage of the /radio cmd in the car only for the driver, passangers cant use it(Cmd is a Dialog)
Then I added things like you told me in each Stream Dialog Response like so:
Код:
if(listitem == 17)// The Breeze(Jazz)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=133405");
}
}
}
But it doesnt work, it just messed things up, now the stream will play twice for me, and if ill stop the stream the music will continue playing.
Passangers dont hear nothing
Re: Help with audio streaming -
Kindred - 27.06.2012
This is how you would do it:
pawn Код:
if(listitem == 17)// The Breeze(Jazz)
{
PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=133405");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
PlayAudioStreamForPlayer(i,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=133405");
}
}
}
Now, since you said that stopping it doesn't, well, stop it, show me the code.
Re: Help with audio streaming -
Compton - 27.06.2012
No, you probably didnt get it, when I tried the cmd the way I made it and did /stop, it stopped the main stream, and removed the song name from the screen, but there was another background stream that was working even if I ctrl + deleted the game(bug)
Ill try this one out and ill tell you if it worked in a second.
Re: Help with audio streaming -
Compton - 27.06.2012
Nevermind, I fixed the problem, all works.
Thank you
Rep +1