- 6
- 0
- Версия MoonLoader
- .026-beta
Hello Everyone, I have made a simple script to play an audio stream from an audio URL, the script is working fine it plays audio stream but my game freezes when it starts loading audio from URL. Here is my script:
I have tried different links and formats, I have also tried using LUA threads but same problem. Also, I don't wanna load audio when script executes I want to do that with play command. Is there anyway to get ride of game freeze when loading audio stream?
AudioStream.lua:
function main()
repeat wait(1) until isPlayerPlaying(playerHandle)
if isSampLoaded() and isSampfuncsLoaded() then
repeat wait(1) until sampGetGamestate() == 3
sampRegisterChatCommand("play", play)
wait(-1)
end
end
function play()
local a = loadAudioStream("https://fr05.mp3snow.com/0c0f261e5c77cef04aa83/Luis Fonsi ‒ Despacito %28 %29 ft. Daddy Yankee.mp3")
setAudioStreamState(a, 1)
setAudioStreamVolume(a, 1)
end
I have tried different links and formats, I have also tried using LUA threads but same problem. Also, I don't wanna load audio when script executes I want to do that with play command. Is there anyway to get ride of game freeze when loading audio stream?