DiSaMe Posted January 29, 2012 Share Posted January 29, 2012 This seems like a bug. Description of function guiScrollBarGetScrollPosition says it returns a float between 0 and 100. However, it actually returns an integer. I have this code: function createScroll() local scrollbar = guiCreateScrollBar (0.95,0,0.05,1,false,true) guiSetProperty(scrollbar,"StepSize",0.1/19.5) addEventHandler("onClientGUIScroll",scrollbar,onScroll) showCursor(true) end function onScroll() outputChatBox(tostring(guiScrollBarGetScrollPosition(source))) end createScroll() When I'm clicking the lower arrow of the scrollbar, it outputs these numbers: 0,1,1,2,2,3,3,4,4... Numbers in the sequence are increasing, what means the scroll position stored in MTA is a floating point value. But the function returns an integer, so I can't get an accurate position. Can I do something to get a float or at least a more accurate integer (for example, a value between 0 and 1000)? Link to comment
[STM]Metalhero Posted January 30, 2012 Share Posted January 30, 2012 1. function createScroll() 2. local scrollbar = guiCreateScrollBar (0.95,0,0.05,1,false,true) 3. guiSetProperty(scrollbar,"StepSize",0.1/19.5) 4. addEventHandler("onClientGUIScroll",scrollbar,onScroll) 5. showCursor(true) 6. end 7. 8. function onScroll() 9. outputChatBox(tostring(guiScrollBarGetScrollPosition(source)*10)) 10. end 11. 12. createScroll() Link to comment
Blaawee Posted January 30, 2012 Share Posted January 30, 2012 function createScroll() scrollbar = guiCreateScrollBar (0.95,0,0.05,1,false,true) guiSetProperty(scrollbar,"StepSize",0.1/19.5) showCursor(true) end function onScroll() outputChatBox(tostring(guiScrollBarGetScrollPosition(source)*1.0)) end addEventHandler("onClientGUIScroll",scrollbar,onScroll) 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