29.06.2013, 16:03
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;
}