Possible? -
Aquilis - 11.12.2011
pawn Код:
new AudioTest;
if (strcmp("/alarmprison", cmdtext, true) == 0)
{
If(!CopPlayer) return SendClientMessage(playerid, COLOR_RED, " Your not LSPD");
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
AudioTest = PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1);
return 1;
}
if (strcmp("/stopalarm", cmdtext, true) == 0)
{
If(!CopPlayer) return SendClientMessage(playerid, COLOR_RED, " Your not LSPD");
StopAudioStreamForPlayer(AudioTest);
return 1;
}
Re: Possible? - suhrab_mujeeb - 11.12.2011
Quote:
Originally Posted by Aquilis
pawn Код:
new AudioTest; if (strcmp("/alarmprison", cmdtext, true) == 0) { If(!CopPlayer) return SendCliendMessage(playerid, COLOR_RED, " Your not LSPD"); new Float:X, Float:Y, Float:Z, Float:Distance = 5.0; GetPlayerPos(playerid, X, Y, Z); AudioTest = PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1); return 1; } if (strcmp("/stopalarm", cmdtext, true) == 0) { If(!CopPlayer) return SendCliendMessage(playerid, COLOR_RED, " Your not LSPD"); StopAudioStreamForPlayer(AudioTest); return 1; }
|
And, what do u want to ask?
Re: Possible? -
Aquilis - 11.12.2011
If a player can turn off the audio that someone else created?
@EDIT
And the code above errors.
Re: Possible? -
shitbird - 11.12.2011
It should be.
Although you are doing it wrong. You are only streaming the sound for the "playerid". Which in this case, is playerid 0.
pawn Код:
if (strcmp("/alarmprison", cmdtext, true) == 0)
{
If(!CopPlayer)
return SendCliendMessage(playerid, COLOR_RED, "You are not a cop.");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(i, 5.0, X, Y, Z))
{
AudioTest = PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls");
}
}
return 1;
}
Maybe something like this?
Re: Possible? -
Aquilis - 11.12.2011
Yes! =D
And that is correct?
pawn Код:
if (strcmp("/stopalarm", cmdtext, true) == 0)
{
If(!CopPlayer) return SendCliendMessage(playerid, COLOR_RED, " Your not LSPD");
StopAudioStreamForPlayer(AudioTest);
return 1;
}
Re: Possible? -
shitbird - 11.12.2011
If you want anyone on the cop team to be able to stop the sound for themselves, but not for the entire server, then yes it is correct.
Re: Possible? -
Aquilis - 11.12.2011
I want any cop can stop the audio.
Re: Possible? -
shitbird - 11.12.2011
For everyone, or for themselves?
If for everyone, you will have to loop through the players like I did before, and use StopAudioStreamForPlayer(AudioTest);
If for themselves, you have already done it.
Re: Possible? -
Aquilis - 11.12.2011
Thank friend! Sucess! +rep!
pawn Код:
if (strcmp("/stopalarm", cmdtext, true) == 0)
{
//If(!CopPlayer) return SendCliendMessage(playerid, COLOR_RED, " Your not LSPD");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(i, 5.0, X, Y, Z))
{
StopAudioStreamForPlayer(AudioTest);
}
}
return 1;
}