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



PlayAudioStreamForPlayer help - N0FeaR - 24.09.2012

I want so everyone around the area can hear this right now is only me?

pawn Код:
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
                    GetPlayerPos(playerid, X, Y, Z);
                    PlayAudioStreamForPlayer(playerid, "http://www.fileden.com/files/2012/4/18/3293679/Sound%20Car%20alarm%20%28Alarma%20de%20coche%29.mp3", X, Y, Z, Distance, 0);



Re: PlayAudioStreamForPlayer help - XtremeR - 24.09.2012

here you go, im not sure if it will work but still am pretty sure so give it a try

pawn Код:
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 5.0,X, Y, Z))
{
PlayAudioStreamForPlayer(playerid,       "http://www.fileden.com/files/2012/4/18/3293679/Sound%20Car%20alarm%20%28Alarma%20de%20coche%29.mp3", X, Y, Z, Distance, 0);
}



Re: PlayAudioStreamForPlayer help - N0FeaR - 24.09.2012

Still same problem x)


Re: PlayAudioStreamForPlayer help - XtremeR - 24.09.2012

Then use
pawn Код:
IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    new Float:X, Float:Y, Float:Z;

    GetPlayerPos(playerid, X, Y, Z);
    if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
        return 1;
    }
    return 0;
}

new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInArea(playerid, 5.0,X, Y, Z))
{
PlayAudioStreamForPlayer(playerid,       "http://www.fileden.com/files/2012/4/18/3293679/Sound%20Car%20alarm%20%28Alarma%20de%20coche%29.mp3", X, Y, Z, Distance, 0);
}



Re: PlayAudioStreamForPlayer help - trapstar2020 - 24.09.2012

no return value i where are u putting this?


Re: PlayAudioStreamForPlayer help - Rimeau - 24.09.2012

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(IsPlayerInRangeOfPoint(i, 5.0, X, Y, Z)) PlayAudioStreamForPlayer(i, "http://www.fileden.com/files/2012/4/18/3293679/Sound%20Car%20alarm%20%28Alarma%20de%20coche%29.mp3", X, Y, Z, 5.0, 0);
    }
}
X, Y, Z is the position where the player has to be in order to hear the sound, right?


Re: PlayAudioStreamForPlayer help - Pro_Drifter - 24.09.2012

If you want onplayerconnect u can use simply:
pawn Код:
{
PlayAudioStreamForPlayer(playerid,URL);
}