Audio resume?
#1

So I have a boombox script, but when I go away it's okay says that you are far away from boombox but when I go near it starts the audio again.What I want it to resume the Audio.Is it possible?If yes how?Here is my OnPlayerEnterDynamicArea and OnPlayerLeaveDynamicArea:
pawn Code:
public OnPlayerEnterDynamicArea(playerid, areaid)
{
    foreach(Player, i)
    {
        if(GetPVarType(i, "bboxareaid"))
        {
            new station[256];
            GetPVarString(i, "BoomboxURL", station, sizeof(station));
            if(areaid == GetPVarInt(i, "bboxareaid"))
            {
                PlayAudioStreamForPlayer(playerid, station, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ"), 30.0, 1);
                SendClientMessageEx(playerid, COLOR_GREY, " You are listening to music coming out of a nearby boombox.");
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    foreach(Player, i)
    {
        if(GetPVarType(i, "bboxareaid"))
        {
            if(areaid == GetPVarInt(i, "bboxareaid"))
            {
                StopAudioStreamForPlayer(playerid);
                SendClientMessageEx(playerid, COLOR_GREY, " You have went far away from the boombox.");
                return 1;
            }
        }
    }
    return 1;
}
Reply
#2

Well you can try to play Stream for ALL player on specific position in specific range. I think it will just resume it unless it's streamed when he is in range of point...
Reply
#3

I don't really understand you, can you post the code?
Reply
#4

It seems like you're re-playing the stream each time a player enters the area. Meaning, if there are 5 people listening to the stream and another person enters the area- the whole stream stops and then starts again.

You simply need to remove the XYZ coordinates from the "PlayAudioStreamForPlayer" line.
Reply
#5

Uhm I understand you a bit, could you remove those and give me the code?
Reply
#6

You mean doing it only PlayAudioStreamForPlayer(playerid) ? Sorry for double post.
Reply
#7

Triple post, help me please.I need it as soon as possible for my server...
Reply
#8

example:
pawn Code:
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);
command:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/radio", cmdtext, true) == 0)
    {
        PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls");
        return 1;
    }
    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;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)