Jump to content

Progress Bar Problem


igthomas

Recommended Posts

Hey guys, I have a problem with my progress bar, when I type /nano the progress bar goes down and when its 0 it goes to 100 again but after that if I type it again the progress doesnt go down I get this error when I shoot

WARNING: nano\client.lua:49: Bad Argument @ 'killTimer' [Expected lua-timer at argument 1] 

Here's the code:

 GUIEditor_Progress = {} 
  
function showBar() 
    GUIEditor_Progress[1] = guiCreateProgressBar(0.0127,0.3,0.1719,0.0417,true) 
    guiSetAlpha(GUIEditor_Progress[1],1) 
    progres = 100 
    timer = nil; 
    guiProgressBarSetProgress(GUIEditor_Progress[1],progres) 
end 
addEvent("showBar", true) 
addEventHandler ("showBar", getRootElement(),showBar) 
  
function move_progressbar () 
        if timer then return end 
        function chech_move () 
            progres = progres - 1 
            guiProgressBarSetProgress(GUIEditor_Progress[1],progres) 
           check_progres () 
            if (guiProgressBarGetProgress(GUIEditor_Progress[1]) >= 100) then 
                killTimer( timer ) 
                timer = nil; 
            end 
        end 
        timer = setTimer(chech_move,200,100) 
    end 
addCommandHandler ( "nano", move_progressbar ) 
  
function check_progres () 
        if guiProgressBarGetProgress(GUIEditor_Progress[1]) == 0 then 
            triggerServerEvent ("desactivete", localPlayer) 
            progres = progres + 1 
            guiProgressBarSetProgress(GUIEditor_Progress[1],progres) 
            stop = setTimer (restore, 1000, 0) 
        end 
end 
  
function restore () 
        progres = progres + 1 
        guiProgressBarSetProgress(GUIEditor_Progress[1],progres) 
        stop = setTimer (restore, 1000, 0) 
        if (guiProgressBarGetProgress(GUIEditor_Progress[1]) >= 100) then 
                killTimer( stop ) 
        end 
end 
  
  
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) 
if getElementAlpha(getLocalPlayer()) == 0 then 
    killTimer( timer ) 
    triggerServerEvent ("desactive", localPlayer) 
    restore () 
    move_progressbar () 
    else 
if getElementAlpha(getLocalPlayer()) == 255 then 
    cancelEvent() 
    end 
end 
end 
addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFireFunc) 

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