SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/12/2011, 04:23 PM   #1
TheTale
Little Clucker
 
Join Date: Dec 2011
Location: On The Internet(: Rank:GodFather
Posts: 39
Reputation: 3
Default Audiostream for all players?

pawn Code:
StopAudioStreamForPlayer(playerid);
                    PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");

Thats my command

I want to make it play for ;

1. All players in the server

2. All close players to me ( lets say, VERY close.. )

Please
TheTale is offline   Reply With Quote
Old 31/12/2011, 04:29 PM   #2
Lós
High-roller
 
Lós's Avatar
 
Join Date: Sep 2010
Location: Casterly Rock
Posts: 4,371
Reputation: 513
Default Re: Audiostream for all players?

1.
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
}

2.
pawn Code:
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerInRangeOfPoint(i, /*Ratio*/, Pos[0], Pos[1], Pos[2]))
    {
        PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
    }
}
Lós is offline   Reply With Quote
Old 31/12/2011, 04:30 PM   #3
silvan
Huge Clucker
 
Join Date: Oct 2007
Posts: 415
Reputation: 15
Default Re: Audiostream for all players?

well that is easy to do.... use IsPlayerInRangeOfPoint(), for loops, and GetPlayerPos()

This is to play to those that are near you including you.
pawn Code:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);

for (new i=0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
}

And this to play for all players in the server.

pawn Code:
for (new i=0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
}
__________________
Rep+ if my post helped, Thanks.
silvan is offline   Reply With Quote
Old 31/12/2011, 04:31 PM   #4
[ABK]Antonio
High-roller
 
[ABK]Antonio's Avatar
 
Join Date: Sep 2011
Location: ID, USA
Posts: 1,223
Reputation: 187
Default Re: Audiostream for all players?

pawn Code:
for(new i; i<=MAX_PLAYERS; i++)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X,Y,Z);
    if(IsPlayerInRangeOfPoint(i, radius, X,Y,Z);
    {
        //do stuff here
    }
}

EDIT: oh guy above me already posted
__________________

ABKClan.com
[ABK]Antonio is offline   Reply With Quote
Old 31/12/2011, 04:34 PM   #5
coole210
Gangsta
 
Join Date: Jul 2008
Location: Canada
Posts: 995
Reputation: 84
Default Re: Audiostream for all players?

pawn Code:
//EVERYONE.
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
StopAudioStreamForPlayer(i);
PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
}
}
//PEOPLE AROUND YOU.
new Float:Pos[3];
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i,RANGE,Pos[0],Pos[1],Pos[2]))
{
StopAudioStreamForPlayer(i);
PlayAudioStreamForPlayer(i, "http://24.media.v4.skyrock.net/music/245/dcd/245dcdbcbc5b0e5b2f89c26fc1eed062.mp3");
}
}
}
coole210 is offline   Reply With Quote
Old 31/12/2011, 04:43 PM   #6
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Location: Islamabad, Pakistan
Posts: 1,341
Reputation: 66
Default Re: Audiostream for all players?

I suggest you to use Foreach the fastest way to loop trough all the players.
__________________
HyperZ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About AudioStream, Lags? ZiPoNz Scripting Help 1 12/12/2011 10:08 AM
Audiostream won't play Awesome™ Scripting Help 4 04/12/2011 11:55 AM
[DUVIDA] Sobre o AudioStream Douglas_prt Português/Portuguese 3 15/09/2011 02:32 PM


All times are GMT. The time now is 05:25 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.