TheSmart Posted September 20, 2015 Share Posted September 20, 2015 Hello Guys! today i was creating Dx Help Panel but it have problem that is when i press f1 dxpanel show up but when i press f1 again it wont remove Tell me why there is any problem in this code? function open() if (guiGetVisible (buttons) == false) then guiSetVisible(buttons, true) addEventHandler("onClientRender", root, dxPanel) showCursor(true) elseif (guiGetVisible (buttons) == true) then guiSetVisible(buttons, false) removeEventHandler("onClientRender", root, dxPanel) showCursor(false) end end bindKey ("F1", "down", open) Link to comment
The Don Posted September 20, 2015 Share Posted September 20, 2015 function open() if (guiGetVisible (buttons) == false) then guiSetVisible(buttons, true) addEventHandler("onClientRender", root, dxPanel) showCursor(true) else guiSetVisible(buttons, false) removeEventHandler("onClientRender", root, dxPanel) showCursor(false) end end bindKey ("F1", "down", open) Link to comment
TheSmart Posted September 20, 2015 Author Share Posted September 20, 2015 doesn't work Link to comment
KariiiM Posted September 20, 2015 Share Posted September 20, 2015 function open() if (guiGetVisible (buttons) == false) then guiSetVisible(buttons, true) addEventHandler("onClientRender", root, dxPanel) showCursor(true) else guiSetVisible(buttons, false) removeEventHandler("onClientRender", root, dxPanel) showCursor(false) end end bindKey ("F1", "down", open) Link to comment
The Don Posted September 20, 2015 Share Posted September 20, 2015 hmmm try this windowstate = true bindKey("F1","down", function () if windowstate == true then guiSetVisible(buttons, true) addEventHandler("onClientRender", root, dxPanel) showCursor(true) windowstate = false else guiSetVisible(buttons, false) removeEventHandler("onClientRender", root, dxPanel) showCursor(false) windowstate = true end end ) Link to comment
TheSmart Posted September 20, 2015 Author Share Posted September 20, 2015 function open() if (guiGetVisible (buttons) == false) then guiSetVisible(buttons, true) addEventHandler("onClientRender", root, dxPanel) showCursor(true) else guiSetVisible(buttons, false) removeEventHandler("onClientRender", root, dxPanel) showCursor(false) end end bindKey ("F1", "down", open) what you change?...Nothing, Not working D: Link to comment
TheSmart Posted September 20, 2015 Author Share Posted September 20, 2015 (edited) hmmm try this windowstate = true bindKey("F1","down", function () if windowstate == true then guiSetVisible(buttons, true) addEventHandler("onClientRender", root, dxPanel) showCursor(true) windowstate = false else guiSetVisible(buttons, false) removeEventHandler("onClientRender", root, dxPanel) showCursor(false) windowstate = true end end ) Thank you @Don its working now Edited September 20, 2015 by Guest Link to comment
KariiiM Posted September 20, 2015 Share Posted September 20, 2015 what you change?...Nothing, Not working D: We just posted the same post together in same time, Link to comment
LabiVila Posted September 21, 2015 Share Posted September 21, 2015 Another cool way of doing that is this: bindKey ("F1", "down", function () windowstate = not windowstate if windowstate then guiSetVisible (buttons, true) addEventHandler ("onClientRender", root, dxPanel) showCursor (true) else guiSetVisible (buttons, true) removeEventHandler ("onClientRender", root, dxPanel) showCursor (false) end end ) you don't have to declare much variables or stuff, and you might as well want to use guiSetInputEnabled (true), as it won't output to chatbox things you write in your dxPanel 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