Automatic music in specific area
#1

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

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

Hey, where do i put it?
Reply
#4

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

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

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

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!
Reply
#8

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:

Reply
#9

Assist me please.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)