How to play music in server?
#1

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

PlayAudioStreamForPlayer under OnPlayerConnect.
Reply
#3

i want to loop it? how i can?
Reply
#4

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

onplayerconnect Add Code PlayAudioStreamForPlayer
Reply
#6

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;

Reply
#7

Set A Timer In Music
Reply
#8

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

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

love all, i got a new idea
thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)