How's this possible?
#1

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

PlayAudioStreamForPlayer has a position and distance parameter, try to decrease the distance

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

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
PlayAudioStreamForPlayer has a position and distance parameter, try to decrease the distance

https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer
You mean i should set a volume for every position of the player?
Reply
#4

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

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

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

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

Thanks guys i really appreciate it +Rep for all
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)