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



PlayAudioStream help here - N0FeaR - 24.04.2012

I have create a boombox, but everyone hear this, how can i make so only when them are near the boombox hear the music?

code
pawn Код:
new Float:x, Float:y, Float:z,Float:distance = 3.0;
                        GetPlayerPos(playerid,x,y,z);
                        if(IsPlayerInRangeOfPoint(i,3.0,x,y,z))
                        PlayAudioStreamForPlayer(i,"http://k003.kiwi6.com/hotlink/5hg5uq0p9u/mange_makers_mange_bjuder_official_video.mp3",x,y,z,distance,0);



Re: PlayAudioStream help here - RollTi - 24.04.2012

You looping it

change this line

pawn Код:
PlayerAudioStream(i, blahblah
to playerid except for if(IsPlayerInRangeOfPoint(i


Re: PlayAudioStream help here - N0FeaR - 24.04.2012

Quote:
Originally Posted by RollTi
Посмотреть сообщение
You looping it

change this line

pawn Код:
PlayerAudioStream(i, blahblah
to playerid except for if(IsPlayerInRangeOfPoint(i
So just remove ,x,y,z,distance,0); from playeraduiostream?


Re: PlayAudioStream help here - RollTi - 24.04.2012

normal loop version

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerInRangeOfPoint(i,3.0,x,y,z))
    PlayAudioStreamForPlayer(i,"http://k003.kiwi6.com/hotlink/5hg5uq0p9u/mange_makers_mange_bjuder_official_video.mp3",x,y,z,distance,1);
}
foreach version

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
foreach(Player, i)
{
    if(IsPlayerInRangeOfPoint(i,3.0,x,y,z))
    PlayAudioStreamForPlayer(i,"http://k003.kiwi6.com/hotlink/5hg5uq0p9u/mange_makers_mange_bjuder_official_video.mp3",x,y,z,distance,1);
}
usepos note: 0 - will disable hearing through distance
1 - will enable hearing through distance

You use usepos 0 so that will not work i change it to 1 to make it work


Re: PlayAudioStream help here - N0FeaR - 24.04.2012

nvm fixed.