[Help]: Radio system -
sniperwars - 17.01.2014
Hi,
I need a little help with my radio system. Is there a function I can use to
detect if an audio stream is playing ? I have the command /stopradio - This
can be used even when there is no audio stream playing. Anyone who can help me
will get a reputation point.
Kind regards,
Sean
Re: [Help]: Radio system -
Scenario - 17.01.2014
No, there's not a native function for it. Although, I imagine you could hook PlayAudioStreamForPlayer and set a variable to true and then hook StopAudioStreamForPlayer (I think that's the function name) to set that same variable to false. It's worth a shot!
Re: [Help]: Radio system -
sniperwars - 17.01.2014
Thank you for the quick response. Could you walk me through on how to do that ? I tried
using a boolean value but that wasn't successful
Respuesta: [Help]: Radio system -
Stront - 17.01.2014
Just a variable with playerid array.
Код:
new Streaming[MAX_PLAYERS];
//When you use PlayAudioStreamForPlayer
Streaming[playerid/i/whatever you use in the scripting] = 1;
//When you use StopAudioStreamForPlayer
Streamer[playerid] = 0;
//When you want to detect if it's streaming something.
if(Streamer[playerid] == 1)
It seems basic for me, but I dunno if it's gonna work. You'll have to do that in all the PlayAudio and StopAudio used.
Re: [Help]: Radio system -
Ace155 - 17.01.2014
What exactly do you need it for?
If it's for a player exiting a car you could use this:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
// If the player exits a vehicle
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
StopAudioStreamForPlayer(playerid); // Stop the audio stream
}
return 1;
}
Re: [Help]: Radio system -
sniperwars - 17.01.2014
Thanks Stront, one reputation from me
Re: [Help]: Radio system -
sniperwars - 17.01.2014
*Fixed. Thread can be locked.
Respuesta: [Help]: Radio system -
Stront - 17.01.2014
You're welcome bro, I hope it helped you.
Re: [Help]: Radio system -
Mattakil - 18.01.2014
If your using this in a car, you should also store the string of the URL to the vehicleid, so when the player gets back in the vehicle, the audio plays again :P