MiniGoveya Posted March 20, 2011 Share Posted March 20, 2011 I'm trying to make some world properties changer so, I made a button with the text "Water Color" ( Here start the problem ) when I touch it, it must open another window ( Like the set money, set armor, set health in normal admin panel ) but I don't know how to do it, I tried making another window in association with the button but didn't work, code: open = 0 function box() if open==0 then open = 1 showCursor(true) myWindow = guiCreateWindow(0.375, 0.375, 0.500, 0.500, "Map Test Help Commands - GUI Version", true) but1 = guiCreateButton(0.0, 0.1, 0.19, 0.1, "Fix", true, myWindow) but2 = guiCreateButton(0.0, 0.23, 0.19, 0.1, "Blow up", true, myWindow) but3 = guiCreateButton(0.0, 0.36, 0.19, 0.1, "Water Color", true, myWindow) elseif open==1 then open = 0 destroyElement(myWindow) end end open = 0 bindKey("l", "up", box) Link to comment
Castillo Posted March 20, 2011 Share Posted March 20, 2011 open = 0 function box() if open==0 then open = 1 showCursor(true) myWindow = guiCreateWindow(0.375, 0.375, 0.500, 0.500, "Map Test Help Commands - GUI Version", true) but1 = guiCreateButton(0.0, 0.1, 0.19, 0.1, "Fix", true, myWindow) but2 = guiCreateButton(0.0, 0.23, 0.19, 0.1, "Blow up", true, myWindow) but3 = guiCreateButton(0.0, 0.36, 0.19, 0.1, "Water Color", true, myWindow) elseif open==1 then open = 0 destroyElement(myWindow) end end open = 0 bindKey("l", "up", box) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == but1) then guiSetVisible(someWindowElement,true) elseif (source == but2) then guiSetVisible(someWindowElement2,true) elseif (source == but3) then guiSetVisible(someWindowElement3,true) end end) Was it that hard? Link to comment
MiniGoveya Posted March 20, 2011 Author Share Posted March 20, 2011 open = 0 function box() if open==0 then open = 1 showCursor(true) myWindow = guiCreateWindow(0.375, 0.375, 0.500, 0.500, "Map Test Help Commands - GUI Version", true) but1 = guiCreateButton(0.0, 0.1, 0.19, 0.1, "Fix", true, myWindow) but2 = guiCreateButton(0.0, 0.23, 0.19, 0.1, "Blow up", true, myWindow) but3 = guiCreateButton(0.0, 0.36, 0.19, 0.1, "Water Color", true, myWindow) elseif open==1 then open = 0 destroyElement(myWindow) end end open = 0 bindKey("l", "up", box) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == but1) then guiSetVisible(someWindowElement,true) elseif (source == but2) then guiSetVisible(someWindowElement2,true) elseif (source == but3) then guiSetVisible(someWindowElement3,true) end end) Link to comment
Castillo Posted March 20, 2011 Share Posted March 20, 2011 Are you kididng me? seriusly? that's the same code i've edited............. you should make new window(s) and change someWindowElement to your window element Link to comment
MiniGoveya Posted March 20, 2011 Author Share Posted March 20, 2011 No no no, you didn't get me. I want that when I press the button( Already existing ) appear the window not when I start the resource. Like the 'Set Money' 'Set Armour' 'Set Health' 'Set Nick', etcetera. This code ( Making the window ) make the window when I start the resource. open = 0 function box() if open==0 then open = 1 showCursor(true) myWindow = guiCreateWindow(0.375, 0.375, 0.500, 0.500, "Map Test Help Commands - GUI Version", true) but1 = guiCreateButton(0.0, 0.1, 0.19, 0.1, "Fix", true, myWindow) but2 = guiCreateButton(0.0, 0.23, 0.19, 0.1, "Blow up", true, myWindow) but3 = guiCreateButton(0.0, 0.36, 0.19, 0.1, "Water Color", true, myWindow) elseif open==1 then open = 0 destroyElement(myWindow) end end open = 0 bindKey("l", "up", box) w1 = guiCreateWindow(0.50, 0.50, 0.50, 0.500, "Map Test Help Commands - GUI Version", true) w2 = guiCreateWindow(0.50, 0.50, 0.50, 0.500, "Map Test Help Commands - GUI Version", true) w3 = guiCreateWindow(0.50, 0.50, 0.50, 0.50, "Map Test Help Commands - GUI Version", true) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == but1) then guiSetVisible(w1,true) elseif (source == but2) then guiSetVisible(w2,true) elseif (source == but3) then guiSetVisible(w3,true) end end) Link to comment
Moderators Citizen Posted March 20, 2011 Moderators Share Posted March 20, 2011 When you create a guiElement, you have to hide it after: open = 0 function box() if open==0 then open = 1 showCursor(true) myWindow = guiCreateWindow(0.375, 0.375, 0.500, 0.500, "Map Test Help Commands - GUI Version", true) but1 = guiCreateButton(0.0, 0.1, 0.19, 0.1, "Fix", true, myWindow) but2 = guiCreateButton(0.0, 0.23, 0.19, 0.1, "Blow up", true, myWindow) but3 = guiCreateButton(0.0, 0.36, 0.19, 0.1, "Water Color", true, myWindow) elseif open==1 then open = 0 destroyElement(myWindow) end end open = 0 bindKey("l", "up", box) w1 = guiCreateWindow(0.50, 0.50, 0.50, 0.500, "Map Test Help Commands - GUI Version", true) w2 = guiCreateWindow(0.50, 0.50, 0.50, 0.500, "Map Test Help Commands - GUI Version", true) w3 = guiCreateWindow(0.50, 0.50, 0.50, 0.50, "Map Test Help Commands - GUI Version", true) guiSetVisible(w1,false) guiSetVisible(w2,false) guiSetVisible(w3,false) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == but1) then guiSetVisible(w1,true) elseif (source == but2) then guiSetVisible(w2,true) elseif (source == but3) then guiSetVisible(w3,true) end end) 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