scolen Posted July 2, 2023 Share Posted July 2, 2023 How to make a gui panel open when f6 is pressed after using the bindKey function ? Link to comment
Firespider Posted July 2, 2023 Share Posted July 2, 2023 Hi, I'm sending you a basic code that you can use to do it. Maybe the code won't work, I haven't tested it, but try it. local sx, sy = guiGetScreenSize() local relx, rely = sx / 1920, sy / 1080 local Menu = false addEventHandler("onClientRender", root, function() if (Menu) then dxDrawRectangle(sx * 0.35, sy * 0.4, sx * 0.3, sy * 0.4, tocolor(20, 30, 40, 200)) -- Alap end end) function OpenPanel() if not (Menu) then Menu = true else Menu = false end end bindKey("F6", "Down", OpenPanel) 1 Link to comment
_SAXI_ Posted July 2, 2023 Share Posted July 2, 2023 local swidth,sheight=guiGetScreenSize() local w,h=300,400 local myWindow function createPanel() myWindow = guiCreateWindow(swidth/2-w/2,sheight/2-h/2,w,h,"My Window",false) --... end bindKey("f6","down",function() if not(myWindow)then createPanel() else destroyElement(myWindow) myWindow = nil end end) 1 Link to comment
scolen Posted July 3, 2023 Author Share Posted July 3, 2023 14 hours ago, Firespider said: Hi, I'm sending you a basic code that you can use to do it. Maybe the code won't work, I haven't tested it, but try it. local sx, sy = guiGetScreenSize() local relx, rely = sx / 1920, sy / 1080 local Menu = false addEventHandler("onClientRender", root, function() if (Menu) then dxDrawRectangle(sx * 0.35, sy * 0.4, sx * 0.3, sy * 0.4, tocolor(20, 30, 40, 200)) -- Alap end end) function OpenPanel() if not (Menu) then Menu = true else Menu = false end end bindKey("F6", "Down", OpenPanel) thanks brother 11 hours ago, _SAXI_ said: local swidth,sheight=guiGetScreenSize() local w,h=300,400 local myWindow function createPanel() myWindow = guiCreateWindow(swidth/2-w/2,sheight/2-h/2,w,h,"My Window",false) --... end bindKey("f6","down",function() if not(myWindow)then createPanel() else destroyElement(myWindow) myWindow = nil end end) worked.. thanks brother 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