PlayAudioStream help here
#1

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);
Reply
#2

You looping it

change this line

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

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?
Reply
#4

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
Reply
#5

nvm fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)