CowTurbo Posted June 30, 2011 Share Posted June 30, 2011 Hello, i wanted to ask that how to make this -> You got progress bar, and when you click on it, and move arrow left, then the progress goes to this position where the arrow is selected on progress. No script is needed what i have done i think, Link to comment
JR10 Posted June 30, 2011 Share Posted June 30, 2011 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 . EDIT: @ getCursorPosition remove the "1" it does the same as getPlayerTeam. Link to comment
CowTurbo Posted June 30, 2011 Author Share Posted June 30, 2011 there is couple mistakes, if botton = "left" have to be if button == "left" and so on, but, this is not what i wanted, i wanna set progress bar progress, by moving arrow on it. Link to comment
Castillo Posted June 30, 2011 Share Posted June 30, 2011 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
Aibo Posted June 30, 2011 Share Posted June 30, 2011 wouldn't that be a scrollbar. progress bars usually do not require user input. Link to comment
qaisjp Posted July 1, 2011 Share Posted July 1, 2011 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: --> , just by typing Link to comment
CowTurbo Posted July 1, 2011 Author Share Posted July 1, 2011 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
Aibo Posted July 1, 2011 Share Posted July 1, 2011 stop inventing the bicycle and use scrollbar. progress bar stops being a progress bar when you want to "move arrow with mouse". Link to comment
CowTurbo Posted July 1, 2011 Author Share Posted July 1, 2011 but, that isnt that nice for there, even, when u give up so easyly, then u dont get good work Link to comment
Castillo Posted July 1, 2011 Share Posted July 1, 2011 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
CowTurbo Posted July 2, 2011 Author Share Posted July 2, 2011 The progress is not moving as it have to , i click at end, it moves to bit more of center, when i click at start, it moves a bit down then center, ...u should try it byu ur own... Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now