SA-MP Forums Archive
How to play music in server? - 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: How to play music in server? (/showthread.php?tid=657230)



How to play music in server? - tobi736 - 03.08.2018

i want to code, if play join the game, the music will play and loops?
pls help me, i need a example


Re: How to play music in server? - GRiMMREAPER - 03.08.2018

PlayAudioStreamForPlayer under OnPlayerConnect.


Re: How to play music in server? - tobi736 - 03.08.2018

i want to loop it? how i can?


Re: How to play music in server? - DBZdabIt3Bro7 - 03.08.2018

Quote:
Originally Posted by tobi736
Посмотреть сообщение
i want to loop it? how i can?
I wouldn't do that... by the script... just imagine getting spammed with:

PHP код:
Audio Streamhttp://example.com/folder/subfolder/index.php?file=example&extension=mp3
Audio Streamhttp://example.com/folder/subfolder/index.php?file=example&extension=mp3
Audio Streamhttp://example.com/folder/subfolder/index.php?file=example&extension=mp3
Audio Streamhttp://example.com/folder/subfolder/index.php?file=example&extension=mp3
Audio Streamhttp://example.com/folder/subfolder/index.php?file=example&extension=mp3
Audio Streamhttp://example.com/folder/subfolder/index.php?file=example&extension=mp3
Audio Streamhttp://example.com/folder/subfolder/index.php?file=example&extension=mp3
... 
Just loop your audio file instead.


Re: How to play music in server? - sonn51280 - 04.08.2018

onplayerconnect Add Code PlayAudioStreamForPlayer


Re: How to play music in server? - RogueDrifter - 04.08.2018

Set a timer thats approx the same time of ur music that will stop and replay the same file to loop it.

Ex:

PHP код:
#define MUSIC_TIME 3*60*60 // 3 minutes (The length of the music you play).
public OnPlayerConnect(playerid)
{
    
PlayAudioStreamForPlayer(playerid"Link"); // Firstly play once they connect.
    
SetTimerEx("PlayMusic"MUSIC_TIMEtrue"i"playerid);//The timer to constantly play the music.
    
return 1;
}
forward PlayMusic(playerid);
public 
PlayMusic(playerid)
{
    
StopAudioStreamForPlayer(playerid); // Stop the audio stream in case if it was running.
    
PlayAudioStreamForPlayer(playerid"Link"); // Replay it.
    
return 1;




Re: How to play music in server? - MattBe - 04.08.2018

Set A Timer In Music


Re: How to play music in server? - Juvanii - 04.08.2018

why you people keep posting same replies, this is not a count of posts race forum. he GOT the idea.


Re: How to play music in server? - Sew_Sumi - 04.08.2018

I hate music that I can't turn off, as I put the game sound through my sound system, and my music through my headset so I can shut off the music by just muting the headset.

Even though I can turn down the audio in the game, I'd still prefer to be able to pick up the dust.


Re: How to play music in server? - tobi736 - 04.08.2018

love all, i got a new idea
thanks