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



Audiostream help - eemalekorraks - 09.10.2013

Код:
CMD:animals(playerid, params[])
{
    for( new u; u < MAX_PLAYERS; u++ )
    {
        PlayAudioStreamForPlayer( u, "http://k002.kiwi6.com/hotlink/v01a10y69h/animals.mp3" );
    }
    SendClientMessageToAll(-1, "Now playing: Martin Garrix - Animals");
    return 1;
}
Dis I have made, When one writes /animals, the message pops, but no music.

Add this:

Код:
CMD:animals(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
{
    for( new u; u < MAX_PLAYERS; u++ )
    {
        PlayAudioStreamForPlayer( u, "http://k002.kiwi6.com/hotlink/v01a10y69h/animals.mp3" );
    }
}
else {
SendClientMessage(playerid, -1, "Nope!");
}
SendClientMessageToAll(-1, "Now playing: Martin Garrix - Animals");
return 1;
}
Only I as the RCOn admin can hear it.

Im trying to make it so when 1 writes /animals, everybody on the server gets looped the stream.

Help apprecciated and will get repped.

Ty in advance!


Re: Audiostream help - Restriction - 09.10.2013

Create a public function like that.. Then use it under your cmd..
pawn Код:
forward PlayerAudioStreamForAll(url);
Public PlayAudioStreamForAll(url)
{
   for(new i =0;i<MAX_PLAYERS;i++)
  {
     PlayAudioStreamForPlayer(i, url);
  }
return 1;
}



Re: Audiostream help - Mattakil - 10.10.2013

pawn Код:
CMD:animals(playerid, params[])
{
new audioplaying;
    if(IsPlayerAdmin(playerid))
{
    audioplaying =1;
}
for( new u; u < MAX_PLAYERS; u++ )
    {
        if(audioplaying == 1)
            {
            PlayAudioStreamForPlayer( u, "http://k002.kiwi6.com/hotlink/v01a10y69h/animals.mp3" );
            }
}
else {
SendClientMessage(playerid, -1, "Nope!");
}
SendClientMessageToAll(-1, "Now playing: Martin Garrix - Animals");
return 1;
}
apologies for the shitty indents.


Re: Audiostream help - eemalekorraks - 10.10.2013

The last one is so random, it does the exact opposite for what I want.
The idea is right, but I want every player to have "Audioplaying == 1".

I couldn't make the first answer work also.

Still need help.


Re: Audiostream help - edzis84 - 10.10.2013

Код:
new Audioplaying;

forward PlayerAudioStreamForAll(url);
Public PlayAudioStreamForAll(url)
{
   for(new i =0;i<MAX_PLAYERS;i++)
  {
     PlayAudioStreamForPlayer(i, url);
     Audioplaying[i] == 1;
  }
return 1;
}