SA-MP Forums Archive
Help ambiental music - 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: Help ambiental music (/showthread.php?tid=610502)



Help ambiental music - XxXBr0nXxX - 24.06.2016

public OnPlayerUpdate(playerid)
{
if (IsPlayerInRangeOfPoint(playerid, 10.0, -261.05, 2227.15, 58.45))
{
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/wos3db6jxt/The_XFiles_Theme.mp3",-261.05, 2227.15, 58.45, 2000.0, 1);
}
}
return 1;
}



When I'm at the point , the music start of many times


You can create a script that makes sure that when you're over there begins the music ?


Re: Help ambiental music - dicknyson - 24.06.2016

Код:
new PlayingMusic[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
	if(IsPlayerInRangeOfPoint(playerid, 10.0, -261.05, 2227.15, 58.45) && !PlayingMusic[playerid])
	{
		PlayingMusic[playerid] = 1;
		PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/wos3db6jxt/The_XFiles_Theme.mp3",-261.05, 2227.15, 58.45, 2000.0, 1);
	}
	
	return 1;
}
Of course you'll need to reset PlayingMusic[playerid] to 0 when the music stops playing. You could maybe use a timer for that.


Re: Help ambiental music - XxXBr0nXxX - 24.06.2016

thank you