SA-MP Forums Archive
I Have a crazy IDEA idk how to achieve ? - 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: I Have a crazy IDEA idk how to achieve ? (/showthread.php?tid=367650)



I Have a crazy IDEA idk how to achieve ? - Healian - 10.08.2012

i heard about audio streaming but i dont wanna stream audio for specific player

i want to create something like a club and stream music publicly to all members around it
can i do something like that and IS Audio streaming allows me to stream any SONG&MUSIC ?


Re: I Have a crazy IDEA idk how to achieve ? - [EnErGyS]KING - 10.08.2012

https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer Here you are


Re: I Have a crazy IDEA idk how to achieve ? - Mauzen - 10.08.2012

Just check the area once every few seconds to see what players are in it, and play the stream for them/stop it for others.
Would be easier to start on club enter, and stop on exit, but depends on what you are planning to do.


Re: I Have a crazy IDEA idk how to achieve ? - Healian - 10.08.2012

and What about my second question IS IT possible to stream any song i want and all players will here it no matter how long it is or something ?

And anotherthing can i make the sound as if it is for a speaker or something so when the player gets closer to that speakers the sound is louder ?


Re: I Have a crazy IDEA idk how to achieve ? - Opah - 10.08.2012

pawn Код:
//use incognito's streamer https://sampforum.blast.hk/showthread.php?tid=102865/
#include <a_samp>
#include <streamer>
new zone;
public OnGameModeInit()
{
    CreateDynamicRectangle(minx, miny, maxx, maxy, worldid = -1, interiorid = -1, playerid = -1);
}
/*minx = the minimum x line
maxx = themaximum x line
the same for y
worldid = virtual world (optional)
interiorid = interior (optional)
playerid = if u want it to be to a special player (optional)*/


public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == zone)
    {
        PlayAudioStreamForPlayer(playerid, "UR URL HER");
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    if(areaid == zone)
    {
        StopAudioStreamForPlayer(playerid);
    }
    return 1;
}



Re: I Have a crazy IDEA idk how to achieve ? - Healian - 10.08.2012

sorry but how to enable the zone on Admin command like /Start //So the zone starts work


Re: I Have a crazy IDEA idk how to achieve ? - Ranama - 11.08.2012

You'll have to create a variable like this to see if it is enables or not,
pawn Код:
//use incognito's streamer https://sampforum.blast.hk/showthread.php?tid=102865/
#include <a_samp>
#include <streamer>
new zone;
new clubmusic = 0;
public OnGameModeInit()
{
    CreateDynamicRectangle(minx, miny, maxx, maxy, worldid = -1, interiorid = -1, playerid = -1);
}
/*minx = the minimum x line
maxx = themaximum x line
the same for y
worldid = virtual world (optional)
interiorid = interior (optional)
playerid = if u want it to be to a special player (optional)*/

//create a command here to make the clubsound enabled
public OnPlayerCommandText(playerid, cmdtext[]){//I assume you use strcmd since almost all new scripters does :D
if (strcmp("enableclubmusic", cmdtext, true, 5) == 0){
//check if the player is admin here with your admincheck function
      clubmusic = 1;
      SendClientMessage(playerid, -1, "Club Music Enabled");
      return 1;
}
else if (strcmp("disableclubmusic", cmdtext, true, 5) == 0){
//check if the player is admin here with your admincheck function
      clubmusic = 0;
      SendClientMessage(playerid, -1, "Club Music Disabled");
      return 1;
}
//you could do it with one command to checking if the music is on or off and setting it to the other to, like this:
else if (strcmp("clubmusic", cmdtext, true, 5) == 0){
//check if the player is admin here with your admincheck function
      if(clubmusic == 1){
      clubmusic = 0;
      SendClientMessage(playerid, -1, "Club Music Disabled");
      return 1;
      }
      else{
      clubmusic = 1;
      SendClientMessage(playerid, -1, "Club Music Enabled");
      return 1;
      }
}
public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == zone && clubmusic == 1)
    {
        PlayAudioStreamForPlayer(playerid, "UR URL HER");
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    if(areaid == zone)
    {
        StopAudioStreamForPlayer(playerid);
    }
    return 1;
}
Hope it helped


Re: I Have a crazy IDEA idk how to achieve ? - Healian - 11.08.2012

Yea you helped me alot thank you very much !


Re: I Have a crazy IDEA idk how to achieve ? - Healian - 11.08.2012

i tried to convert the if statement to switch but it give me an error

Error 008: must be a constant expression; assumed zero

myCode

pawn Код:
switch (areaid)
    {
       case ptArea0:
       {
          if(isPTStarted == 1)
          {
            PlayAudioStreamForPlayer(playerid, "UR URL HER");
          }
          else
          {
            SendClientMessage(playerid, COLOR_RED, "There is no party right now!");
          }
       }
    }



Re: I Have a crazy IDEA idk how to achieve ? - Ranama - 11.08.2012

On witch line is the error?