PlayAudioStream for all?
#1

Hey, im currently making an rcon admin command that when you enter it it plays music for everyone.

But my question is, is there any other way than looping?
Reply
#2

No, you will have to use a loop.
Reply
#3

Sorry mate, only way unfortunately
pawn Код:
new CurrentStream[256] = "null" //At the top of your script, with the other "new's"

stock PlayAudioStreamForAll(StreamURL[]) //Wherever, just so long as it's not inside another function
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            PlayAudioStreamForPlayer(i, StreamURL, 0.0, 0.0, 0.0, 0);
        }
    }
    CurrentStream = StreamURL;
}

stock StopAudioStreamForAll() //Below the above stock
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            StopAudioStreamForPlayer(i);
        }
    }
    CurrentStream = "null";
}

public OnPlayerConnect(playerid)
{
    if(strcmp(CurrentStream, "null", true) != 0)
    {
        PlayAudioStreamForPlayer(i, StreamURL, 0.0, 0.0, 0.0, 0);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)