Boombox problem.. Help.
#7

I don't use individual timers, "BoomboxPlay(playerid);" is in a one and the only one global timer which is called every second, I just used a separate function to avoid clutter (A bit OCD .. lol). I removed the 'playerid' in exchange for 'i', however the problem still occurs. When I was testing apparently playerid 1 didn't get spammed, like playerid 0 did. I've attempted many things but still no luck. This is what I've got now:

pawn Код:
forward BoomboxPlay();
public BoomboxPlay()
{
    foreach(Player, i)
    {
        if(IsPlayerInRangeOfPoint(i, 35.0, GetPVarFloat(i, "DYN_Boombox_FLOAT_X"), GetPVarFloat(i, "DYN_Boombox_FLOAT_Y"), GetPVarFloat(i, "DYN_Boombox_FLOAT_Z")))
        {
            if(IsPlayerInAnyVehicle(i)) return 1;
            if(BoomboxListen[i] != 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[i] = 1;
                    }
                    case 2:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
                        BoomboxListen[i] = 2;
                    }
                    case 3:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283896");
                        BoomboxListen[i] = 3;
                    }
                    case 4:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366&");
                        BoomboxListen[i] = 4;
                    }
                    case 5:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=663859&");
                        BoomboxListen[i] = 5;
                    }
                    case 6:
                    {
                        format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&");
                        BoomboxListen[i] = 6;
                    }
                }
                PlayAudioStreamForPlayer(i, station, GetPVarFloat(i, "DYN_Boombox_FLOAT_X"), GetPVarFloat(i, "DYN_Boombox_FLOAT_Y"), GetPVarFloat(i, "DYN_Boombox_FLOAT_Z"), 35, 1); // Play the stream.
            }
        }
        else
        {
            if(BoomboxListen[i] > 0)
            {
                BoomboxListen[i] = 0;
                StopAudioStreamForPlayer(i);
            }
        }
    }
    return 1;
}
Timer:

pawn Код:
public MainTimer() // One and only timer!
{
    new string[128];
    foreach(Player, i)
    {
        BoomboxPlay();
            //Rest of code...
pawn Код:
public OnGameModeInit()
{
    SetTimer("MainTimer", 1000, true);
Suggestion?

Edit: Doesn't spam any more, but the player who placed it is the only one who can hear it.
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: 3 Guest(s)