Anubhav Posted December 18, 2014 Share 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 ) Link to comment
Moderators IIYAMA Posted December 18, 2014 Moderators Share Posted December 18, 2014 Atleast break your loop. Link to comment
Anubhav Posted December 18, 2014 Author Share Posted December 18, 2014 Atleast break your loop. I tried that, it'd not still get fixed. Link to comment
Moderators IIYAMA Posted December 18, 2014 Moderators Share Posted December 18, 2014 show the table. Link to comment
Anubhav Posted December 19, 2014 Author Share 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 ) } Link to comment
Anubhav Posted December 19, 2014 Author Share Posted December 19, 2014 Case closed, IIYAMA helped me on skype! Many thanks to him! 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