Ahmed Ly Posted August 27, 2017 Share Posted August 27, 2017 hello guys I want music moving with the Progress bar and ended up being the Progress has become 100 code --- Client addEventHandler ( "onClientGUIClick",root, function () if source == button1 then link = guiGetText(editBox) triggerServerEvent("start",localPlayer,link) end end ) soundPosition = 0 function timer () soundPosition = soundPosition + 1 guiProgressBarSetProgress(progressbar,soundPosition) if soundPosition == 100 then soundPosition = 0 end end addEvent("p",true) addEventHandler("p",root, function (link) if isElement(sound1) then stopSound(sound1) end sound1 = playSound(""..link.."",false) setTimer(timer,3000,1) end ) -- Server addEvent("start",true) addEventHandler("start",root, function (link) triggerClientEvent(root,"p",root,link) end ) Link to comment
Moderators IIYAMA Posted August 27, 2017 Moderators Share Posted August 27, 2017 https://wiki.multitheftauto.com/wiki/GetSoundLength https://wiki.multitheftauto.com/wiki/GetSoundPosition Try this: local progressBarPosition = math.floor((position / length) * 100) Stop double posting, it is annoying. Link to comment
Ahmed Ly Posted August 27, 2017 Author Share Posted August 27, 2017 36 minutes ago, IIYAMA said: https://wiki.multitheftauto.com/wiki/GetSoundLength https://wiki.multitheftauto.com/wiki/GetSoundPosition Try this: local progressBarPosition = math.floor((position / length) * 100) Stop double posting, it is annoying. thank you but how i can get time of sound to put it in setTimer Link to comment
Moderators IIYAMA Posted August 27, 2017 Moderators Share Posted August 27, 2017 You can get length of the sound with the functions I also posted. For the timer update use your own imagination. I would personally go for onClientRender, because it is smoother. But a fast timer could do the job too. 1 Link to comment
Ahmed Ly Posted August 27, 2017 Author Share Posted August 27, 2017 31 minutes ago, IIYAMA said: You can get length of the sound with the functions I also posted. For the timer update use your own imagination. I would personally go for onClientRender, because it is smoother. But a fast timer could do the job too. thank you so much Link to comment
Ahmed Ly Posted August 27, 2017 Author Share Posted August 27, 2017 1 hour ago, IIYAMA said: You can get length of the sound with the functions I also posted. For the timer update use your own imagination. I would personally go for onClientRender, because it is smoother. But a fast timer could do the job too. now i have new question how check if the player put link or not in edit Box i Use function string.find or no ?? Link to comment
NeXuS™ Posted August 27, 2017 Share Posted August 27, 2017 Try if string.find(guiGetText(textBox), "www.") or string.fnd(guiGetText(textBox), "http") then Link to comment
Ahmed Ly Posted August 27, 2017 Author Share Posted August 27, 2017 20 minutes ago, NeXuS™ said: Try if string.find(guiGetText(textBox), "www.") or string.fnd(guiGetText(textBox), "http") then code Doesn't work but i fixed it thank you Nexus™ Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now