How's this possible? -
Arastair - 21.11.2014
Hello,
Recently i added a radio to my server that automatically starts playing while you go in madd doggs mansion i placed a radio in the bar of the house so it will look more realistic, but it's so unreal now because the mansion is too big and the radio sound is the same at every point of it
I wanted to know if there is a specific script or anything that increase and decreases the radio sound while going near it or going away from it
Sincerely,
Arastair
AW: How's this possible? -
Nero_3D - 21.11.2014
PlayAudioStreamForPlayer has a position and distance parameter, try to decrease the distance
https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer
Re: AW: How's this possible? -
Arastair - 21.11.2014
Quote:
Originally Posted by Nero_3D
|
You mean i should set a volume for every position of the player?
Re: How's this possible? -
Capua - 21.11.2014
Check that link Nero provided for you. It should explain it all.
Basically, if you placed a radio object at the bar, then stand next to it and type /save. Then navigate to GTA San Andreas user files -> SAMP -> savedpositions and copy the XYZ co-ordinates that you saved and use them to place a source of the audio with
PlayAudioStreamForPlayer.
Re: How's this possible? -
DavidBilla - 21.11.2014
He's asking how to modify the volume of the stream.
I don't think increasing or decreasing the volume would be possible, since no parameter is provided in the audiostream function for volume
Re: How's this possible? -
Luis- - 21.11.2014
Quote:
Originally Posted by Capua
Check that link Nero provided for you. It should explain it all.
Basically, if you placed a radio object at the bar, then stand next to it and type /save. Then navigate to GTA San Andreas user files -> SAMP -> savedpositions and copy the XYZ co-ordinates that you saved and use them to place a source of the audio with PlayAudioStreamForPlayer.
|
This should work, shouldn't it? If the X, Y, Z coordinates are set to where the radio is, it should decrease the sound when you move further away from the radio.
AW: Re: How's this possible? -
Nero_3D - 21.11.2014
Quote:
Originally Posted by Luis-
This should work, shouldn't it? If the X, Y, Z coordinates are set to where the radio is, it should decrease the sound when you move further away from the radio.
|
Luis- is right, the volume decrease with distance / increases if you are nearby
You need to add a position to your audio, that is the example on the wiki
pawn Код:
if (strcmp("/radiopos", cmdtext, true) == 0)
{
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1);
return 1;
}
It will play the audio at your current pos and if you move away (more than 5.0 m) than the sound should be gone
Re: How's this possible? -
Arastair - 21.11.2014
Thanks guys i really appreciate it +Rep for all
Re: How's this possible? -
Arastair - 21.11.2014
But wait,
If i start the radio when it will end? Never?
And will it only be played for me cuz the thing that was in my mind was for everyone in the server and automatic nor by a use of a command
AW: How's this possible? -
Nero_3D - 21.11.2014
Normally it will stop at the end of the track but if you run a radio it should go on forever
Who said that you need an command, you can trigger if the player enters the mansion and stop it if he leaves again with
https://sampwiki.blast.hk/wiki/StopAudioStreamForPlayer
The other solution would be to use a streamer for audio because you can only run 1 audio stream at the same time