DriFtyZ Posted May 15, 2017 Posted May 15, 2017 Hello mta community, im new to lua scripting (day 2) and i want to make a gui menu that has options inside to enable disable shaders but for now i can't even reach the way how the windows gets visible when i pree a key (F2 in my situation) can you help me out a bit? thanks in advance Here's my code below (yes i checked mta wiki) water = {} Contrast = {} Close = {} carpaint = {} contrast = {} graphics = {} detail = {} addEventHandler("onClientResourceStart", resourceRoot, function GuiWindow () graphics.window = guiCreateWindow(625, 207, 451, 315, "Graphics Menu", false) guiWindowSetSizable(graphics.window, false) guiSetAlpha(graphics.window, 0.85) guiSetProperty(graphics.window, "CaptionColour", "FFB1794C") carpaint.checkbox = guiCreateCheckBox(192, 53, 16, 20, "", false, false, graphics.window) water.checkbox = guiCreateCheckBox(192, 100, 17, 17, "", false, false, graphics.window) constrast.checkbox = guiCreateCheckBox(192, 144, 14, 16, "", false, false, graphics.window) detail.checkbox = guiCreateCheckBox(192, 187, 15, 15, "", false, false, graphics.window) Close.button = guiCreateButton(149, 243, 152, 49, "Close", false, graphics.window) guiSetProperty(Close.button, "NormalTextColour", "FFAAAAAA") carpaint.label = guiCreateLabel(39, 53, 86, 25, "Car Reflections", false, graphics.window) guiSetFont(carpaint.label, "default-bold-small") water.label = guiCreateLabel(39, 100, 104, 24, "Water Reflections", false, graphics.window) guiSetFont(water.label, "default-bold-small") contrast.label = guiCreateLabel(39, 142, 104, 26, "Contrast", false, graphics.window) guiSetFont(contrast.label, "default-bold-small") detail.label = guiCreateLabel(39, 186, 104, 26, "Detail", false, graphics.window) guiSetFont(detail.label, "default-bold-small") end ) bindKey ( "F2", "down", F2) function F2 () local state = guiGetVisible ( graphics.window ) if state == false then guiSetVisible (graphics.window, true) showCursor (true) else guiSetVisible (graphics.window, false) showCursor (false) end end
Abdul KariM Posted May 15, 2017 Posted May 15, 2017 Test this water = {} Contrast = {} Close = {} carpaint = {} contrast = {} graphics = {} detail = {} graphics.window = guiCreateWindow(625, 207, 451, 315, "Graphics Menu", false) guiWindowSetSizable(graphics.window, false) guiSetAlpha(graphics.window, 0.85) guiSetProperty(graphics.window, "CaptionColour", "FFB1794C") guiSetVisible (graphics.window, false) carpaint.checkbox = guiCreateCheckBox(192, 53, 16, 20, "", false, false, graphics.window) water.checkbox = guiCreateCheckBox(192, 100, 17, 17, "", false, false, graphics.window) constrast.checkbox = guiCreateCheckBox(192, 144, 14, 16, "", false, false, graphics.window) detail.checkbox = guiCreateCheckBox(192, 187, 15, 15, "", false, false, graphics.window) Close.button = guiCreateButton(149, 243, 152, 49, "Close", false, graphics.window) guiSetProperty(Close.button, "NormalTextColour", "FFAAAAAA") carpaint.label = guiCreateLabel(39, 53, 86, 25, "Car Reflections", false, graphics.window) guiSetFont(carpaint.label, "default-bold-small") water.label = guiCreateLabel(39, 100, 104, 24, "Water Reflections", false, graphics.window) guiSetFont(water.label, "default-bold-small") contrast.label = guiCreateLabel(39, 142, 104, 26, "Contrast", false, graphics.window) guiSetFont(contrast.label, "default-bold-small") detail.label = guiCreateLabel(39, 186, 104, 26, "Detail", false, graphics.window) guiSetFont(detail.label, "default-bold-small") function F2 () local state = guiGetVisible ( graphics.window ) if state == false then guiSetVisible (graphics.window, true) showCursor (true) else guiSetVisible (graphics.window, false) showCursor (false) end end bindKey ( "F2", "down", F2)
DriFtyZ Posted May 15, 2017 Author Posted May 15, 2017 thanks a lot it worked but i can't understand why the panel opens up while starting the resource by default even since the event handle is gone now
Gordon_G Posted May 15, 2017 Posted May 15, 2017 Add this at line 29 guiSetVisible(graphics.window, false)
DriFtyZ Posted May 15, 2017 Author Posted May 15, 2017 Thanks a lot, i was going to make it dissapear through onresourcestart event but your option is more simple
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