30.10.2012, 14:32
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.
So, now comes the explain.
If players new state is driver or passenger (A.K.A. in a vehicle),
this starts the stream. (PlayAudioStreamForPlayer). After playerid, you can put your own radio you want to listen to. The URL goes inside " ".
This means, that if someone was a driver or passenger, and is no more, it stops the radio
because the player exited the vehicle.
Thats it!
I REALLY hope this helps, because this is first tutorial I have ever made.
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.
Code:
#include <a_samp>
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; }
Code:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
Code:
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=37586");
Code:
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
Code:
StopAudioStreamForPlayer(playerid);
Thats it!
I REALLY hope this helps, because this is first tutorial I have ever made.