Jump to content

فنكشات ProgressBar لاكن DX


Recommended Posts

ما اظن كذا :arrowup:[-X:-k

خله يسوي فنكشن يزيد الطول

و بعدين لو يبي يخليه يزيد يستعمل الفنكشن و يركب تايمر كذا افضل و راح يسهل الشغل كأنه سوا عنصر

gui جديد

Link to comment

سوي فنكشن يتحكم بطول القطعة اللي في الخلفة اللي تزيد و تنقص

احدثيات العرض تحكم فيه زيدها و نقصها حاول تضبطها :wink:

اذا سويت الفنكشن راح تصير اسهل

Link to comment

في مشكله التحميل يصير سريع ابي اخله بطيئ كيف

local unlerp = function(from,to,lerp) return (lerp-from)/(to-from) end 
  
function dxDrawProgressBar( startX, startY, width, height, progress, color, backColor ) 
        local progress = math.max( 0, (math.min( 100, progress) ) ) 
        local wBar = width*.2 
        for i = 0, 0 do 
                --back 
                local startPos = (wBar*i + (width*.01)*i) + startX 
                dxDrawRectangle( startPos, startY, wBar, height, backColor ) 
                --progress 
                local eInterval = (i*20) 
                local localProgress = math.min( 1, unlerp( eInterval, eInterval + 20, progress ) ) 
                        if localProgress > 0 then 
                                dxDrawRectangle( startPos, startY, wBar*localProgress, height, color ) 
                        end 
        end 
end 
  
function draw() 
  dxDrawProgressBar( 250, 250, 1500,30, math.random(0,100), tocolor( 50, 50, 0, 255), tocolor( 255, 255, 255, 255) ) 
end 
addEventHandler("onClientRender", root, draw)  

Link to comment
    local unlerp = function(from,to,lerp) return (lerp-from)/(to-from) end 
      
    function dxDrawProgressBar( startX, startY, width, height, progress, color, backColor ) 
            local progress = math.max( 0, (math.min( 100, progress) ) ) 
            local wBar = width*.2 
            for i = 0, 0 do 
                    --back 
                    local startPos = (wBar*i + (width*.01)*i) + startX 
                    dxDrawRectangle( startPos, startY, wBar, height, backColor ) 
                    --progress 
                    local eInterval = (i*20) 
                    local localProgress = math.min( 1, unlerp( eInterval, eInterval + 20, progress ) ) 
                            if localProgress > 0 then 
                                    dxDrawRectangle( startPos, startY, wBar*localProgress, height, color ) 
                            end 
            end 
    end 
Prog = 0 
     
setTimer ( function () Progg = Prog +1 end, 1000, 100 ) 
addEventHandler("onClientRender", root 
    function () 
        dxDrawProgressBar( 250, 250, 1500,30, Progg, tocolor( 50, 50, 0, 255), tocolor( 255, 255, 255, 255) ) 
    end 
)  

Link to comment

ناقص فصاله سطر 21

EDIT :

شوف انا هاذي هي طريقتي يوم بسويه DX

   onPro = guiCreateProgressBar(253, 315, 336, 30,false) 
   guiSetAlpha(onPro,0) 
  
addEventHandler("onClientRender", root, 
    function() 
        dxDrawRectangle(249, 305, 350, 50, tocolor(0, 0, 0, 255), false) 
        dxDrawRectangle(253, 315,guiProgressBarGetProgress(onPro)*336/100, 30, tocolor(0, 0, 255, 255), false) 
    end 
) 
  
p = setTimer(function() 
if ( guiProgressBarGetProgress(onPro) == 100 ) then 
killTimer(p) 
end 
guiProgressBarSetProgress(onPro,guiProgressBarGetProgress(onPro)+1) 
end,100,0) 

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