Atton Posted July 10, 2014 Share Posted July 10, 2014 I have been having a few issues with my GUI where if you click on blank space. It triggers random buttons and causes confusion is I have posted the relevant code below. Any ideas would be wonderful. local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 552, 476 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 Agui = guiCreateWindow(left, top, windowWidth, windowHeight, "Fuck Around Panel v1.2", false) guiWindowSetSizable(Agui, false) guiSetVisible(Agui, false) function CCF (button,state) if (button == "left" and state == "up") then triggerServerEvent("aCore.cloakCar", localPlayer, localPlayer) else -- Place Holder end end addEventHandler("onClientGUIClick",CCB,CCF) CCB = guiCreateButton(280, 175, 121, 61, "Cloak Car", false, Agui) Link to comment
Max+ Posted July 10, 2014 Share Posted July 10, 2014 (edited) screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 552, 476 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 Agui = guiCreateWindow(left, top, windowWidth, windowHeight, ":O Around Panel v1.2", false) CCB = guiCreateButton(280, 175, 121, 61, "Cloak Car", false, Agui) guiWindowSetSizable(Agui, false) guiSetVisible(Agui, false) addEventHandler(' onClientGUIClick', root, function ( ) if ( source == CCB ) then triggerServerEvent ( 'aCore.cloak', localPlayer ); end end ); Edited July 10, 2014 by Guest Link to comment
Atton Posted July 10, 2014 Author Share Posted July 10, 2014 screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 552, 476 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 Agui = guiCreateWindow(left, top, windowWidth, windowHeight, ":O Around Panel v1.2", false) guiWindowSetSizable(Agui, false) guiSetVisible(Agui, false) addEventHandler(' onClientGUIClick', root, function ( ) if ( source == CCB ) then triggerServerEvent ( 'aCore.cloak', localPlayer ); end end ); It brings up errors expecting () and shit not sure about it. Link to comment
Max+ Posted July 10, 2014 Share Posted July 10, 2014 screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 552, 476 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 Agui = guiCreateWindow(left, top, windowWidth, windowHeight, ":O Around Panel v1.2", false) guiWindowSetSizable(Agui, false) guiSetVisible(Agui, false) addEventHandler(' onClientGUIClick', root, function ( ) if ( source == CCB ) then triggerServerEvent ( 'aCore.cloak', localPlayer ); end end ); It brings up errors expecting () and :~ not sure about it. lol i forgot the button , post edit , copy it again . Link to comment
Atton Posted July 10, 2014 Author Share Posted July 10, 2014 screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 552, 476 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 Agui = guiCreateWindow(left, top, windowWidth, windowHeight, ":O Around Panel v1.2", false) guiWindowSetSizable(Agui, false) guiSetVisible(Agui, false) CCB = guiCreateButton(280, 175, 121, 61, "Cloak Car", false, Agui) addEventHandler(' onClientGUIClick', root, function ( ) if ( source == CCB ) then triggerServerEvent ( 'aCore.cloak', localPlayer ); end end ); It brings up errors expecting () and :~ not sure about it. lol i forgot the button , post edit , copy it again . addEventHandler(' onClientGUIClick', root, function ( ) if ( source == CCB ) then triggerServerEvent ( 'aCore.cloak', localPlayer ); end end ); Link to comment
Max+ Posted July 10, 2014 Share Posted July 10, 2014 i said copy my post , and test it /debugscript 3 Link to comment
Atton Posted July 10, 2014 Author Share Posted July 10, 2014 i said copy my post , and test it /debugscript 3 I cannot copy debugscript3. Link to comment
Et-win Posted July 10, 2014 Share Posted July 10, 2014 In game typ: /debugscript 3 :facepalm: https://wiki.multitheftauto.com/wiki/Debugging Read it. Link to comment
MTA Team botder Posted July 10, 2014 MTA Team Share Posted July 10, 2014 addEventHandler("onClientGUIClick",CCB,CCF) --> addEventHandler("onClientGUIClick",CCB,CCF, false) Link to comment
Atton Posted July 20, 2014 Author Share Posted July 20, 2014 addEventHandler("onClientGUIClick",CCB,CCF) --> addEventHandler("onClientGUIClick",CCB,CCF, false) Thanks my script is completely fixed and operational. 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