How to repeat audio - 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 repeat audio (
/showthread.php?tid=523601)
How to repeat audio -
AiRaLoKa - 03.07.2014
hi all...
how to repeat PlayAudioStreamForPlayer automatically?
Re: How to repeat audio -
DanLore - 03.07.2014
As far as I know, unless you're using an audio plugin, which unfortunately requires your players to be using the plugin too, you'll have to loop the audio with a timer.
Re: How to repeat audio -
MrWupiazZzLT - 28.07.2014
return 1;
[I think]
Re: How to repeat audio -
ShinichiKudou - 28.07.2014
pawn Код:
forward MusicTimer(playerid);
public MusicTimer(playerid)
{
//code to play music
return 1;
}
then add settimer stuff (i forgot the syntax lel)
Re: How to repeat audio -
Vince - 28.07.2014
It isn't possible to perfectly time it because clients with slower Internet connections load the initial stream more slowly.
Re: How to repeat audio -
Clad - 28.07.2014
You can use a Timer.
Re: How to repeat audio -
AiRaLoKa - 31.07.2014
Quote:
Originally Posted by Vince
It isn't possible to perfectly time it because clients with slower Internet connections load the initial stream more slowly.
|
indeed...
that's why i asked it here, if i use timer, it will cut the duration song for the player with slow internet connection.
but in some server, it's repeated perfectly, without giving a client message ("streaming audio" thingy). i want to know what did they use.
Quote:
Originally Posted by ShinichiKudou
pawn Код:
forward MusicTimer(playerid); public MusicTimer(playerid) { //code to play music return 1; }
then add settimer stuff (i forgot the syntax lel)
|
i know how to make a function --_-- and using timer isn't a good choice. becouse some player have a slow internet connection.
Respuesta: How to repeat audio -
Zume - 31.07.2014
Maybe:
pawn Код:
enum SongEnum
{
LongSong,
Seconds,
UrlSong[128],
};
new SongInfo[MAX_PLAYERS][SongEnum];
stock StopMusicEx(playerid)
{
SongInfo[playerid][LongSong] = -1;
StopAudioStreamForPlayer(playerid);
return 0;
}
stock PlayMusicEx(playerid, str[], longsong)
{
strmid(SongInfo[playerid][UrlSong], str, 0, 128, 128);
PlayAudioStreamForPlayer(playerid, SongInfo[playerid][UrlSong]);
SongInfo[playerid][Seconds] = longsong;
SongInfo[playerid][LongSong] = gettime()+SongInfo[playerid][Seconds];
return 1;
}
forward RepeatSong(); public RepeatSong()
{
for(new x = 0; x < MAX_PLAYERS; x++)
{
if(IsPlayerConnected(x))
{
if(SongInfo[x][LongSong] > 0)
{
if(SongInfo[x][LongSong] < gettime())
{
SongInfo[x][LongSong] = gettime()+SongInfo[x][Seconds];
PlayMusicEx(x, SongInfo[x][UrlSong], SongInfo[x][LongSong]);
}
}
}
}
return 1;
}
public OnGameModeInit()
{
SetTimer("RepeatSong", 1000, true);
return 1;
}
/* Example
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/playsound", cmdtext, true, 10) == 0)
{
PlayMusicEx(playerid, "Url", Duration of the song);
return 1;
}
return 0;
}
*/
Re: How to repeat audio -
icra - 31.07.2014
Use Audio Plugin.