Audio System - 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 System (
/showthread.php?tid=326815)
Audio System -
TouhGear - 18.03.2012
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.
Re: Audio System -
Yvax - 18.03.2012
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);
Re: Audio System -
TouhGear - 18.03.2012
Код:
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;
}
Re: Audio System -
TouhGear - 19.03.2012
Its impossible.
Re: Audio System -
ReneG - 19.03.2012
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.
Re: Audio System -
Rob_Maate - 19.03.2012
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;
}