SA-MP Forums Archive
How to place music in specific area? - 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: How to place music in specific area? (/showthread.php?tid=546721)



How to place music in specific area? - davidstyle1125 - 17.11.2014

Hello, I wanted to ask you guys, how can I put some radio music in a specific place, for example, I want to create a stage with party and stuff, so I want that when people come to the area they will hear music...
How do i do that?

(not GTA San Andreas music... music from radio which i'll choose)


Re: How to place music in specific area? - RajatPawar - 17.11.2014

https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer

Pass the co-ordinates and radius as parameters, and set usepos to 1. It's in there.


Re: How to place music in specific area? - OsteeN - 17.11.2014

Stream it to them using PlayAudioStreamForPlayer.


Re: How to place music in specific area? - HY - 17.11.2014

pawn Code:
CMD:example(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
    {
        PlayAudioStreamForPlayer(playerid, "URL Link");
    }
    else
    {
        SendClientMessage(playerid, -1, "You aren't in Range of Point !");
    }
    return 1;
}



Re: How to place music in specific area? - OsteeN - 17.11.2014

Quote:
Originally Posted by HY
View Post
pawn Code:
CMD:example(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
    {
        PlayAudioStreamForPlayer(playerid, "URL Link");
    }
    else
    {
        SendClientMessage(playerid, -1, "You aren't in Range of Point !");
    }
    return 1;
}
I was thinking of telling him to use IsPlayerInRangeOFPoint, but appearently PlayAudioStreamForPlayer has the option to choose which coords to stream within.


Re: How to place music in specific area? - DavidBilla - 17.11.2014

Quote:
Originally Posted by HY
View Post
pawn Code:
CMD:example(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
    {
        PlayAudioStreamForPlayer(playerid, "URL Link");
    }
    else
    {
        SendClientMessage(playerid, -1, "You aren't in Range of Point !");
    }
    return 1;
}
If they leave the area,after the stream starts they will still hear it.


Re: How to place music in specific area? - Cheesus - 17.11.2014

pawn Code:
if (strcmp("/radiopos", cmdtext, true) == 0)
    {
        new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
        GetPlayerPos(playerid, X, Y, Z);
    PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1);
    return 1;
    }



Re: How to place music in specific area? - HY - 17.11.2014

Quote:
Originally Posted by DavidBilla
View Post
If they leave the area,after the stream starts they will still hear it.
He only said he want to starts music in an area. He didn't said something about what you said. ^.^


Re: How to place music in specific area? - Vince - 17.11.2014

Use the streamer plugin's areas. The plugin has OnPlayerEnterDynamicArea and OnPlayerLeaveDynamicArea.