Jump to content

[help]


Ahmed Ly

Recommended Posts

Posted

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
)

 

76561198264399996.png

 

 

 

 

  • Moderators
Posted

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

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.

 

 

  • Thanks 1

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
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
 

76561198264399996.png

 

 

 

 

Posted
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 ??

76561198264399996.png

 

 

 

 

Posted
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™

76561198264399996.png

 

 

 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...