Audiostream for all players? -
TheTale - 31.12.2011
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
Re: Audiostream for all players? -
Lуs - 31.12.2011
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");
}
}
Re: Audiostream for all players? -
silvan - 31.12.2011
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");
}
Re: Audiostream for all players? -
[ABK]Antonio - 31.12.2011
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
Re: Audiostream for all players? -
coole210 - 31.12.2011
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");
}
}
}
Re: Audiostream for all players? -
HyperZ - 31.12.2011
I suggest you to use
Foreach the fastest way to loop trough all the players.