Audio Stream
#1

How to check if a play is currently playing an audio stream?
Reply
#2

Not sure if a function exists to find that out. You can, however make a bool and set it to true where you start the stream. Later you can check if the bool is true, if so, you can stop the stream and set the bool to false.
Reply
#3

at your function you could try storing it in a variable like
pawn Code:
//Somewhere on top of your script
new IsPlayingAudio[MAX_PLAYERS];
//Where you have all your commands we make a command to start playing audio and we set the variable to 1 (true)
CMD:audio(playerid, params[])
{
     PlayAudioStreamForPlayer(playerid, "http://test.help");
     IsPlayingAudio[playerid] = 1;
     return 1;
}
//And we make a command to stop the audio and be set the variable to 0 (false)
CMD:stopaudio(playerid, params[])
{
     StopAudioStreamForPlayer(playerid);
     IsPlayingAudio[playerid] = 0;
     return 1;
}
//Then you can detect when the player is playing audio with something like this
public OnPlayerSpawn(playerid)
{
     if(IsPlayingAudio[playerid] = 1)//If the player is playing audio
     {
          SendClientMessage(playerid, -1, "type /stopaudio to stop listening to the music!"):
     }
     return 1;
}
Good luck!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)