SA-MP Forums Archive
Music stops after few seconds - 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: Music stops after few seconds (/showthread.php?tid=506037)



Music stops after few seconds - Nucky - 11.04.2014

Hey, I'm wondering if I can make the PlayAudioStreamForPlayer play for a certain amount of time.
When I connect to the server the music will start playing (I already done this) then it will stop after around 30 seconds. Right now it stops OnPlayerSpawn since I don't know how to make this within time.

Any ideas?


Re: Music stops after few seconds - Bingo - 11.04.2014

Any other sounds on OnPlayerSpawn?


Re: Music stops after few seconds - Conradus - 11.04.2014

In the beginning of the script:
Код:
forward StopPlayingMusic(playerid);
At OnPlayerConnect (where you start playing the music):
Код:
SetTimerEx("StopPlayingMusic", 30000, false, "i", playerid);
Somewhere in your script, NOT inside a callback!
Код:
public StopPlayingMusic(playerid)
{
    StopAudioStreamForPlayer(playerid);
}



Re: Music stops after few seconds - Nucky - 11.04.2014

I will test Conradus' suggestion. If it works, I'll give you a rep up.
Ty!


Re: Music stops after few seconds - Nucky - 11.04.2014

Conradus: The music stopped when I spawn.
I want it to keep playing from when I spawn as well. 30 seconds from I connect, then I can play for a few seconds and it should stop.


Re: Music stops after few seconds - Conradus - 11.04.2014

I think you have "StopAudioStreamForPlayer(playerid);" somewhere in your "OnPlayerSpawn" callback. If you do, remove it.