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



Audio - PawelQ - 04.02.2014

Hey, i dont know how to make something like that. If player is in range of point it's streaming music for him. It's same like boombox but without commands. Anyone know how to do that?


AW: Audio - ReD_HunTeR - 04.02.2014

Код:
new OneTimeOnly[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
   if(OneTimeOnly[playerid] == 0)
   {
      if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, range, x, y, z))
      {
         PlayAudioStreamForPlayer(playerid, www.music.com);
         OneTimeOnly[playerid] = 1;
      }
   }
   return 1;
}



Re: Audio - PawelQ - 04.02.2014

Can You please put it in filterscript? After including it into my gamemode i got shitload of errors.


AW: Audio - ReD_HunTeR - 04.02.2014

here you go


Re: Audio - PawelQ - 04.02.2014

Yeah man, thanks a lot! +Rep

But i have one more question.
How can I put few positions and few links?
I mean one positions = one link


Re: Audio - PawelQ - 04.02.2014

And what to do to stop music after leaving this area?


Re: Audio - PawelQ - 04.02.2014

Is that good?

Код:
#include <a_samp>

new OneTimeOnly[MAX_PLAYERS];


public OnPlayerUpdate(playerid)
{
   if(OneTimeOnly[playerid] == 0)
   {
      if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z)
      {
         PlayAudioStreamForPlayer(playerid, "link");
         OneTimeOnly[playerid] = 1;
         }
    	else
    	{
        StopAudioStreamForPlayer(playerid);
    	}
      if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z))
      {
         PlayAudioStreamForPlayer(playerid, "link");
         OneTimeOnly[playerid] = 1;
      }
      if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z)
      {
         PlayAudioStreamForPlayer(playerid, "link");
         OneTimeOnly[playerid] = 1;
      }
      if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z)
      {
         PlayAudioStreamForPlayer(playerid, "link");
         OneTimeOnly[playerid] = 1;
      }
      if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z))
      {
         PlayAudioStreamForPlayer(playerid, "link");
         OneTimeOnly[playerid] = 1;
      }
   }
   return 1;
}



Re: Audio - Vince - 04.02.2014

Try doing it with the dynamic area feature of the streamer plugin. OnPlayerUpdate doesn't seem quite fit for this purpose.


Re: Audio - PawelQ - 04.02.2014

I don't know how to stop stream after leaving area.


Re: Audio - Vince - 04.02.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
Try doing it with the dynamic area feature of the streamer plugin. OnPlayerUpdate doesn't seem quite fit for this purpose.
CreateDynamicSphere, OnPlayerEnterDynamicArea, OnPlayerLeaveDynamicArea.