Audio resume? -
Necip - 29.06.2013
So I have a boombox script, but when I go away it's okay says that you are far away from boombox but when I go near it starts the audio again.What I want it to resume the Audio.Is it possible?If yes how?Here is my OnPlayerEnterDynamicArea and OnPlayerLeaveDynamicArea:
pawn Code:
public OnPlayerEnterDynamicArea(playerid, areaid)
{
foreach(Player, i)
{
if(GetPVarType(i, "bboxareaid"))
{
new station[256];
GetPVarString(i, "BoomboxURL", station, sizeof(station));
if(areaid == GetPVarInt(i, "bboxareaid"))
{
PlayAudioStreamForPlayer(playerid, station, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ"), 30.0, 1);
SendClientMessageEx(playerid, COLOR_GREY, " You are listening to music coming out of a nearby boombox.");
return 1;
}
}
}
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
foreach(Player, i)
{
if(GetPVarType(i, "bboxareaid"))
{
if(areaid == GetPVarInt(i, "bboxareaid"))
{
StopAudioStreamForPlayer(playerid);
SendClientMessageEx(playerid, COLOR_GREY, " You have went far away from the boombox.");
return 1;
}
}
}
return 1;
}
Re: Audio resume? -
[MG]Dimi - 29.06.2013
Well you can try to play Stream for ALL player on specific position in specific range. I think it will just resume it unless it's streamed when he is in range of point...
Re: Audio resume? -
Necip - 29.06.2013
I don't really understand you, can you post the code?
Re: Audio resume? -
Scenario - 29.06.2013
It seems like you're re-playing the stream each time a player enters the area. Meaning, if there are 5 people listening to the stream and another person enters the area- the whole stream stops and then starts again.
You simply need to remove the XYZ coordinates from the "PlayAudioStreamForPlayer" line.
Re: Audio resume? -
Necip - 29.06.2013
Uhm I understand you a bit, could you remove those and give me the code?
Re: Audio resume? -
Necip - 29.06.2013
You mean doing it only PlayAudioStreamForPlayer(playerid) ? Sorry for double post.
Re: Audio resume? -
Necip - 29.06.2013
Triple post, help me please.I need it as soon as possible for my server...
Re: Audio resume? -
Anak - 29.06.2013
example:
pawn Code:
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1);
command:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/radio", cmdtext, true) == 0)
{
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls");
return 1;
}
if (strcmp("/radiopos", cmdtext, true) == 0)
{
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1);
return 1;
}
return 0;
}