Audio System
#1

How make system. I go inside car and write /carbass now online radio turn on then all players hear the online radio, who radius is less than 30. And when i go out of car, then music not stop. And i go inside car write /carbassoff then online music turn off and nobody not hear enymore online radio.

Sorry my bad english.
Reply
#2

Post your /carbass command.

If you want the music to stop when you exit the vehicle all you have to do is put this in OnPlayerExitVehicle:
pawn Код:
StopAudioStreamForPlayer(playerid);
Reply
#3

Код:
CMD:carbass(playerid, params[])
{
	new i = GetBuyCarId(playerid);
	new vehicleid = GetPlayerVehicleID(playerid);
	if( CarInfo[i][cOwner] != PlayerInfo[playerid][pSQLID]) return SendClientMessage(playerid, COLOR_GREY, "This is not your car." );
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
		GetVehiclePos(vehicleid, X, Y, Z);
	    PlayAudioStreamForPlayer(playerid, "http://194.106.119.241:8500/skyplus_hi.mp3.m3u", X, Y, Z, Distance, 1);
     	return 1;
     }
     else
		SendClientMessage(playerid, 0xFFFFFFFFFFF, "You gotta be in a vehicle to use this command!");
	return 1;
}
Reply
#4

Its impossible.
Reply
#5

This is very much possible, there are some technical draw backs though. Like what if more than one player has carbass on and are in the same area with a lot of people. Then everyone would hear two different songs which would tend to annoy the hell out of me personally.
Reply
#6

Actually Vincent, SA-MP clients only support one stream at a time. The second PlayAudioStreamForPlayer will be the one broadcasted and the first will actually stop for all people within the second's play radius.

To prove this, we can use this command:

pawn Код:
CMD:play2streams(playerid, params[])
{
    new stream[2][128];
    if(sscanf(params, "s[128]s[128]", stream[1], stream[2]) == 0)
    {
        for(new i=0; i<GetMaxPlayers(); i++)
        {
            PlayAudioStreamForPlayer(i, stream[1]);
            PlayAudioStreamForPlayer(i, stream[2]);
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /play2streams [Stream 1] [Stream 2]");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)