How to place music in specific area?
#1

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)
Reply
#2

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

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

Stream it to them using PlayAudioStreamForPlayer.
Reply
#4

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;
}
Reply
#5

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.
Reply
#6

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.
Reply
#7

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;
    }
Reply
#8

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. ^.^
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)