Possible?
#1

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;
}
Reply
#2

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?
Reply
#3

If a player can turn off the audio that someone else created?

@EDIT
And the code above errors.
Reply
#4

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?
Reply
#5

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;
}
Reply
#6

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.
Reply
#7

I want any cop can stop the audio.
Reply
#8

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.
Reply
#9

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;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)