I Have a crazy IDEA idk how to achieve ?
#1

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

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

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

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

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;
}
Reply
#6

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

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

Yea you helped me alot thank you very much !
Reply
#9

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!");
          }
       }
    }
Reply
#10

On witch line is the error?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)