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



Automatic music in specific area - davidstyle1125 - 02.12.2014

Hello, I mapped a party area for the christmas, and I want to script that every player who come to the area range,
will hear the stream...
How to do this?


Re: Automatic music in specific area - HY - 02.12.2014

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
    {
        PlayerAudioStreamForPlayer("Link");
    }
    return 1;
}
Edit: wrong "Steream"


Re: Automatic music in specific area - davidstyle1125 - 02.12.2014

Hey, where do i put it?


Re: Automatic music in specific area - HY - 02.12.2014

Quote:
Originally Posted by davidstyle1125
Посмотреть сообщение
Hey, where do i put it?
Under OnPlayerUpdate(playerid). I gave you code.

Edit: This forum requires that you wait 120 seconds between posts. Please try again in 120 seconds. lol.


Re: Automatic music in specific area - davidstyle1125 - 02.12.2014

it gives me Errors when i Comply :\

Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 50, 1755.26, -1774.30, 16.39))
    {
        PlayerAudioStreamForPlayer("http://yp.shoutcast.com/sbin/tunein-station.pls?id=19972");
    }
    return 1;
}



Re: Automatic music in specific area - Dignity - 02.12.2014

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 50, 1755.26, -1774.30, 16.39))
    {
        PlayerAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=19972",  1755.26, -1774.30, 16.39, 50, 1);
    }
    return true;
}
You should actually read up on the function. https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer


Re: Automatic music in specific area - Vince - 02.12.2014

Fun fact is that it doesn't actually work (properly). As long as the player is in the area the stream will be restarted several times per second, probably resulting in outrageous network usage and lag on the client's end. I recommend you work with the Dynamic Areas in the Streamer plugin. It has callbacks for entering and leaving an area.

I also recommend you all learn how and when to use OnPlayerUpdate. It's not your one-stop-shop for everything!


Re: Automatic music in specific area - davidstyle1125 - 02.12.2014

so, any of you maybe got any other idea how to set stream in the specific area i want?

here is the cords:

Код:
-1087.677978, 615.239807, 1116.507812
and here's the stream:

Код:
http://yp.shoutcast.com/sbin/tunein-station.pls?id=242774



Re: Automatic music in specific area - davidstyle1125 - 03.12.2014

Assist me please.


Re: Automatic music in specific area - Vince - 03.12.2014

Read my previous post again, specifically this part:

Quote:
Originally Posted by Vince
Посмотреть сообщение
I recommend you work with the Dynamic Areas in the Streamer plugin.
Any normal person would search for "dynamic areas" and "streamer plugin" upon reading that. Don't expect everything to be handed to you on a silver platter. It's called doing your research.