Why is this not starting when i enter a car
#1

Well when you turn a car radio on and listen to something when in a car and then you get out of it and get back in it i want it to stay playing what you was just listening to.. It dont do that please help

pawn Код:
new CarMusicPlaying;
pawn Код:
{
                switch(listitem)
                {
                    case 0:
                    {
                        new vehicleid = GetPlayerVehicleID(playerid);
                        if(vehicleid)
                        {
                            for(new i; i < MAX_PLAYERS; ++i)
                            {
                                if(!IsPlayerConnected(i))continue;

                                if(IsPlayerInVehicle(i, vehicleid))
                                {
                                    PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1504548");
                                    CarMusicPlaying = 1;
                                }
                            }
                        }
                    }
                    case 1:
                    {
                        new vehicleid = GetPlayerVehicleID(playerid);
                        if(vehicleid)
                        {
                            for(new i; i < MAX_PLAYERS; ++i)//foreach would be much better
                            {
                                if(!IsPlayerConnected(i))continue;

                                if(IsPlayerInVehicle(i, vehicleid))
                                {
                                    PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283896");
                                    CarMusicPlaying = 2;
                                }
                            }
                        }
                    }
                }
            }
pawn Код:
if(CarMusicPlaying == 1)
    {
        new playervehicleid = GetPlayerVehicleID(playerid);
        if(playervehicleid)
        {
            for(new i; i < MAX_PLAYERS; ++i)
            {
                if(!IsPlayerConnected(i))continue;

                if(IsPlayerInVehicle(i, playervehicleid))
                {
                    PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1504548");
                }
            }
        }
    }
   
    if(CarMusicPlaying == 2)
    {
        new pvehicleid = GetPlayerVehicleID(playerid);
        if(pvehicleid)
        {
            for(new i; i < MAX_PLAYERS; ++i)//foreach would be much better
            {
                if(!IsPlayerConnected(i))continue;

                if(IsPlayerInVehicle(i, pvehicleid))
                {
                    PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283896");
                }
            }
        }
    }
If you need any more code just asks

Thanks
Reply
#2

Please help me

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)