#1

I have radio command, what do I have to do with it so that the music plays for anyone in that vehicle, and when you leave it stops playing for the player who left, but it stays on for everyone else until /radiostop is used.

pawn Код:
if(strcmp(cmd, "/radio", true) == 0)
    {
        if(gPlayerHasCar[playerid] == 0)
        {
            SendClientMessage(playerid, 0xAFAFAFAA, " Nie posiadasz auta !");
            return 1;
        }
        else
        {
            if(IsPlayerInVehicle(playerid, Vehicle090[playerid]))
            {
                if(PlayerInfo[playerid][RadioA] == 1)
                {
                    AutoRadio[0][playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1821702",false,false,false);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "W twoim aucie nie ma zamontowanego radia!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, " Nie jestes w swoim pojezdzie !");
            }
        }
    }
Reply
#2

looks nice what about in english?
Reply
#3

Quote:
Originally Posted by wwrp samp
Посмотреть сообщение
looks nice what about in english?
Whether the strings are in english or not is irrelevant.
Reply
#4

Show the code that you have that stops it.
Reply
#5

Ignore the stopping for now, i just want to edit this AutoRadio[0][playerid] = Audio_PlayStreamed(playerid so it doesnt just paly radio for playerid but for everyone in that car.
Reply
#6

Right, I updated the code a little.

pawn Код:
if(strcmp(cmd, "/radioinstall", true) == 0)
    {
        if(gPlayerHasCar[playerid] == 0)
        {
            SendClientMessage(playerid, 0xAFAFAFAA, " You dont have a car !");
            return 1;
        }
        else
        {
            if(IsPlayerInVehicle(playerid, Vehicle090[playerid]))
            {
                if(PlayerInfo[playerid][pRadio] == 1)
                {
                    VehicleInfo[playerid][RadioA] = 1;
                    PlayerInfo[playerid][pRadio] = 0;
                    SendClientMessage(playerid, COLOR_WHITE, "Radio installed, use /radioon to turn the radio on.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "You dont have a radio!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, " You are not in your car !");
            }
        }
    }
   
    if(strcmp(cmd, "/radiouninstall", true) == 0)
    {
        if(gPlayerHasCar[playerid] == 0)
        {
            SendClientMessage(playerid, 0xAFAFAFAA, " You dont have a car !");
            return 1;
        }
        else
        {
            if(IsPlayerInVehicle(playerid, Vehicle090[playerid]))
            {
                if(VehicleInfo[playerid][RadioA] == 1)
                {
                    VehicleInfo[playerid][RadioA] = 0;
                    PlayerInfo[playerid][pRadio] = 1;
                    SendClientMessage(playerid, COLOR_WHITE, "You uninstalled your radio");
                    Audio_Stop(playerid, CarRadio[0][playerid]);
                    RadioIsOn[playerid] = 0;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "There is no radio in your car");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, " You are not in your car !");
            }
        }
    }
   
    if(strcmp(cmd, "/radiooff", true) == 0)
    {
        if(IsPlayerInVehicle(playerid, Vehicle090[playerid]))
        {
            if(VehicleInfo[playerid][RadioA] == 1)
            {
                Audio_Stop(playerid, CarRadio[0][playerid]);
                RadioIsOn[playerid] = 0;
            }
        }
    }
    if(strcmp(cmd, "/radioon", true) == 0)
    {
        if(gPlayerHasCar[playerid] == 0)
        {
            SendClientMessage(playerid, 0xAFAFAFAA, " You don't have a car!");
            return 1;
        }
        else
        {
            if(IsPlayerInVehicle(playerid, Vehicle090[playerid]))
            {
                if(VehicleInfo[playerid][RadioA] == 1)
                {
                    CarRadio[0][playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1821702",false,false,false);
                    RadioIsOn[playerid] = 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have a radio in your car!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in your car !");
            }
        }
    }
pawn Код:
if(newstate == PLAYER_STATE_DRIVER) //buggy dont finnish//hahaha
    {
           
        if(RadioIsOn[playerid] == 1)
        {
            CarRadio[0][playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1821702",false,false,false);
        }
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    Audio_Stop(playerid, CarRadio[0][playerid]);
Now, How can I check if radio is playing in that car? Once I get that I can finish the code on my own to play it for everyone inside the car.

Thx
Reply
#7

I'd be setting the variable for the vehicleid, rather than the playerid.
Then as the player enters the vehicle, his variable is sync'd with the car's variable.
When he leaves, it's automatically set back to false or 0 or w/e is your off value
Reply
#8

right nice, but houw could I set a variable for vehicle? Can you give me an example.

Also could you look at my Check for car owner on page2, thx for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)