SA-MP Forums Archive
Stream a song on a location? - 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: Stream a song on a location? (/showthread.php?tid=595995)



Stream a song on a location? - Fredrik - 11.12.2015

Hello guys! I'm currently making my server ready for the holliday season, and I've mapped Pershing Square into a giant sled basically... Now I'm just missing some music that auto plays and fades the closer you are to it.

Can anyone help me?

The location it needs to be based from is: 1481.1302, -1711.8168, 13.3460

The stream url is: http://puu.sh/lR5cr/804af90807.mp3

Thank you all!


Re: Stream a song on a location? - Alex_T - 11.12.2015

Код:
PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
You can use that in order to play the music. Now that will play the audio for one person. So add something simple like
Код:
ChristmasRadio()
{
	foreach(Player, i) {
		if(IsPlayerInRangeOfPoint(i, 7, 1481.1302, -1711.8168, 13.3460))
		{
			PlayAudioStreamForPlayer(i, "http://puu.sh/lR5cr/804af90807.mp3", 1481.1302, -1711.8168, 13.3460, 6, 1)
			continue;
		}
	}
}
I am pretty sure that will work.


Re: Stream a song on a location? - SickAttack - 11.12.2015

Quote:
Originally Posted by Alex_T
Посмотреть сообщение
Код:
PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
You can use that in order to play the music. Now that will play the audio for one person. So add something simple like
Код:
ChristmasRadio()
{
	foreach(Player, i) {
		if(IsPlayerInRangeOfPoint(i, 7, 1481.1302, -1711.8168, 13.3460))
		{
			PlayAudioStreamForPlayer(i, "http://puu.sh/lR5cr/804af90807.mp3", 1481.1302, -1711.8168, 13.3460, 6, 1)
			continue;
		}
	}
}
I am pretty sure that will work.
Instead of a timer and looping throw players every certain time, use areas (check out streamer).