Anubhav Posted December 18, 2014 Posted December 18, 2014 Ok I was researching for clicks on buttons. I got it but, I'm expierencing a issue I'm having multiple buttons so I'm using up a loop now the problem is Button 1 Button 2 Button 3 Button 4 Button 5 If I click button 1 no problem If I click button 2:it outputs button 1 then button 2 If I click button 3:it outputs button 3 then button 1 then button 2 If I click button 4:it outputs button 4 then button 3 then button 1 then button 2 If I click button 5:it outputs button 4 then button 3 then button 1 then button 5 then button 2 What could be the problem? addEventHandler( "onClientClick", root, function( button, state, x, y ) if (button == "left") and (state == "up") and (showing) then local index = 0 for i, v in pairs( rules ) do index = index + 1 if ( x >= rules[ i ].acceptX and x <= rules[ i ].acceptX + rules[ i ].acceptW and y >= rules[ i ].acceptY and y <= rules[ i ].acceptY + rules[ i ].acceptH ) then currentText = rulesInfo[ index ] if colorSet then rules[ colorSet ].color = tocolor( 255, 255, 255, 255 ) end colorSet = false rules[ i ].color = tocolor( 255, 0, 0, 255 ) colorSet = i outputChatBox( tostring( colorSet)) end end end end ) See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Moderators IIYAMA Posted December 18, 2014 Moderators Posted December 18, 2014 Atleast break your loop. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anubhav Posted December 18, 2014 Author Posted December 18, 2014 Atleast break your loop. I tried that, it'd not still get fixed. See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Moderators IIYAMA Posted December 18, 2014 Moderators Posted December 18, 2014 show the table. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anubhav Posted December 19, 2014 Author Posted December 19, 2014 rules = { } rulesInfo = {} colorSet = false showing = false currentText = "- Please select a menu! -" rules[ 'Server Staff' ] = { acceptX = (screenW - 202) / 2 - 295, acceptY = (screenH - 39) / 2 - 90.50, acceptW = ((screenW - 202) / 2 - 295) + 152, acceptH = ( (screenH - 39) / 2 - 90.50) + 30, color = tocolor( 255, 255, 255, 255 ) } rules[ 'Server Rules' ] = { acceptX = (screenW - 202) / 2 - 295, acceptY = (screenH - 39) / 2 - 41.50, acceptW = ((screenW - 202) / 2 - 295) + 152, acceptH = ( (screenH - 39) / 2 - 41.50) + 29, color = tocolor( 255, 255, 255, 255 ) } rules[ 'Server News' ] = { acceptX = (screenW - 202) / 2 - 295, acceptY = (screenH - 39) / 2 + 56.50, acceptW = ((screenW - 202) / 2 - 295) + 152, acceptH = ( (screenH - 39) / 2 + 56.50) + 31, color = tocolor( 255, 255, 255, 255 ) } rules[ 'Server Information' ] = { acceptX = (screenW - 202) / 2 - 295, acceptY = (screenH - 39) / 2 + 7.50, acceptW = ((screenW - 202) / 2 - 295) + 218, acceptH = ( (screenH - 39) / 2 + 7.50) + 29, color = tocolor( 255, 255, 255, 255 ) } rules[ 'Server Player Count' ] = { acceptX = (screenW - 202) / 2 - 295, acceptY = (screenH - 39) / 2 + 105.50, acceptW = ((screenW - 202) / 2 - 295) + 233, acceptH = ( (screenH - 39) / 2 + 105.50) + 33, color = tocolor( 255, 255, 255, 255 ) } See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Anubhav Posted December 19, 2014 Author Posted December 19, 2014 Case closed, IIYAMA helped me on skype! Many thanks to him! See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
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