Car / Vehicle Internet Radio -
Jani - 30.10.2012
SIMPLE CAR INTERNET RADIO BY JANI
At first, this is my first tutorial.
INTRODUCTION
This is simple radio script, that will play internet radio when you enter a vehicle, and stop, when you exit vehicle.
Step 1.
Include the scripting language.
Step 2.
Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
//start the internet stream
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=37586");//here you can put your own url, thats just example.
}
// stop the internet stream
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
StopAudioStreamForPlayer(playerid);
}
return 1;
}
So, now comes the explain.
Code:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
If players new state is driver or passenger (A.K.A. in a vehicle),
Code:
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=37586");
this starts the stream. (PlayAudioStreamForPlayer). After playerid, you can put your own radio you want to listen to. The URL goes inside " ".
Code:
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
This means, that if someone was a driver or passenger, and is no more, it stops the radio
Code:
StopAudioStreamForPlayer(playerid);
because the player exited the vehicle.
Thats it!
I REALLY hope this helps, because this is first tutorial I have ever made.
Re: Car / Vehicle Internet Radio -
Mr.Anonymous - 30.10.2012
Not a good idea to edit the script everytime we want to change the song.
Re: Car / Vehicle Internet Radio -
Jani - 30.10.2012
Do you know what radio is? They play online different songs. Listen to internet radio man.
Re: Car / Vehicle Internet Radio -
Vinninho - 28.12.2012
Wheren can I get that URL of my desired radio?
Re: Car / Vehicle Internet Radio -
xxSwissxx - 06.02.2013
The helped me so much!
I had absolutely no clue, on how to Add this to my server!
Thanks Jani!