30.11.2011, 08:22
The problem is that when you enter the server, and if you go in to anycar as passanger the radio will start palying and never stop, also when you enter a car with radio and turn it on off, leave enter there is no effect, radio just plays, the code is below:
Turn Radio On
Turn Radio OFF
When you enter and radio is on, it will play for you.
If you enter as passanger radio will come back on if its on
Stop Radio When you leave the car
Any ideas?
pawn Код:
new RadioIsOn2[MAX_VEHICLES] = 0;
new RadioIsOn[MAX_PLAYERS] = 0;
pawn Код:
CarRadio[0][playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1821702",false,false,false);
new vehicleid = GetPlayerVehicleID(playerid);
RadioIsOn2[vehicleid] = 1;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
CarRadio[0][i] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1821702",false,false,false);
}
}
pawn Код:
Audio_Stop(playerid, CarRadio[0][playerid]);
new vehicleid = GetPlayerVehicleID(playerid);
RadioIsOn2[vehicleid] = 0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
Audio_Stop(i, CarRadio[0][playerid]);
}
}
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsPlayerInVehicle(playerid, Vehicle090[playerid]))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(RadioIsOn2[vehicleid] == 1)
{
CarRadio[0][playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1821702",false,false,false);
}
}
pawn Код:
if(newstate == PLAYER_STATE_PASSENGER)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
CarRadio[0][i] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1821702",false,false,false);
}
}
pawn Код:
if(newstate == PLAYER_STATE_ONFOOT)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
Audio_Stop(i, CarRadio[0][i]);
}
}
Audio_Stop(playerid, CarRadio[0][playerid]);