SA-MP Forums Archive
AudioStreamForAll ? - 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: AudioStreamForAll ? (/showthread.php?tid=428904)



AudioStreamForAll ? - Proph3t - 07.04.2013

Hi, i would really like to know a way to play a audiostream for each player at the same time with a command. this is how i have it atm:

pawn Код:
CMD:rumble(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid)) {
    StopAudioStreamForPlayer(playerid);
    PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
    SendClientMessage(playerid, C_BLUE, "Type /stoprumble to stop this music");
    return 1;
}
i already saw a way to do it for players that are close to you but i want it in a command as shown here (above) and for every player.

thanks!


Re: AudioStreamForAll ? - yanir3 - 07.04.2013

Use foreach. https://sampforum.blast.hk/showthread.php?tid=92679
Add this then;
Код:
foreach (new i : Player)
{
    PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
}



Re: AudioStreamForAll ? - Proph3t - 07.04.2013

thanks but i dont know how to add it

like this?

pawn Код:
CMD:rumble(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
    foreach (new i : Player)
    {
        PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
        SendClientMessage(playerid, C_BLUE, "Type /stoprumble to stop this music");
    }
    return 1;
}



Re: AudioStreamForAll ? - Proph3t - 07.04.2013

never mind i got it!

pawn Код:
CMD:rumble(playerid,params[])
{
    for (new i = 0; i != MAX_PLAYERS; ++i)
    {
        if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
        {
            PlayAudioStreamForPlayer(i, "http://www.mboxdrive.com/p/I6kcXprd0T/");
            SendClientMessage(playerid, C_BLUE, "Type /stoprumble to stop this music");
        }
    }
    return 1;
}



Re: AudioStreamForAll ? - Proph3t - 07.04.2013

or not -_- please help me!


Re: AudioStreamForAll ? - Scenario - 07.04.2013

Quote:
Originally Posted by Proph3t
Посмотреть сообщение
thanks but i dont know how to add it

like this?

pawn Код:
CMD:rumble(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
    foreach (new i : Player)
    {
        PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
        SendClientMessage(playerid, C_BLUE, "Type /stoprumble to stop this music");
    }
    return 1;
}
That's ALMOST correct. You're missing one brace, though!

pawn Код:
CMD:rumble(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
        foreach (new i : Player)
        {
           PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
            SendClientMessage(playerid, C_BLUE, "Type /stoprumble to stop this music");
        }
    }
    return 1;
}



Re: AudioStreamForAll ? - ReVo_ - 07.04.2013

Код:
CMD:rumble(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
        foreach (new i : Player)
        {
           PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
        }
SendClientMessage(playerid, C_BLUE, "Type /stoprumble to stop this music");
    }
    return 1;
}
Or he will see 5 messages if 5 players are connected.


Re: AudioStreamForAll ? - Scenario - 07.04.2013

My fault, that's true.

pawn Код:
CMD:rumble(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
    {
        foreach (new i : Player)
        {
           PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
SendClientMessage(i, C_BLUE, "Type /stoprumble to stop this music");
    }
    }
    return 1;
}
^^ use that one, mate.


Re: AudioStreamForAll ? - Proph3t - 08.04.2013

omg...

C:\Users\Henk\Desktop\Battlefield\gamemodes\battle field.pwn(11845) : error 017: undefined symbol "foreach"
C:\Users\Henk\Desktop\Battlefield\gamemodes\battle field.pwn(11845) : error 029: invalid expression, assumed zero
C:\Users\Henk\Desktop\Battlefield\gamemodes\battle field.pwn(11845) : error 017: undefined symbol "i"
C:\Users\Henk\Desktop\Battlefield\gamemodes\battle field.pwn(11845) : fatal error 107: too many error messages on one line

.....


Re: AudioStreamForAll ? - MP2 - 08.04.2013

You need to download foreach.