Boombox problem.. Help.
#1

I created a boombox, anyone that owns one can use /placeboombox, /setboombox and /pickupboombox. All of these commands work, except I have a problem with playing music:
pawn Код:
forward BoomboxPlay(playerid);
public BoomboxPlay(playerid)
{
    foreach(Player, i)
    {
        if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "Boombox_FLOAT_X"), GetPVarFloat(i, "Boombox_FLOAT_Y"), GetPVarFloat(i, "Boombox_FLOAT_Z")))
        {
            if(IsPlayerInAnyVehicle(playerid)) return 1;
            if(BoomboxListen[playerid] != BoomboxStation[i])
            {
                new station[64];
                switch(BoomboxStation[i])
                {
                    case 1:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
                        BoomboxListen[playerid] = 1;
                    }
                    case 2:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
                        BoomboxListen[playerid] = 2;
                    }
                    case 3:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283896");
                        BoomboxListen[playerid] = 3;
                    }
                    case 4:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366&");
                        BoomboxListen[playerid] = 4;
                    }
                    case 5:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=663859&");
                        BoomboxListen[playerid] = 5;
                    }
                    case 6:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&");
                        BoomboxListen[playerid] = 6;
                    }
                }
                PlayAudioStreamForPlayer(playerid, station, GetPVarFloat(i, "Boombox_FLOAT_X"), GetPVarFloat(i, "Boombox_FLOAT_Y"), GetPVarFloat(i, "Boombox_FLOAT_Z"), 30, 1); // Play the stream.
            }
        }
        else
        {
            if(BoomboxListen[playerid] > 0)
            {
                BoomboxListen[playerid] = 0;
                StopAudioStreamForPlayer(playerid);
            }
        }
    }
    return 1;
}
Now the problem is, when two people are on-line (or more of course), the players chat fills with spam audio messages (More players = more spam), which bugs the player and the audio wont stop. I have a small idea into the problem, which is the players audio 'BoomboxListen[playerid]' matches the boombox in which the player is near, except the other players boombox (which is not placed) is interfeing and doesnt match the players 'BoomboxListen[playerid]' which results in the station chaging (the spam), I don't know how the other part is executed due to the other players boombox not being placed? However, I don't have any idea on how I can stop this. Help?!

By the way, "BoomboxPlay(playerid);" is called every second.. With a timer.
Reply


Messages In This Thread
Boombox problem.. Help. - by ryansheilds - 06.06.2012, 16:12
Re: Boombox problem.. Help. - by San1 - 06.06.2012, 16:29
Re: Boombox problem.. Help. - by ryansheilds - 06.06.2012, 16:32
Re: Boombox problem.. Help. - by ryansheilds - 07.06.2012, 20:39
Re: Boombox problem.. Help. - by nickdodd25 - 07.06.2012, 21:27
Re: Boombox problem.. Help. - by kaisersouse - 07.06.2012, 21:34
Re: Boombox problem.. Help. - by ryansheilds - 07.06.2012, 22:51
Re: Boombox problem.. Help. - by ryansheilds - 10.06.2012, 19:27

Forum Jump:


Users browsing this thread: 1 Guest(s)