Jump to content

Progress Bar Progress Moving


CowTurbo

Recommended Posts

Maybe: but i'm not sure

addEventHandler('onClientGUIClick', progressBar, 
function(button, state) 
if botton = 'left' and state = 'down' then 
addEventHandler('onClientRender', root, changeProgressPos) 
elseif botton = 'left' and state = 'up' then 
removeEventHandler('onClientRender', root, changeProgressPos) 
end 
end 
) 
  
function changeProgressPos() 
local x, y = getCursorPosition1() 
guiSetPosition(progressBar, x, y) 
end 

Even if it didn't work it might give you the idea :P.

EDIT: @ getCursorPosition remove the "1" it does the same as getPlayerTeam.

Link to comment
local x, y = guiGetPosition(myProgressBar, false) 
guiProgressBarSetProgress(myProgressBar, 1) 
addEventHandler("onClientGUIClick", myProgressBar, function (button, state, posX, posY) 
local cX = guiGetScreenSize() * getCursorPosition1() 
local pX, pY = guiGetPosition(myProgressBar, false) 
local x = cX / pX 
local x = x - 8 
local x = x * 28 
local progress = x 
if progress <= 1 then 
progress = 1 
elseif progress >= 100 then 
progress = 100 
end 
guiProgressBarSetProgress(myProgressBar, math.floor(progress)) 
end, false) 

P.S: Rename getCursorPosition1() to getCursorPosition().

Link to comment

this is solidsnakes code, editied to make cleaner.

local x, y = guiGetPosition(myProgressBar, false) 
guiProgressBarSetProgress(myProgressBar, 1) 
addEventHandler("onClientGUIClick", myProgressBar, 
        function (button, state, posX, posY) 
                 local cX = guiGetScreenSize() * getCursorPosition1() 
                 local pX, pY = guiGetPosition(myProgressBar, false) 
                 local progress = ( (cX / pX) - 8 ) * 28 
                 if progress <= 1 then 
                            progress = 1 
                 elseif progress >= 100 then 
                            progress = 100 
                 end 
                 guiProgressBarSetProgress(myProgressBar, math.floor(progress)) 
        end 
, false) 

P.S: Rename getCursorPosition1() to getCursorPosition().

 <!-- s:roll: --><img src=\"{SMILIES_PATH}/icon_rolleyes.gif\" alt=\":roll:\" title=\"Rolling Eyes\" /><!-- s:roll: -->  

:o, just by typing :roll:

Link to comment

this isnt working right. it changes it pos, but not where the arrow is, at end, it dont come end, and at start, he dont come start, he's moving a bit at center.

So, i tryed to change maths, but, useless, im not good at maths, some help will be good with that =)

Thx

Link to comment
stop inventing the bicycle and use scrollbar.

progress bar stops being a progress bar when you want to "move arrow with mouse".

I agree with you Aibo, I don't get why does he want to use a progress bar and convert it to a kind of scrollbar. Anyway, I don't understand what's your problem now CowTurbo, could you explain yourself?

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