Incognito's Audio Plugin - Radio Streaming: Passengers -
Jack Shred - 04.08.2011
Hello there,
I'm trying to achieve this goal here.. I'd like it so a passenger of a vehicle hears the radio when the driver starts one.
Unfortunately, I'm not very succesful, only the driver can hear it.
Here's my code:
Код:
if(listitem == 0)// (1-Jazz Radio)
{
if(pRadio[playerid] == 0)
{
for(new i; i < MAX_PLAYERS; i++)
{
new vehicle = GetPlayerVehicleID(playerid);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER && GetPlayerVehicleID(i) == vehicle)
{
Radio[playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096",false,false,false);
pRadio[playerid] = 1;
pRadioID[playerid] = 0;
}
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[MUSIC ERROR]: You're already playing a radio station!");
}
}
I hope one of you could help me out.
Thanks,
Jack Shred.
Re: Incognito's Audio Plugin - Radio Streaming: Passengers -
Danny - 04.08.2011
You're using 'playerid' in your loop, replace that with the variable
i.
Edit: I noticed you do not use this variable, so i recommend to delete it.
Код:
new vehicle = GetPlayerVehicleID(playerid);
Re: Incognito's Audio Plugin - Radio Streaming: Passengers -
Jack Shred - 05.08.2011
Ah that was a dumb mistake, I edited playerid to i.
However, it still doesn't work. It only works for the driver.
Re: Incognito's Audio Plugin - Radio Streaming: Passengers -
Adil - 05.08.2011
pawn Код:
if(listitem == 0)// (1-Jazz Radio)
{
if(pRadio[playerid] == 0)
{
new vehicle = GetPlayerVehicleID(playerid);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicle)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
Radio[playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096",false,false,false);
pRadio[playerid] = 1;
pRadioID[playerid] = 0;
}
}
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[MUSIC ERROR]: You're already playing a radio station!");
}
}
I think this should work.
Re: Incognito's Audio Plugin - Radio Streaming: Passengers -
AndreT - 05.08.2011
Well you corrected a very obvious and huge mistake, but still left in another major issue!
Replace the loop with this:
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicle))
{
Radio[i] = Audio_PlayStreamed(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096",false,false,false);
pRadio[i] = 1;
pRadioID[i] = 0;
}
}
// edit: left in a small mistake, sorry!
Re: Incognito's Audio Plugin - Radio Streaming: Passengers -
Mr4rtur - 05.08.2011
pawn Код:
Radio[i] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096",false,false,false);
Shouldn't it be like this:
pawn Код:
Radio[i] = Audio_PlayStreamed(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096",false,false,false);
Re: Incognito's Audio Plugin - Radio Streaming: Passengers -
Jack Shred - 06.08.2011
Quote:
Originally Posted by Mr4rtur
pawn Код:
Radio[i] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096",false,false,false);
Shouldn't it be like this:
pawn Код:
Radio[i] = Audio_PlayStreamed(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096",false,false,false);
|
And once again a foolish mistake!
Thanks alot, it works now.
Re: Incognito's Audio Plugin - Radio Streaming: Passengers -
MadeMan - 06.08.2011
pawn Код:
if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
What's the point of this?