08.01.2014, 11:42
How to check if a play is currently playing an audio stream?
//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;
}