SA-MP Forums Archive
PlayAudioStream Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PlayAudioStream Help (/showthread.php?tid=492704)



PlayAudioStream Help - alishvasis - 05.02.2014

Hi Guys.In my Fs Work And Play And Stop Audio But Not Again Repeat play and stop just play 1 Time How Can i Do ?
This is Code :
Код:
#include <a_samp>

new OneTimeOnly[MAX_PLAYERS];


public OnPlayerUpdate(playerid)
{
if(OneTimeOnly[playerid] == 0)
{
if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 1, -2141.1802, -151.0720, 35.3359))
{
PlayAudioStreamForPlayer(playerid, "http://dl3.bia2rap20.info/Full/Fadaei/Fadaei_Hamseda_64.mp3");
OneTimeOnly[playerid] = 1;
}
} else {
if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 1, -2141.1885, -156.1039, 35.3203))
{
StopAudioStreamForPlayer(playerid);
}
}
return 1;
}



Re: PlayAudioStream Help - alishvasis - 05.02.2014

Any One Cant Help Me ?


Re: PlayAudioStream Help - Matt - 05.02.2014

You forgot to set the OneTimeOnly back to 0 again, I think.

Код:
#include <a_samp>

new OneTimeOnly[MAX_PLAYERS];


public OnPlayerUpdate(playerid)
{
if(OneTimeOnly[playerid] == 0)
{
if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 1, -2141.1802, -151.0720, 35.3359))
{
PlayAudioStreamForPlayer(playerid, "http://dl3.bia2rap20.info/Full/Fadaei/Fadaei_Hamseda_64.mp3");
OneTimeOnly[playerid] = 1;
}
} else {
if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 1, -2141.1885, -156.1039, 35.3203))
{
StopAudioStreamForPlayer(playerid);
OneTimeOnly[playerid] = 0;
}
}
return 1;
}



Re: PlayAudioStream Help - alishvasis - 05.02.2014

Quote:
Originally Posted by Matt
Посмотреть сообщение
You forgot to set the OneTimeOnly back to 0 again, I think.

Код:
#include <a_samp>

new OneTimeOnly[MAX_PLAYERS];


public OnPlayerUpdate(playerid)
{
if(OneTimeOnly[playerid] == 0)
{
if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 1, -2141.1802, -151.0720, 35.3359))
{
PlayAudioStreamForPlayer(playerid, "http://dl3.bia2rap20.info/Full/Fadaei/Fadaei_Hamseda_64.mp3");
OneTimeOnly[playerid] = 1;
}
} else {
if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 1, -2141.1885, -156.1039, 35.3203))
{
StopAudioStreamForPlayer(playerid);
OneTimeOnly[playerid] = 0;
}
}
return 1;
}
Ty I Rep You <3