Jump to content

[HELP] Progress Bar and Button.


brocky

Recommended Posts

The problem with this script is that when you click the button called "ButtonExtract" then a progress bar will appear and start progressing till the width is reached to 532 and the problem is that, When you click the button, the progress bar fills half and then again you will have to click to complete the progress bar, All I want is that the progress Bar should start when you click the buton and ends smoothly.

  
function loading() 
if buttonExtract == source then 
 local now = getTickCount()      
with = interpolateBetween(0,0,0,532,0,0, (now - start) / (( start + 10000 ) - start ) , "Linear" )  
  
dxDrawRectangle(142, 222, with, 41, tocolor(23, 23, 231, 255), false) 
  
  
if with < 532 then  
         triggerServerEvent("payMoney", localPlayer) 
    else  
             
                removeEventHandler("onClientRender", getRootElement(), loading)           
               end  
       end  
  end  
addEventHandler("onClientRender", getRootElement(), loading) 
addEventHandler("onClientGUIClick", buttonExtract, loading, false)   
  

Link to comment

Okay Just it write code.

I have not tested :D

      
    function loading() 
    if buttonExtract == source then 
     local now = getTickCount()     
    with = interpolateBetween(0,0,0,532,0,0, (now - start) / (( start + 10000 ) - start ) , "Linear" ) 
      
    dxDrawRectangle(142, 222, with, 41, tocolor(23, 23, 231, 255), false) 
      
      
    if with < 532 then 
             triggerServerEvent("payMoney", localPlayer) 
        else 
                
                    removeEventHandler("onClientRender", getRootElement(), loading)           
                   end 
           end 
      end 
    addEventHandler("onClientRender", getRootElement(), loading) 
  
addEventHandler("onClientClick", root, 
            function(button, state, x, y) 
                if button == "left" and state == "down" then 
                    if x >= 142 and y >= 222 then    
-- Write You'r Code                  
        end 
                end 
            end  
        ) 
  
      

Link to comment

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...