Random Music in car - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random Music in car (
/showthread.php?tid=395860)
Random Music in car -
Ljangangero - 28.11.2012
Hi can anyone help me with adding random music on player enter car
like playaudiostreamforplayer?
Re: Random Music in car -
Bicentric - 28.11.2012
I put this together extremely quickly, I don't have acsess to a compiler so I don't know if it works. But you will get the general concept on how it works.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
RandomMusic(playerid);
return 1;
}
public OnPlayerExitVehilce(playerid, vehicleid)
{
StopAudioStreamForPlayer(playerid);
return 1;
}
stock RandomMusic(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new rand = random(4);
switch(rand)
{
case 0:
{
PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");
}
case 1:
{
PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");
}
case 2:
{
PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");
}
case 3:
{
PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");
}
case 4:
{
PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");
}
}
}
return 1;
}
Re: Random Music in car -
Ljangangero - 28.11.2012
compile good but nothing happend ingame
Re: Random Music in car -
Bicentric - 28.11.2012
That's becuase you need to replace the 'MusicStreamUrl' with the URL of the audio file.
Re: Random Music in car -
Ljangangero - 28.11.2012
omg i done that im not such a big noob :P
Re: Random Music in car -
Bicentric - 28.11.2012
Try removing the 'IsPlayerInVehicle' check from the stock function.
Re: Random Music in car -
Ljangangero - 28.11.2012
same
Re: Random Music in car -
Bicentric - 28.11.2012
Does the audio stream message appear? Also make sure that your radio is turned on in the settings.
Re: Random Music in car -
Ljangangero - 28.11.2012
audio stream doesnt show.....